Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Fixed
-
10.2.5
-
Debian 7, glibc 2.13, gcc 5.4.0
Description
I tried building MariaDB 10.2.5 with RocksDB on Debian 7 (glibc 2.13) using manually compiled gcc 5.4.0 (for C+11 compiler) and got "undefined reference to `clock_gettime'" error :
[ 72%] Linking CXX executable mysql_ldb
|
cd /tmp/mariadb-10.2.5/storage/rocksdb && /tmp/cmake/bin/cmake -E cmake_link_script CMakeFiles/mysql_ldb.dir/link.txt --verbose=1
|
/tmp/gcc/bin/g++ -I/tmp/jemalloc/include -I/tmp/libaio/include -I/tmp/libxml2/include -I/tmp/ncurses/include -I/tmp/openssl/include -I/tmp/pcre/include -I/tmp/readline5/include -I/tmp/xz-utils/include -I/tmp/zlib/include -pie -fPIC -Wl,-z,relro,-z,now -fstack-protector --param=ssp-buffer-size=4 -DWITH_INNODB_DISALLOW_WRITES -fPIC -fno-rtti -O3 -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -Wno-uninitialized -D_FORTIFY_SOURCE=2 -DDBUG_OFF -L/tmp/jemalloc/lib -Wl,-rpath=/tmp/jemalloc/lib -L/tmp/libaio/lib -Wl,-rpath=/tmp/libaio/lib -L/tmp/pcre/lib -L/tmp/xz-utils/lib -L/tmp/zlib/lib CMakeFiles/mysql_ldb.dir/tools/mysql_ldb.cc.o -o mysql_ldb -Wl,-rpath,:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -lpthread librocksdb_tools.a librocksdb_aux_lib.a librocksdblib.a -lpthread -lz
|
librocksdblib.a(env_posix.cc.o): In function `rocksdb::(anonymous namespace)::PosixEnv::NowNanos()':
|
/tmp/mariadb-10.2.5/storage/rocksdb/rocksdb/util/env_posix.cc:673: undefined reference to `clock_gettime'
|
collect2: error: ld returned 1 exit status
|
make[2]: *** [storage/rocksdb/mysql_ldb] Error 1
|
I confirmed that using ${LIBRT} result will solved the issue.
--- storage/rocksdb/CMakeLists.txt.orig
|
+++ storage/rocksdb/CMakeLists.txt
|
@@ -119,7 +119,7 @@
|
|
ADD_DEPENDENCIES(rocksdb_aux_lib GenError)
|
|
-TARGET_LINK_LIBRARIES(rocksdb_aux_lib rocksdblib ${ZLIB_LIBRARY})
|
+TARGET_LINK_LIBRARIES(rocksdb_aux_lib rocksdblib ${LIBRT} ${ZLIB_LIBRARY})
|
TARGET_LINK_LIBRARIES(rocksdb rocksdb_aux_lib)
|
|
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
@@ -161,7 +161,7 @@
|
)
|
|
MYSQL_ADD_EXECUTABLE(sst_dump rocksdb/tools/sst_dump.cc COMPONENT rocksdb-engine)
|
-TARGET_LINK_LIBRARIES(sst_dump rocksdblib)
|
+TARGET_LINK_LIBRARIES(sst_dump rocksdblib ${LIBRT})
|
|
MYSQL_ADD_EXECUTABLE(mysql_ldb tools/mysql_ldb.cc COMPONENT rocksdb-engine)
|
TARGET_LINK_LIBRARIES(mysql_ldb rocksdb_tools rocksdb_aux_lib)
|