-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
meson: always use libatomic if found #25069
Conversation
3e151c0
to
c5e1e72
Compare
As suggested in #25057: maybe just drop this test and simply always link against it and rely on |
Let's do that instead, please. It's a good option, especially given my latest comment over there. But note that |
c5e1e72
to
3397c0e
Compare
Updated. |
3397c0e
to
ec22b2a
Compare
This comment was marked as resolved.
This comment was marked as resolved.
ec22b2a
to
827c361
Compare
Pfff, no nice approach works. After trying a few different approaches, a manual check seems to be the most reliable. |
meson.build
Outdated
threads = dependency('threads') | ||
librt = cc.find_library('rt') | ||
libm = cc.find_library('m') | ||
libdl = cc.find_library('dl') | ||
libcrypt = cc.find_library('crypt') | ||
|
||
# On some architectures, libatomic is required. But on some installations, | ||
# it is found, but actual linking fails. So let's try to use it opportunstically. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/opportunstically/opportunistically/
I found some explanation of Red Hat / Fedora situation in scylladb/seastar#533. |
Semi-quoting systemd#25057: clang-16 has made the choice to turn on -Werror=implicit-function-declaration,implicit-int. (See Gentoo's tracker bug https://bugs.gentoo.org/870412). Added in commit 132c73b, systemd now does a check to see if libatomic is needed with some compile/link tests with e.g. __atomic_exchange_1, but the tests don't provide a prototype for __atomic_exchange_1 so with clang-16 the test fails, breaking the build. Let's simplify things by linking to libatomic unconditionally if it is found and seems to work. If actually unneeded, it might be dropped via --as-needed. This seems to work with gcc and clang. declare_dependency() is used instead of cc.find_library(), because the latter picks up a symlink in gcc private directory (e.g. /usr/lib/gcc/x86_64-redhat-linux/12/libatomic.so), and we don't want that. Fixes systemd#25057.
827c361
to
83fffe2
Compare
Fixed the typo since it was trivial, no other changes so merging |
Semi-quoting #25057:
clang-16 has made the choice to turn on -Werror=implicit-function-declaration,implicit-int. (See Gentoo's tracker bug https://bugs.gentoo.org/870412). Added in commit 132c73b, systemd now does a check to see if libatomic is needed with some compile/link tests with e.g. __atomic_exchange_1, but the tests don't provide a prototype for __atomic_exchange_1 so with clang-16 the test fails, breaking the build.
Add -Wno-implicit-function-declaration (which is supported by both gcc and clang) to should get rid of the warning or error.
(I don't have clang-16 at hand, but with clang-15.0.0-2.fc37.x86_64 the warnings are gone and the link fails, and then when -latomic is added, succeeds.)
Fixes #25057.