blob: 185b7b77ff71889280ed68c547bc250c71854b7b [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001From ffaaf4d43ebf2ef6d0229a60f407c1f5a06e5c53 Mon Sep 17 00:00:00 2001
2From: Mingli Yu <mingli.yu@windriver.com>
3Date: Fri, 15 Mar 2019 01:46:05 -0700
4Subject: [PATCH] build_rocksdb.cmake: fix atomic support on arm
5
6Check to link with libatomic to enable C11 atomics support
7to fix below build error on arm:
8| /build/tmp/work/armv5e-wrs-linux-gnueabi/mariadb/10.3.13-r0/recipe-sysroot-native/usr/bin/arm-wrs-linux-gnueabi/../../libexec/arm-wrs-linux-gnueabi/gcc/arm-wrs-linux-gnueabi/8.3.0/ld.bfd: librocksdblib.a(env_posix.cc.o): in function `std::__atomic_base<unsigned long long>::store(unsigned long long, std::memory_order)':
9| /usr/include/c++/8.3.0/bits/atomic_base.h:374: undefined reference to `__atomic_store_8'
10
11Upstream-Status: Pending
12
13Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
14---
15 storage/rocksdb/build_rocksdb.cmake | 3 +++
16 1 file changed, 3 insertions(+)
17
Brad Bishop19323692019-04-05 15:28:33 -040018--- a/storage/rocksdb/build_rocksdb.cmake
19+++ b/storage/rocksdb/build_rocksdb.cmake
Brad Bishope42b3e32020-01-15 22:08:42 -050020@@ -470,6 +470,9 @@ list(APPEND SOURCES ${CMAKE_CURRENT_BINA
Brad Bishop19323692019-04-05 15:28:33 -040021
22 ADD_CONVENIENCE_LIBRARY(rocksdblib ${SOURCES})
23 target_link_libraries(rocksdblib ${THIRDPARTY_LIBS} ${SYSTEM_LIBS})
24+IF (HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC)
25+ TARGET_LINK_LIBRARIES(rocksdblib atomic)
26+ENDIF()
27 IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
Brad Bishope42b3e32020-01-15 22:08:42 -050028 set_target_properties(rocksdblib PROPERTIES COMPILE_FLAGS "-fPIC -fno-builtin-memcmp")
Brad Bishop19323692019-04-05 15:28:33 -040029 endif()