rocksdb
rocksdb copied to clipboard
RocksDB 6.22.1 fails to build on ARM
Compile error:
mkdir -p utilities/transactions/lock/range/range_tree/lib/locktree && g++ -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -march=armv7-a -mfpu=vfpv3-d16 -mtune=generic-armv7-a -mabi=aapcs-linux -mfloat-abi=hard -march=armv8-a+crc+crypto -fPIC -DROCKSDB_DLL -DROCKSDB_USE_RTTI -g -W -Wextra -Wall -Wsign-compare -Wshadow -Wunused-parameter -Werror -I. -I./include -std=c++11 -faligned-new -DHAVE_ALIGNED_NEW -DROCKSDB_PLATFORM_POSIX -DROCKSDB_LIB_IO_POSIX -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -march=armv7-a -mfpu=vfpv3-d16 -mtune=generic-armv7-a -mabi=aapcs-linux -mfloat-abi=hard -DOS_LINUX -fno-builtin-memcmp -DROCKSDB_FALLOCATE_PRESENT -DGFLAGS=1 -DROCKSDB_MALLOC_USABLE_SIZE -DROCKSDB_PTHREAD_ADAPTIVE_MUTEX -DROCKSDB_BACKTRACE -DROCKSDB_RANGESYNC_PRESENT -DROCKSDB_SCHED_GETCPU_PRESENT -DROCKSDB_AUXV_GETAUXVAL_PRESENT -DROCKSDB_SUPPORT_THREAD_LOCAL -isystem third-party/gtest-1.8.1/fused-src -isystem ./third-party/folly -O2 -fno-omit-frame-pointer -DNDEBUG -Woverloaded-virtual -Wnon-virtual-dtor -Wno-missing-field-initializers -c utilities/transactions/lock/range/range_tree/lib/locktree/lock_request.cc -o utilities/transactions/lock/range/range_tree/lib/locktree/lock_request.o
In file included from utilities/transactions/lock/range/range_tree/lib/locktree/locktree.h:62,
from utilities/transactions/lock/range/range_tree/lib/locktree/lock_request.h:59,
from utilities/transactions/lock/range/range_tree/lib/locktree/lock_request.cc:56:
utilities/transactions/lock/range/range_tree/lib/locktree/../portability/toku_time.h:137:2: error: #error No timer implementation for this platform
137 | #error No timer implementation for this platform
| ^~~~~
utilities/transactions/lock/range/range_tree/lib/locktree/../portability/toku_time.h: In function 'tokutime_t toku_time_now()':
utilities/transactions/lock/range/range_tree/lib/locktree/../portability/toku_time.h:139:1: error: no return statement in function returning non-void [-Werror=return-type]
139 | }
| ^
cc1plus: all warnings being treated as errors
make: *** [Makefile:2278: utilities/transactions/lock/range/range_tree/lib/locktree/lock_request.o] Error 1
OS: Fedora Linux 35 ~Full build log: https://koji.fedoraproject.org/koji/buildinfo?buildID=1812744~ Full build log: https://kojipkgs.fedoraproject.org//work/tasks/202/73160202/build.log
@hegjon Can you tell us what the initial command was that you ran please? and which compiler tool-chain you are using?
I ask because I have successfully built at least one of the RocksDB targets on arm64 using both CentOS 7 and Alpine 3 to produce the native libraries for RocksJava.
@hegjon Can you tell us what the initial command was that you ran please? and which compiler tool-chain you are using?
Build flags/command:
CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -march=armv7-a -mfpu=vfpv3-d16 -mtune=generic-armv7-a -mabi=aapcs-linux -mfloat-abi=hard'
export CFLAGS
CXXFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -march=armv7-a -mfpu=vfpv3-d16 -mtune=generic-armv7-a -mabi=aapcs-linux -mfloat-abi=hard'
export CXXFLAGS
FFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -march=armv7-a -mfpu=vfpv3-d16 -mtune=generic-armv7-a -mabi=aapcs-linux -mfloat-abi=hard -I/usr/lib/gfortran/modules'
export FFLAGS
FCFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -march=armv7-a -mfpu=vfpv3-d16 -mtune=generic-armv7-a -mabi=aapcs-linux -mfloat-abi=hard -I/usr/lib/gfortran/modules'
export FCFLAGS
LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '
export LDFLAGS
LT_SYS_LIBRARY_PATH=/usr/lib:
export LT_SYS_LIBRARY_PATH
CC=gcc
export CC
CXX=g++
export CXX
PORTABLE=1
USE_RTTI=1
/usr/bin/make -O -j5 V=1 VERBOSE=1 shared_lib
Host/compiler:
Linux buildvm-a32-07.iad2.fedoraproject.org 5.12.13-300.fc34.armv7hl #1 SMP Wed Jun 23 17:13:01 UTC 2021 armv7l armv7l armv7l GNU/Linux
gcc (GCC) 11.2.1 20210728 (Red Hat 11.2.1-1) Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
g++ (GCC) 11.2.1 20210728 (Red Hat 11.2.1-1) Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
CPU info:
Architecture: armv7l
Byte Order: Little Endian
CPU(s): 5
On-line CPU(s) list: 0-4
Thread(s) per core: 1
Core(s) per socket: 5
Socket(s): 1
Vendor ID: APM
Model: 2
Model name: X-Gene
Stepping: 0x3
BogoMIPS: 80.00
Flags: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm aes pmull sha1 sha2 crc32
Build dependency/version:
================================================================================
Package Arch Version Repo Size
================================================================================
Installing:
gcc-c++ armv7hl 11.2.1-1.fc35 build 10 M
gflags-devel armv7hl 2.2.2-8.fc35 build 24 k
make armv7hl 1:4.3-6.fc35 build 527 k
perl-interpreter armv7hl 4:5.34.0-481.fc35 build 80 k
python3 armv7hl 3.10.0~b4-3.fc35 build 25 k
I ask because I have successfully built at least one of the RocksDB targets on arm64 using both CentOS 7 and Alpine 3 to produce the native libraries for RocksJava.
Looks like the arm64/aarch64 is building on Fedora, while the 32 bit version stopped. 6.15 was still building on arm32.
I'm facing the same problem when compiling for Android/armv7-a.
It seems that not support arm32 yet.
https://github.com/facebook/rocksdb/blob/main/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h#L123-L143
My colleague is working on getting the 32bit issues resolved here - https://github.com/facebook/rocksdb/pull/9294
I am facing the same problem on Android armv7-a. I tried to add __arm__
as __aarch64__
but I didn't find the virtual counter register for armv7-a archtecture.
Here is my patch
diff --git a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
index 225e3fa72..cd5f935f1 100644
--- a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
+++ b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
@@ -131,6 +131,10 @@ static inline tokutime_t toku_time_now(void) {
uint64_t result;
__asm __volatile__("mrs %[rt], cntvct_el0" : [ rt ] "=r"(result));
return result;
+#elif defined(__arm__)
+ uint32_t lo, hi;
+ __asm __volatile__("mrrc p15, 1, %[lo], %[hi], c14" : [ lo ] "=r" (lo), [hi] "=r" (hi));
+ return (uint64_t)hi << 32 | lo;
#elif defined(__powerpc__)
return __ppc_get_timebase();
#elif defined(__s390x__)
But I don't have an armv7-a device. anyone who would like to try it ,please report if it works. it compiled successfully.
built it with an armv7 from a Raspberry Pi 4 (ARMv7 rev 3) and it also compiled successfully with the patch
Any plan on upstreaming this patch ?