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

Support for musl libc and uclibc #1908

Merged
merged 20 commits into from
Feb 17, 2023
Merged

Support for musl libc and uclibc #1908

merged 20 commits into from
Feb 17, 2023

Conversation

amadio
Copy link
Member

@amadio amadio commented Feb 14, 2023

Based on work from and replaces pull request #1632.

src/XrdSys/XrdSysPthread.hh Outdated Show resolved Hide resolved
amadio and others added 20 commits February 17, 2023 11:19
Fixes compilation issue on older gcc

```
/usr/src/xrootd-5.5.2/src/XrdPosix/XrdPosixAdmin.cc: In member function ‘XrdCl::URL* XrdPosixAdmin::FanOut(int&)’:
/usr/src/xrootd-5.5.2/src/XrdPosix/XrdPosixAdmin.cc:70:32: error: ‘ptrdiff_t’ was not declared in this scope
    if (i > std::numeric_limits<ptrdiff_t>::max() / sizeof(XrdCl::URL))
                                ^
/usr/src/xrootd-5.5.2/src/XrdPosix/XrdPosixAdmin.cc:70:32: note: suggested alternatives:
In file included from /usr/include/c++/5/limits:42:0,
                 from /usr/src/xrootd-5.5.2/src/XrdPosix/XrdPosixAdmin.cc:32:
/usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h:197:28: note:   ‘std::ptrdiff_t’
   typedef __PTRDIFF_TYPE__ ptrdiff_t;
                            ^
/usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h:197:28: note:   ‘std::ptrdiff_t’
/usr/src/xrootd-5.5.2/src/XrdPosix/XrdPosixAdmin.cc:70:41: error: template argument 1 is invalid
    if (i > std::numeric_limits<ptrdiff_t>::max() / sizeof(XrdCl::URL))
                                         ^
src/CMakeFiles/XrdPosix.dir/build.make:62: recipe for target 'src/CMakeFiles/XrdPosix.dir/XrdPosix/XrdPosixAdmin.cc.o' failed
make[2]: *** [src/CMakeFiles/XrdPosix.dir/XrdPosix/XrdPosixAdmin.cc.o] Error 1
```
…provides a checksum computation program

Solves issue xrootd#1901
* Initialize all variables to avoid a potential 'may be used
  uninitialized' warning that will become an error with `-flto=auto`
  is used.

Co-authored-by: Adrian Sevcenco <adrian.sevcenco@cern.ch>
Out of principle musl libc provides no means for detecting it, leaving
developers to figure it out for themselves. The choice here is to use
the compiler to print the target triple, which contains the libc
implementation as the last part. On Voidlinux it's x86_64-linux-musl,
and on Alpine it's x86_64-alpine-linux-musl. This should be reliable
enough to not wrongly detect other libc implementations as musl (and
failure to detect will only affect platforms based on musl as well).

See https://wiki.musl-libc.org/faq.html for more information.
Based on work from pull request xrootd#1632.

Co-authored-by: Guilherme Amadio <amadio@cern.ch>
The header execinfo.h is not available on musl, so the #ifdefs
needed to be adjusted accordingly. This header is available on
macOS, and with both glibc and uclibc on Linux, though.
This covers building with musl libc.
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 this pull request may close these issues.

None yet

8 participants