Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | From f447aca534d1a12809eeb146e8220d305cc3884d Mon Sep 17 00:00:00 2001 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 2 | From: Mingli Yu <mingli.yu@windriver.com> |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 3 | Date: Thu, 9 Apr 2020 14:07:19 +0800 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 4 | Subject: [PATCH] build_rocksdb.cmake: fix atomic support on arm |
| 5 | |
| 6 | Check to link with libatomic to enable C11 atomics support |
| 7 | to 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 | |
| 11 | Upstream-Status: Pending |
| 12 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 13 | Signed-off-by: Mingli Yu <mingli.yu@windriver.com> |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 14 | --- |
| 15 | storage/rocksdb/build_rocksdb.cmake | 3 +++ |
| 16 | 1 file changed, 3 insertions(+) |
| 17 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 18 | diff --git a/storage/rocksdb/build_rocksdb.cmake b/storage/rocksdb/build_rocksdb.cmake |
| 19 | index d7895b0..3bcd52a 100644 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 20 | --- a/storage/rocksdb/build_rocksdb.cmake |
| 21 | +++ b/storage/rocksdb/build_rocksdb.cmake |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 22 | @@ -470,6 +470,9 @@ list(APPEND SOURCES ${CMAKE_CURRENT_BINARY_DIR}/build_version.cc) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 23 | |
| 24 | ADD_CONVENIENCE_LIBRARY(rocksdblib ${SOURCES}) |
| 25 | target_link_libraries(rocksdblib ${THIRDPARTY_LIBS} ${SYSTEM_LIBS}) |
| 26 | +IF (HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC) |
| 27 | + TARGET_LINK_LIBRARIES(rocksdblib atomic) |
| 28 | +ENDIF() |
| 29 | IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 30 | set_target_properties(rocksdblib PROPERTIES COMPILE_FLAGS "-fPIC -fno-builtin-memcmp -Wno-error") |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 31 | endif() |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 32 | -- |
| 33 | 2.7.4 |
| 34 | |