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

Avoid pthread ”_np” functions for portability? #1645

Closed
ghost opened this issue Mar 13, 2022 · 5 comments
Closed

Avoid pthread ”_np” functions for portability? #1645

ghost opened this issue Mar 13, 2022 · 5 comments
Assignees
Labels
Pending Info Waiting on additional information from issue reporter Under Investigation
Milestone

Comments

@ghost
Copy link

ghost commented Mar 13, 2022

Compiling on Alpine Linux currently fails due to the non-existence of non-standard extensions of GNU to pthread functions. E.g., pthread_rwlockattr_setkind_np is not in the musl C library. I recommmend to work around code like this, in XrdSysPthread, to welcome Alpine Linux users to the world of XRootD. Is it possible?

@simonmichal
Copy link
Contributor

@peter-jansson : thanks for bringing this up!

First of all, unfortunately I couldn't find any predefined macro that will tell us if we are using the musl C library (I am open to any suggestions). But let's say we do in cmake something like:

check_function_exists( pthread_rwlockattr_setkind_np, HAS_NP)
if( NOT HAS_NP )
  add_compile_definitions( __MUSL__ )
endif()

Then we can use the __MUSL__ macro to make sure the _np functions are not used.

However, having this in place (and fixing few other small issues) I run into the following problems:

  • error: 'innetgr' was not declared in this scope
  • the uuid/uuid.h header is missing (AFAIU the there's not package providing it)
  • error: 'timeval' does not name a type

Now, I'm not sure we can work around those problems, especially the missing uuid/uuid.h header (I couldn't find any package providing it).

If you are willing to contribute, please open a PR and we can try to address those issues one by one.

@abh3
Copy link
Member

abh3 commented Jan 30, 2023

Where are we on this ticket?

@abh3 abh3 added the Pending Info Waiting on additional information from issue reporter label Jan 30, 2023
@ghost
Copy link
Author

ghost commented Feb 5, 2023

  • the uuid/uuid.h header is missing (AFAIU the there's not package providing it)

The util-linux-dev package on Alpine Linux contains uuid/uuid.h from libuuid in util-linux at kernel.org.

@amadio
Copy link
Member

amadio commented Feb 6, 2023

Support for musl is (maybe partially) addressed in #1632, but I don't see any changes related to pthread functions there. We do intend to add support for it, although we cannot give a particular timeline, as we have to prioritize current supported platforms. I hope to test/merge musl support as part of the next feature release, 5.6.

@amadio amadio added this to the 5.6.0 milestone Feb 15, 2023
@amadio
Copy link
Member

amadio commented Feb 17, 2023

Fixed with merge of musl branch into master (#1908). I also added a build on alpine to GitHub Actions.

@amadio amadio closed this as completed Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pending Info Waiting on additional information from issue reporter Under Investigation
Projects
None yet
Development

No branches or pull requests

3 participants