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

XRootD does not compile with Clang 15.x #1975

Closed
amadio opened this issue Mar 23, 2023 · 3 comments
Closed

XRootD does not compile with Clang 15.x #1975

amadio opened this issue Mar 23, 2023 · 3 comments
Assignees
Milestone

Comments

@amadio
Copy link
Member

amadio commented Mar 23, 2023

There are several errors due to redefinition of extern inline functions in XrdPosixPreload:

xrootd/src/XrdPosix/XrdPosixPreload32.cc:375:9: 
  error: redefinition of a 'extern inline' function 'pread' is not supported in C++
ssize_t pread(int fildes, void *buf, size_t nbyte, off_t offset)
        ^
/usr/include/bits/unistd.h:72:1: note: previous definition is here
pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset)
^

We should try to fix this, as eventually XRootD will stop compiling on macOS if we don't.

@amadio amadio self-assigned this Mar 23, 2023
@xrootd-dev
Copy link

xrootd-dev commented Mar 23, 2023 via email

@abh3 abh3 self-assigned this Mar 23, 2023
@amadio amadio added this to the 5.6 milestone Apr 5, 2023
@amadio
Copy link
Member Author

amadio commented Apr 13, 2023

I looked into this today. The problem is that my distribution has #define _FORTIFY_SOURCE 2 by default and Clang doesn't really like that (with GCC it works fine). So I guess the course of action is to forcibly disable it for Clang. I will open a pull request with a patch.

amadio added a commit to amadio/xrootd that referenced this issue Apr 13, 2023
Some of the checks added by defining _FORTIFY_SOURCE break the
build with clang with errors like the one shown below. See the
manual page for feature_test_macros(7) for more information.

xrootd/src/XrdPosix/XrdPosixPreload32.cc:375:9:
  error: redefinition of a 'extern inline' function 'pread' is not supported in C++
ssize_t pread(int fildes, void *buf, size_t nbyte, off_t offset)
        ^
/usr/include/bits/unistd.h:72:1: note: previous definition is here
pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset)
^

Since distributions enable _FORTIFY_SOURCE by default, it's better
to disable it for the XrdPosix plugin when using clang. Builds with
GCC are not affected by this problem.

Fixes xrootd#1975.
@amadio
Copy link
Member Author

amadio commented Apr 13, 2023

Alright, just added a commit to the pull request where I'm addressing clang warnings. Also, just for the record, Fedora enabled _FORTIFY_SOURCE 3: https://fedoraproject.org/wiki/Changes/Add_FORTIFY_SOURCE%3D3_to_distribution_build_flags, so this will eventually trickle down to RHEL and Alma.

@abh3 abh3 closed this as completed in 0f9aa1e Apr 17, 2023
@amadio amadio modified the milestones: 5.6, 5.5.5 May 5, 2023
amadio added a commit to amadio/xrootd that referenced this issue May 5, 2023
Some of the checks added by defining _FORTIFY_SOURCE break the
build with clang with errors like the one shown below. See the
manual page for feature_test_macros(7) for more information.

xrootd/src/XrdPosix/XrdPosixPreload32.cc:375:9:
  error: redefinition of a 'extern inline' function 'pread' is not supported in C++
ssize_t pread(int fildes, void *buf, size_t nbyte, off_t offset)
        ^
/usr/include/bits/unistd.h:72:1: note: previous definition is here
pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset)
^

Since distributions enable _FORTIFY_SOURCE by default, it's better
to disable it for the XrdPosix plugin when using clang. Builds with
GCC are not affected by this problem.

Fixes xrootd#1975.
amadio added a commit to amadio/xrootd that referenced this issue May 7, 2023
Some of the checks added by defining _FORTIFY_SOURCE break the
build with clang with errors like the one shown below. See the
manual page for feature_test_macros(7) for more information.

xrootd/src/XrdPosix/XrdPosixPreload32.cc:375:9:
  error: redefinition of a 'extern inline' function 'pread' is not supported in C++
ssize_t pread(int fildes, void *buf, size_t nbyte, off_t offset)
        ^
/usr/include/bits/unistd.h:72:1: note: previous definition is here
pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset)
^

Since distributions enable _FORTIFY_SOURCE by default, it's better
to disable it for the XrdPosix plugin when using clang. Builds with
GCC are not affected by this problem.

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

No branches or pull requests

3 participants