[MDEV-23051] RocksDB build fails on riscv64 Created: 2020-06-30  Updated: 2023-02-03  Resolved: 2020-07-28

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - RocksDB
Affects Version/s: 10.3.22
Fix Version/s: 10.2.33, 10.3.24, 10.4.14, 10.5.5

Type: Bug Priority: Major
Reporter: Christian Ehrhardt Assignee: Daniel Black
Resolution: Fixed Votes: 1
Labels: None
Environment:

Building on Ubuntu or Debian for RiscV64 platform


Attachments: PNG File screenshot-1.png     PNG File screenshot-2.png     PNG File screenshot-3.png     PNG File screenshot-4.png    
Issue Links:
Relates
relates to MDEV-30554 RockDB libatomic linking on riscv64 Closed

 Description   

When building on RiscV64 on Ubuntu/Debian this fails due to missing libatomic fixes.

And example fromt he related bug/discussion at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=933151:

/usr/bin/ld: librocksdblib.a(memtable.cc.o): in function `.L0 ':
./builddir/storage/rocksdb/./storage/rocksdb/rocksdb/util/dynamic_bloom.h:177:
undefined reference to `__atomic_fetch_or_1'
/usr/bin/ld: librocksdblib.a(memtable.cc.o): in function `.LVL1731':
./builddir/storage/rocksdb/./storage/rocksdb/rocksdb/util/dynamic_bloom.h:179:
undefined reference to `__atomic_fetch_or_1'
/usr/bin/ld: librocksdblib.a(memtable.cc.o): in function `SaveValue':
./builddir/storage/rocksdb/./storage/rocksdb/rocksdb/db/memtable.cc:596:
undefined reference to `__atomic_compare_exchange_1'
/usr/bin/ld: librocksdblib.a(memtable.cc.o): in function `.L0 ':
/usr/include/c++/8/bits/atomic_base.h:434: undefined reference to
`__atomic_compare_exchange_1'
/usr/bin/ld: /usr/include/c++/8/bits/atomic_base.h:434: undefined
reference to `__atomic_compare_exchange_1'
/usr/bin/ld: /usr/include/c++/8/bits/atomic_base.h:434: undefined
reference to `__atomic_compare_exchange_1'
/usr/bin/ld: /usr/include/c++/8/bits/atomic_base.h:434: undefined
reference to `__atomic_compare_exchange_1'
/usr/bin/ld: librocksdblib.a(memtable.cc.o):/usr/include/c++/8/bits/atomic_base.h:434:
more undefined references to `__atomic_compare_exchange_1' follow
collect2: error: ld returned 1 exit status



 Comments   
Comment by Otto Kekäläinen [ 2020-06-30 ]

Note that riscv64 is nowadays an official platform for Debian, and failures to build on riscv64 prevents MariaDB Server from being synced from Debian to Ubuntu and Ubuntu will end up with outdated versions. Build and sync statuses can be viewed at https://launchpad.net/ubuntu/+source/mariadb-10.3 (and -10.4 and -10.5 eventually).

Comment by Otto Kekäläinen [ 2020-06-30 ]

faust Could you check if this has been reported upstream at RocksDB? If not, file it there and link here.

Comment by Faustin Lammler [ 2020-06-30 ]

Hi otto!

I didn't find nothing:
https://github.com/facebook/rocksdb/issues?q=is%3Aissue+risc
https://github.com/facebook/rocksdb/search?q=risc&unscoped_q=risc

Here is the issue that I have just opened:
https://github.com/facebook/rocksdb/issues/7051

Comment by Daniel Black [ 2020-07-01 ]

Note mariadb in a few places uses <atomic.h> and I do not see a link to the atomic library in the CMake files so more may be required than just rocksdb.

Comment by Otto Kekäläinen [ 2020-07-01 ]

danblack posted a potential fix upstream at https://github.com/facebook/rocksdb/pull/7060

