aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasil Dimov <vd@FreeBSD.org>2017-11-11 15:29:42 +0200
committerVasil Dimov <vd@FreeBSD.org>2017-11-11 15:29:42 +0200
commit3501ed1fdfc7f34f4c809a7212974078dc217bf3 (patch)
treec2fb9ff643aa8ce4a531cc0e3c16e46a7b41d45f
parentMerge pull request #2694 (diff)
downloadmonero-3501ed1fdfc7f34f4c809a7212974078dc217bf3.tar.xz
Do not require libatomic on FreeBSD
f3e09f36 hooked a dependency on libatomic on 32 bit machines if Clang is used because compilation failed with: `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' But that does not happen on FreeBSD. The problem is likely that on Linux Clang tries to use GCC-provided C++11 library. Further, __atomic_load_8() (for 8-byte integers) is not readily available on 32 bit machines. From https://gcc.gnu.org/wiki/Atomic/GCCMM: "When lock free instructions are not available (either through hardware or OS support) atomic operations are left as function calls to be resolved by a library."
-rw-r--r--CMakeLists.txt2
1 files changed, 1 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 637e9c4e6..75d6a1ecd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -698,7 +698,7 @@ endif()
if(ANDROID)
set(ATOMIC libatomic.a)
endif()
-if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND ARCH_WIDTH EQUAL "32" AND NOT IOS)
+if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND ARCH_WIDTH EQUAL "32" AND NOT IOS AND NOT FREEBSD)
find_library(ATOMIC atomic)
list(APPEND EXTRA_LIBRARIES ${ATOMIC})
endif()