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

src/XrdServer.cmake: Use ${CMAKE_THREAD_LIBS_INIT} instead of pthread #1506

Closed
wants to merge 1 commit into from
Closed

Conversation

AdrianBunk
Copy link

This passes -pthread instead of -lpthread, fixing a build failure on RISC-V.

@ellert This is an alternative to #1505

This passes -pthread instead of -lpthread,
fixing a build failure on RISC-V.
@simonmichal
Copy link
Contributor

@AdrianBunk : thanks for the PR and sorry I haven't noticed it before merging #1505, yours seems to be slightly more cleaner, let me think what to do about it ;-)

@ellert
Copy link
Contributor

ellert commented Sep 6, 2021

To be consistent, shouldn't all linking to -lpthread be replaced with -pthread? Not just for libXrdServer.
That way the compiler can avoid linking to libpthread on systems with new glibc where the pthread functions are included in glibc.
Those systems have an empty libpthread so that code using -lpthread doesn't fail to build, but maybe that backward compatibility thing goes away in a decade or so.
(I know this is a bigger change going beyond the scope of just fixing the riscv64 build.)

@AdrianBunk
Copy link
Author

To be consistent, shouldn't all linking to -lpthread be replaced with -pthread? Not just for libXrdServer.

Yes, this would be more consistent.

That way the compiler can avoid linking to libpthread on systems with new glibc where the pthread functions are included in glibc.
Those systems have an empty libpthread so that code using -lpthread doesn't fail to build, but maybe that backward compatibility thing goes away in a decade or so.

glibc is not one of these projects that break backwards compatibility, they are always working hard to ensure that even binaries from the 1990s still work (which is important for many users).

Linking with libpthread is required by POSIX, and the empty libpthread.a glibc >= 2.34 provides for supporting it is really trivial.

@ellert ellert mentioned this pull request Sep 7, 2021
@simonmichal
Copy link
Contributor

@AdrianBunk & @ellert : thanks a lot for highlighting and addressing this issue! I will close this one as I just merged the #1509, which also includes the changes proposed in this PR.

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

3 participants