From Zulip:

Daniel Black02:17

From https://github.com/riscv/riscv-gnu-toolchain/issues/183#issuecomment-253721765 it looks like you need to link against -latomic( libgcc-10-dev package) (which I've only found on sid - https://packages.debian.org/search?suite=sid&arch=riscv64&mode=path&searchon=contents&keywords=libatomic.a)

Comment by Otto Kekäläinen [ 2020-07-01 ]

Suggested temporary workaround downstream: https://salsa.debian.org/mariadb-team/mariadb-10.3/-/merge_requests/28/diffs

Comment by Otto Kekäläinen [ 2020-07-01 ]

MariaDB 10.4 Riscv64 build status in Debian:
https://buildd.debian.org/status/package.php?p=mariadb-10.4&suite=experimental

Failure in log:

{preformatted}
[ 67%] Linking CXX executable sst_dump
cd /<<PKGBUILDDIR>>/builddir/storage/rocksdb && /usr/bin/cmake -E cmake_link_script CMakeFiles/sst_dump.dir/link.txt --verbose=1
/usr/bin/riscv64-linux-gnu-g++ -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -pie -fPIC -Wl,-z,relro,-z,now -fstack-protector --param=ssp-buffer-size=4 -O2 -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -Wno-uninitialized -D_FORTIFY_SOURCE=2 -DDBUG_OFF -Wall -Wextra -Wformat-security -Wno-format-truncation -Wno-init-self -Wno-nonnull-compare -Wno-unused-parameter -Woverloaded-virtual -Wnon-virtual-dtor -Wvla -Wwrite-strings -Wl,-z,relro -Wl,-z,now CMakeFiles/sst_dump.dir/rocksdb/tools/sst_dump.cc.o -o sst_dump -lpthread librocksdblib.a -llz4 -lsnappy -lzstd -lz -lpthread -ldl
[ 67%] Building CXX object storage/rocksdb/CMakeFiles/rocksdb_aux_lib.dir/rdb_perf_context.cc.o
cd /<<PKGBUILDDIR>>/builddir/storage/rocksdb && /usr/bin/riscv64-linux-gnu-g++ -DDBUG_TRACE -DHAVE_CONFIG_H -DHAVE_SCHED_GETCPU=1 -DHAVE_TIMER_DELETE -DLZ4 -DOS_LINUX -DROCKSDB_FALLOCATE_PRESENT -DROCKSDB_LIB_IO_POSIX -DROCKSDB_MALLOC_USABLE_SIZE -DROCKSDB_PLATFORM_POSIX -DROCKSDB_SCHED_GETCPU_PRESENT -DROCKSDB_SUPPORT_THREAD_LOCAL -DSNAPPY -DZLIB -DZSTD -D_FILE_OFFSET_BITS=64 -I/<<PKGBUILDDIR>>/wsrep-lib/include -I/<<PKGBUILDDIR>>/wsrep-lib/wsrep-API/v26 -I/<<PKGBUILDDIR>>/builddir/include -I/<<PKGBUILDDIR>>/include -I/<<PKGBUILDDIR>>/sql -I/<<PKGBUILDDIR>>/builddir/extra/wolfssl -I/<<PKGBUILDDIR>>/extra/wolfssl/wolfssl -I/<<PKGBUILDDIR>>/extra/wolfssl/wolfssl/wolfssl -I/<<PKGBUILDDIR>>/builddir/storage/rocksdb -I/<<PKGBUILDDIR>>/storage/rocksdb/rocksdb -I/<<PKGBUILDDIR>>/storage/rocksdb/rocksdb/include -I/<<PKGBUILDDIR>>/storage/rocksdb/rocksdb/util -isystem /<<PKGBUILDDIR>>/storage/rocksdb/rocksdb/third-party/gtest-1.7.0/fused-src -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -pie -fPIC -Wl,-z,relro,-z,now -fstack-protector --param=ssp-buffer-size=4 -O2 -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -Wno-uninitialized -D_FORTIFY_SOURCE=2 -DDBUG_OFF -Wall -Wextra -Wformat-security -Wno-format-truncation -Wno-init-self -Wno-nonnull-compare -Wno-unused-parameter -Woverloaded-virtual -Wnon-virtual-dtor -Wvla -Wwrite-strings -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -std=gnu++11 -o CMakeFiles/rocksdb_aux_lib.dir/rdb_perf_context.cc.o -c /<<PKGBUILDDIR>>/storage/rocksdb/rdb_perf_context.cc
[ 67%] Building CXX object storage/innobase/CMakeFiles/innobase_embedded.dir/pars/pars0sym.cc.o
cd /<<PKGBUILDDIR>>/builddir/storage/innobase && /usr/bin/riscv64-linux-gnu-g++ -DBTR_CUR_ADAPT -DBTR_CUR_HASH_ADAPT -DCOMPILER_HINTS -DDBUG_TRACE -DEMBEDDED_LIBRARY -DHAVE_C99_INITIALIZERS -DHAVE_CONFIG_H -DHAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE=1 -DHAVE_IB_LINUX_FUTEX=1 -DHAVE_LZ4=1 -DHAVE_LZ4_COMPRESS_DEFAULT=1 -DHAVE_NANOSLEEP=1 -DHAVE_SCHED_GETCPU=1 -DHAVE_SNAPPY=1 -DLINUX_NATIVE_AIO=1 -DMUTEX_EVENT -DWITH_INNODB_DISALLOW_WRITES -D_FILE_OFFSET_BITS=64 -I/<<PKGBUILDDIR>>/wsrep-lib/include -I/<<PKGBUILDDIR>>/wsrep-lib/wsrep-API/v26 -I/<<PKGBUILDDIR>>/builddir/include -I/<<PKGBUILDDIR>>/storage/innobase/include -I/<<PKGBUILDDIR>>/storage/innobase/handler -I/<<PKGBUILDDIR>>/libbinlogevents/include -I/<<PKGBUILDDIR>>/include -I/<<PKGBUILDDIR>>/sql -I/<<PKGBUILDDIR>>/builddir/extra/wolfssl -I/<<PKGBUILDDIR>>/extra/wolfssl/wolfssl -I/<<PKGBUILDDIR>>/extra/wolfssl/wolfssl/wolfssl -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -pie -fPIC -Wl,-z,relro,-z,now -fstack-protector --param=ssp-buffer-size=4 -O2 -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -Wno-uninitialized -D_FORTIFY_SOURCE=2 -DDBUG_OFF -Wall -Wextra -Wformat-security -Wno-format-truncation -Wno-init-self -Wno-nonnull-compare -Wno-unused-parameter -Woverloaded-virtual -Wnon-virtual-dtor -Wvla -Wwrite-strings -Wdate-time -D_FORTIFY_SOURCE=2 -DUNIV_LINUX -D_GNU_SOURCE=1 -DHAVE_OPENSSL -DHAVE_WOLFSSL -DWOLFSSL_USER_SETTINGS -fPIC -fvisibility=hidden -std=gnu++11 -o CMakeFiles/innobase_embedded.dir/pars/pars0sym.cc.o -c /<<PKGBUILDDIR>>/storage/innobase/pars/pars0sym.cc
[ 67%] Building CXX object storage/perfschema/CMakeFiles/perfschema_embedded.dir/pfs_column_values.cc.o
cd /<<PKGBUILDDIR>>/builddir/storage/perfschema && /usr/bin/riscv64-linux-gnu-g++ -DDBUG_TRACE -DHAVE_CONFIG_H -DMYSQL_SERVER -D_FILE_OFFSET_BITS=64 -I/<<PKGBUILDDIR>>/wsrep-lib/include -I/<<PKGBUILDDIR>>/wsrep-lib/wsrep-API/v26 -I/<<PKGBUILDDIR>>/builddir/include -I/<<PKGBUILDDIR>> -I/<<PKGBUILDDIR>>/include -I/<<PKGBUILDDIR>>/sql -I/<<PKGBUILDDIR>>/builddir/sql -I/<<PKGBUILDDIR>>/builddir/extra/wolfssl -I/<<PKGBUILDDIR>>/extra/wolfssl/wolfssl -I/<<PKGBUILDDIR>>/extra/wolfssl/wolfssl/wolfssl -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -pie -fPIC -Wl,-z,relro,-z,now -fstack-protector --param=ssp-buffer-size=4 -O2 -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -Wno-uninitialized -D_FORTIFY_SOURCE=2 -DDBUG_OFF -Wall -Wextra -Wformat-security -Wno-format-truncation -Wno-init-self -Wno-nonnull-compare -Wno-unused-parameter -Woverloaded-virtual -Wnon-virtual-dtor -Wvla -Wwrite-strings -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -fvisibility=hidden -std=gnu++11 -o CMakeFiles/perfschema_embedded.dir/pfs_column_values.cc.o -c /<<PKGBUILDDIR>>/storage/perfschema/pfs_column_values.cc
[ 67%] Building CXX object storage/perfschema/CMakeFiles/perfschema_embedded.dir/pfs_con_slice.cc.o
cd /<<PKGBUILDDIR>>/builddir/storage/perfschema && /usr/bin/riscv64-linux-gnu-g++ -DDBUG_TRACE -DHAVE_CONFIG_H -DMYSQL_SERVER -D_FILE_OFFSET_BITS=64 -I/<<PKGBUILDDIR>>/wsrep-lib/include -I/<<PKGBUILDDIR>>/wsrep-lib/wsrep-API/v26 -I/<<PKGBUILDDIR>>/builddir/include -I/<<PKGBUILDDIR>> -I/<<PKGBUILDDIR>>/include -I/<<PKGBUILDDIR>>/sql -I/<<PKGBUILDDIR>>/builddir/sql -I/<<PKGBUILDDIR>>/builddir/extra/wolfssl -I/<<PKGBUILDDIR>>/extra/wolfssl/wolfssl -I/<<PKGBUILDDIR>>/extra/wolfssl/wolfssl/wolfssl -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -pie -fPIC -Wl,-z,relro,-z,now -fstack-protector --param=ssp-buffer-size=4 -O2 -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -Wno-uninitialized -D_FORTIFY_SOURCE=2 -DDBUG_OFF -Wall -Wextra -Wformat-security -Wno-format-truncation -Wno-init-self -Wno-nonnull-compare -Wno-unused-parameter -Woverloaded-virtual -Wnon-virtual-dtor -Wvla -Wwrite-strings -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -fvisibility=hidden -std=gnu++11 -o CMakeFiles/perfschema_embedded.dir/pfs_con_slice.cc.o -c /<<PKGBUILDDIR>>/storage/perfschema/pfs_con_slice.cc
[ 67%] Building CXX object storage/perfschema/CMakeFiles/perfschema_embedded.dir/pfs_defaults.cc.o
cd /<<PKGBUILDDIR>>/builddir/storage/perfschema && /usr/bin/riscv64-linux-gnu-g++ -DDBUG_TRACE -DHAVE_CONFIG_H -DMYSQL_SERVER -D_FILE_OFFSET_BITS=64 -I/<<PKGBUILDDIR>>/wsrep-lib/include -I/<<PKGBUILDDIR>>/wsrep-lib/wsrep-API/v26 -I/<<PKGBUILDDIR>>/builddir/include -I/<<PKGBUILDDIR>> -I/<<PKGBUILDDIR>>/include -I/<<PKGBUILDDIR>>/sql -I/<<PKGBUILDDIR>>/builddir/sql -I/<<PKGBUILDDIR>>/builddir/extra/wolfssl -I/<<PKGBUILDDIR>>/extra/wolfssl/wolfssl -I/<<PKGBUILDDIR>>/extra/wolfssl/wolfssl/wolfssl -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -pie -fPIC -Wl,-z,relro,-z,now -fstack-protector --param=ssp-buffer-size=4 -O2 -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -Wno-uninitialized -D_FORTIFY_SOURCE=2 -DDBUG_OFF -Wall -Wextra -Wformat-security -Wno-format-truncation -Wno-init-self -Wno-nonnull-compare -Wno-unused-parameter -Woverloaded-virtual -Wnon-virtual-dtor -Wvla -Wwrite-strings -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -fvisibility=hidden -std=gnu++11 -o CMakeFiles/perfschema_embedded.dir/pfs_defaults.cc.o -c /<<PKGBUILDDIR>>/storage/perfschema/pfs_defaults.cc
[ 67%] Building CXX object storage/rocksdb/CMakeFiles/rocksdb_aux_lib.dir/nosql_access.cc.o
cd /<<PKGBUILDDIR>>/builddir/storage/rocksdb && /usr/bin/riscv64-linux-gnu-g++ -DDBUG_TRACE -DHAVE_CONFIG_H -DHAVE_SCHED_GETCPU=1 -DHAVE_TIMER_DELETE -DLZ4 -DOS_LINUX -DROCKSDB_FALLOCATE_PRESENT -DROCKSDB_LIB_IO_POSIX -DROCKSDB_MALLOC_USABLE_SIZE -DROCKSDB_PLATFORM_POSIX -DROCKSDB_SCHED_GETCPU_PRESENT -DROCKSDB_SUPPORT_THREAD_LOCAL -DSNAPPY -DZLIB -DZSTD -D_FILE_OFFSET_BITS=64 -I/<<PKGBUILDDIR>>/wsrep-lib/include -I/<<PKGBUILDDIR>>/wsrep-lib/wsrep-API/v26 -I/<<PKGBUILDDIR>>/builddir/include -I/<<PKGBUILDDIR>>/include -I/<<PKGBUILDDIR>>/sql -I/<<PKGBUILDDIR>>/builddir/extra/wolfssl -I/<<PKGBUILDDIR>>/extra/wolfssl/wolfssl -I/<<PKGBUILDDIR>>/extra/wolfssl/wolfssl/wolfssl -I/<<PKGBUILDDIR>>/builddir/storage/rocksdb -I/<<PKGBUILDDIR>>/storage/rocksdb/rocksdb -I/<<PKGBUILDDIR>>/storage/rocksdb/rocksdb/include -I/<<PKGBUILDDIR>>/storage/rocksdb/rocksdb/util -isystem /<<PKGBUILDDIR>>/storage/rocksdb/rocksdb/third-party/gtest-1.7.0/fused-src -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -pie -fPIC -Wl,-z,relro,-z,now -fstack-protector --param=ssp-buffer-size=4 -O2 -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -Wno-uninitialized -D_FORTIFY_SOURCE=2 -DDBUG_OFF -Wall -Wextra -Wformat-security -Wno-format-truncation -Wno-init-self -Wno-nonnull-compare -Wno-unused-parameter -Woverloaded-virtual -Wnon-virtual-dtor -Wvla -Wwrite-strings -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -std=gnu++11 -o CMakeFiles/rocksdb_aux_lib.dir/nosql_access.cc.o -c /<<PKGBUILDDIR>>/storage/rocksdb/nosql_access.cc
[ 67%] Building CXX object storage/perfschema/CMakeFiles/perfschema_embedded.dir/pfs_digest.cc.o
cd /<<PKGBUILDDIR>>/builddir/storage/perfschema && /usr/bin/riscv64-linux-gnu-g++ -DDBUG_TRACE -DHAVE_CONFIG_H -DMYSQL_SERVER -D_FILE_OFFSET_BITS=64 -I/<<PKGBUILDDIR>>/wsrep-lib/include -I/<<PKGBUILDDIR>>/wsrep-lib/wsrep-API/v26 -I/<<PKGBUILDDIR>>/builddir/include -I/<<PKGBUILDDIR>> -I/<<PKGBUILDDIR>>/include -I/<<PKGBUILDDIR>>/sql -I/<<PKGBUILDDIR>>/builddir/sql -I/<<PKGBUILDDIR>>/builddir/extra/wolfssl -I/<<PKGBUILDDIR>>/extra/wolfssl/wolfssl -I/<<PKGBUILDDIR>>/extra/wolfssl/wolfssl/wolfssl -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -pie -fPIC -Wl,-z,relro,-z,now -fstack-protector --param=ssp-buffer-size=4 -O2 -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -Wno-uninitialized -D_FORTIFY_SOURCE=2 -DDBUG_OFF -Wall -Wextra -Wformat-security -Wno-format-truncation -Wno-init-self -Wno-nonnull-compare -Wno-unused-parameter -Woverloaded-virtual -Wnon-virtual-dtor -Wvla -Wwrite-strings -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -fvisibility=hidden -std=gnu++11 -o CMakeFiles/perfschema_embedded.dir/pfs_digest.cc.o -c /<<PKGBUILDDIR>>/storage/perfschema/pfs_digest.cc
[ 67%] Building CXX object storage/innobase/CMakeFiles/innobase_embedded.dir/que/que0que.cc.o
cd /<<PKGBUILDDIR>>/builddir/storage/innobase && /usr/bin/riscv64-linux-gnu-g++ -DBTR_CUR_ADAPT -DBTR_CUR_HASH_ADAPT -DCOMPILER_HINTS -DDBUG_TRACE -DEMBEDDED_LIBRARY -DHAVE_C99_INITIALIZERS -DHAVE_CONFIG_H -DHAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE=1 -DHAVE_IB_LINUX_FUTEX=1 -DHAVE_LZ4=1 -DHAVE_LZ4_COMPRESS_DEFAULT=1 -DHAVE_NANOSLEEP=1 -DHAVE_SCHED_GETCPU=1 -DHAVE_SNAPPY=1 -DLINUX_NATIVE_AIO=1 -DMUTEX_EVENT -DWITH_INNODB_DISALLOW_WRITES -D_FILE_OFFSET_BITS=64 -I/<<PKGBUILDDIR>>/wsrep-lib/include -I/<<PKGBUILDDIR>>/wsrep-lib/wsrep-API/v26 -I/<<PKGBUILDDIR>>/builddir/include -I/<<PKGBUILDDIR>>/storage/innobase/include -I/<<PKGBUILDDIR>>/storage/innobase/handler -I/<<PKGBUILDDIR>>/libbinlogevents/include -I/<<PKGBUILDDIR>>/include -I/<<PKGBUILDDIR>>/sql -I/<<PKGBUILDDIR>>/builddir/extra/wolfssl -I/<<PKGBUILDDIR>>/extra/wolfssl/wolfssl -I/<<PKGBUILDDIR>>/extra/wolfssl/wolfssl/wolfssl -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -pie -fPIC -Wl,-z,relro,-z,now -fstack-protector --param=ssp-buffer-size=4 -O2 -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -Wno-uninitialized -D_FORTIFY_SOURCE=2 -DDBUG_OFF -Wall -Wextra -Wformat-security -Wno-format-truncation -Wno-init-self -Wno-nonnull-compare -Wno-unused-parameter -Woverloaded-virtual -Wnon-virtual-dtor -Wvla -Wwrite-strings -Wdate-time -D_FORTIFY_SOURCE=2 -DUNIV_LINUX -D_GNU_SOURCE=1 -DHAVE_OPENSSL -DHAVE_WOLFSSL -DWOLFSSL_USER_SETTINGS -fPIC -fvisibility=hidden -std=gnu++11 -o CMakeFiles/innobase_embedded.dir/que/que0que.cc.o -c /<<PKGBUILDDIR>>/storage/innobase/que/que0que.cc
/usr/bin/ld: librocksdblib.a(memtable.cc.o): in function `rocksdb::SpinMutex::lock()':
./builddir/storage/rocksdb/./storage/rocksdb/rocksdb/util/mutexlock.h:117: undefined reference to `__atomic_compare_exchange_1'
/usr/bin/ld: librocksdblib.a(memtable.cc.o): in function `std::__atomic_base<bool>::compare_exchange_weak(bool&, bool, std::memory_order, std::memory_order)':
/usr/include/c++/9/bits/atomic_base.h:457: undefined reference to `__atomic_compare_exchange_1'
/usr/bin/ld: /usr/include/c++/9/bits/atomic_base.h:457: undefined reference to `__atomic_compare_exchange_1'
/usr/bin/ld: /usr/include/c++/9/bits/atomic_base.h:457: undefined reference to `__atomic_compare_exchange_1'
/usr/bin/ld: /usr/include/c++/9/bits/atomic_base.h:457: undefined reference to `__atomic_compare_exchange_1'
/usr/bin/ld: librocksdblib.a(memtable.cc.o):/usr/include/c++/9/bits/atomic_base.h:457: more undefined references to `__atomic_compare_exchange_1' follow
collect2: error: ld returned 1 exit status
make[4]: *** [storage/rocksdb/CMakeFiles/sst_dump.dir/build.make:89: storage/rocksdb/sst_dump] Error 1
make[4]: Leaving directory '/<<PKGBUILDDIR>>/builddir'
make[3]: *** [CMakeFiles/Makefile2:8242: storage/rocksdb/CMakeFiles/sst_dump.dir/all] Error 2
make[3]: *** Waiting for unfinished jobs....{preformatted}

Arch riscv64 is only an unofficial platform in Debian, but it has become an official platform for Ubuntu, so it matters now I guess.

https://launchpad.net/ubuntu/+source/mariadb-10.3

Related, Debian and Ubuntu also has RocksDB tools package. It has explicitly marked incompatibility with riscv64 and does not build for it:
https://buildd.debian.org/status/package.php?p=rocksdb

https://launchpad.net/ubuntu/+source/rocksdb

This could potentially be solved by just not building for riscv64 at all? It would be a pity though, since everything else does build.

Comment by Daniel Black [ 2020-07-02 ]

I looked closer at the use of include <atomic> in MariaDB and its only in rocksdb and tokudb and columnstore. Tokudb and columnstore is marked x86 only.

The upstream rocksdb patch won't work because MariaDB doesn't use rocksDB's CMakefile. So an MariaDB PR is here, I'll let the debian/ubuntu folks push it through their CI because I couldn't cross compile to test mariadb locally.

Comment by Otto Kekäläinen [ 2020-07-02 ]

Note also another potential upstream fix: https://gitlab.kitware.com/cmake/cmake/-/issues/20895

Comment by Daniel Black [ 2020-07-02 ]

If the riscv toolchain folks didn't consider it a gcc bug https://github.com/riscv/riscv-gnu-toolchain/issues/183#issuecomment-253721765 I doubt the cmake folks will want to cover over that.

per PR https://github.com/MariaDB/server/pull/1617 , rocksdb successfully built on riscv64 per https://launchpad.net/~ci-train-ppa-service/+archive/ubuntu/4128/+build/19536778

Comment by Otto Kekäläinen [ 2020-07-06 ]

Note danblack your patch was tested in https://salsa.debian.org/mariadb-team/mariadb-10.3/-/merge_requests/28?commit_id=56b94fdac58e45d9199c8ce3c6ee4b8fd5ca7147#note_179099

Generated at Thu Feb 08 09:19:28 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.