Revert "Fix build error on riscv64 by linking libatomic" #197
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This reverts commit 10c277c.
Whether
-latomic
needs to be linked or not depends on the used toolchain, not the architecture of the platform we build for. In my case I'm building on a riscv64 system using the LLVM toolchain, so there's not even a-latomic
to link against. But the current logic tries to link-latomic
anyway, resulting in a build failure.The correct way to detect whether the used toolchain needs to link
-latomic
explicitly in order to use__atomic_fetch_and_1
seems to beAC_SEARCH_LIBS
.This was
1.) introduced in e0de0d9 ("link with -latomic if needed")
2.) wrongly removed in commit 10c277c ("Fix build error on riscv64 by linking libatomic").
3.) reinstantiated in commit 18ec3b9 ("link with -latomic if needed (again ...)")
The build log[1] referenced in the PR[2] that introduced the unconditional linking of
-latomic
on riscv64 shows that the build error happened with version 2.0.14, but the commit introducing the usage ofAC_SEARCH_LIBS
was merged after that:$ git --no-pager tag --contains e0de0d9
v2.0.15
v2.0.16
So it looks like e0de0d9 ("link with -latomic if needed") fixed the problem for both scenarios and 10c277c ("Fix build error on riscv64 by linking libatomic") wasn't necessary at all after it.
[1] https://buildd.debian.org/status/fetch.php?pkg=numactl&arch=riscv64&ver=2.0.14-3&stamp=1632275973&raw=0
[2] #131