Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building with -DENABLE_XATTRS=OFF fails with "call to undeclared function" #578

Open
Michael-Hennecke opened this issue Jul 30, 2024 · 3 comments · May be fixed by #583
Open

Building with -DENABLE_XATTRS=OFF fails with "call to undeclared function" #578

Michael-Hennecke opened this issue Jul 30, 2024 · 3 comments · May be fixed by #583
Assignees

Comments

@Michael-Hennecke
Copy link
Collaborator

Building on SLES 15.5 and Intel MPI fails with "undeclared function" errors when using -DENABLE_XATTRS=OFF.
The respective function calls should probably be wrapped in some sort of "#ifdef XATTR"?

module load gcc intel-toolkit/2024.1.0 intel-mpi/2021.12.0 cmake

cmake ../mpifileutils
-DCMAKE_INSTALL_PREFIX=../install
-DWITH_DAOS_PREFIX=/usr
-DENABLE_DAOS=ON
-DENABLE_XATTRS=OFF

make -j install
...
/dss/dsshome1/09/di29puz3/dev/mpifileutils-v0.11.1/mpifileutils/src/common/mfu_io.c:1509:18: error: call to undeclared function 'llistxattr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
1509 | ssize_t rc = llistxattr(path, list, size);
| ^
/dss/dsshome1/09/di29puz3/dev/mpifileutils-v0.11.1/mpifileutils/src/common/mfu_io.c:1546:18: error: call to undeclared function 'listxattr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
1546 | ssize_t rc = listxattr(path, list, size);
| ^
/dss/dsshome1/09/di29puz3/dev/mpifileutils-v0.11.1/mpifileutils/src/common/mfu_io.c:1583:18: error: call to undeclared function 'lgetxattr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
1583 | ssize_t rc = lgetxattr(path, name, value, size);
| ^
/dss/dsshome1/09/di29puz3/dev/mpifileutils-v0.11.1/mpifileutils/src/common/mfu_io.c:1618:18: error: call to undeclared function 'getxattr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
1618 | ssize_t rc = getxattr(path, name, value, size);
| ^
/dss/dsshome1/09/di29puz3/dev/mpifileutils-v0.11.1/mpifileutils/src/common/mfu_io.c:1654:14: error: call to undeclared function 'lsetxattr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
1654 | int rc = lsetxattr(path, name, value, size, flags);
| ^

@daltonbohning
Copy link
Collaborator

There is already a #if DCOPY_USE_XATTRS which could be used for this. It's added around the xattr.h includes, but not all the xattr functions as well.

Similar to what we did for DAOS support

int daos_symlink(const char* oldpath, const char* newpath, mfu_file_t* mfu_file)
{
#ifdef DAOS_SUPPORT
    int rc = dfs_sys_symlink(mfu_file->dfs_sys, oldpath, newpath);
    return mfu_errno2rc(rc);
#else
    return mfu_errno2rc(ENOSYS);
#endif
}

Maybe we can do this for the functions using xattrs

ssize_t mfu_file_llistxattr(const char* path, char* list, size_t size, mfu_file_t* mfu_file)
{
#ifdef DCOPY_USE_XATTRS
    if (mfu_file->type == POSIX) {
        ssize_t rc = mfu_llistxattr(path, list, size);
        return rc;
    } else if (mfu_file->type == DFS) {
        ssize_t rc = daos_llistxattr(path, list, size, mfu_file);
        return rc;
    } else {
        MFU_ABORT(-1, "File type not known, type=%d",
                  mfu_file->type);
    }
#else
    return mfu_errno2rc(ENOSYS);
#endif
}

Or maybe it's better to just not define those at all?

#ifdef DCOPY_USE_XATTRS
ssize_t mfu_file_llistxattr(const char* path, char* list, size_t size, mfu_file_t* mfu_file)
{
    if (mfu_file->type == POSIX) {
        ssize_t rc = mfu_llistxattr(path, list, size);
        return rc;
    } else if (mfu_file->type == DFS) {
        ssize_t rc = daos_llistxattr(path, list, size, mfu_file);
        return rc;
    } else {
        MFU_ABORT(-1, "File type not known, type=%d",
                  mfu_file->type);
    }
}
#endif

@gonsie Any recommendation for the proper way to handle this?

@gonsie
Copy link
Contributor

gonsie commented Aug 1, 2024

Sorry, I have no idea. Hopefully @adammoody can help!

@Michael-Hennecke
Copy link
Collaborator Author

Michael-Hennecke commented Aug 22, 2024

@adammoody any comments? it seems that the compiler is actually complaining about not having the declarations for the POSIX functions, independent of DAOS. Adding the headrfile seems to fix the errors:

diff mfu_io.c*
5d4
< #include <sys/xattr.h>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants