diff options
author | redfish <redfish@galactica.pw> | 2016-07-10 21:05:52 -0400 |
---|---|---|
committer | redfish <redfish@galactica.pw> | 2016-07-10 21:27:00 -0400 |
commit | f3e09f36d3140016cd4597d237528783fbfc86c8 (patch) | |
tree | dfa66fdf7f15ca27164fcc50b154b0837c2ee2ec /CMakeLists.txt | |
parent | cmake: include -ldl via cmake built-in var (diff) | |
download | monero-f3e09f36d3140016cd4597d237528783fbfc86c8.tar.xz |
cmake: link with -latomic for clang
otherwise clang build fails with
../cryptonote_core/libcryptonote_core.a(miner.cpp.o): In function
`std::__atomic_base<unsigned long long>::load(std::memory_order) const':
/usr/bin/../lib/gcc/i686-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/bits/atomic_base.h:396:
undefined reference to `__atomic_load_8'
This has no effect on the gcc build.
The one strange thing is that test code like
std::atomic<int> x;
int main() { return x; }
compiles and links without errors with clang, without -latomic. This
alone would suggest that this patch is unnecessary, but that is not the
case. It's not clear exactly why, though. The bitmonero code is
including the same header, but it must be doing something more complex
than in this test code snippet that causes the failure at link time
pasted above. In any case, passing -latomic fixes the problem and
seems safe.
.
Diffstat (limited to '')
-rw-r--r-- | CMakeLists.txt | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 673be4a8e..2b9deef55 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -457,6 +457,11 @@ endif() list(APPEND EXTRA_LIBRARIES ${CMAKE_DL_LIBS}) +if(NOT MINGW) + find_library(ATOMIC atomic) + list(APPEND EXTRA_LIBRARIES ${ATOMIC}) +endif() + include(version.cmake) add_subdirectory(contrib) |