Bug#953003: ceph: FTBFS on riscv64: undefined reference to `__atomic_exchange_1'
Source: ceph
Version: 14.2.7-1
Severity: normal
Tags: patch upstream
Dear maintainer,
ceph fails to build on riscv64 with the following error:
| /usr/bin/ld: ../../../lib/librbd.so.1.12.0: undefined reference to `__atomic_exchange_1'
| collect2: error: ld returned 1 exit status
| make[3]: *** [src/tools/rbd/CMakeFiles/rbd.dir/build.make:790: bin/rbd] Error 1
The full build log is available there:
https://buildd.debian.org/status/fetch.php?pkg=ceph&arch=riscv64&ver=14.2.7-1&stamp=1580666087&raw=0
riscv64 only has native support for 4-byte and 8-byte atomics. Other
sizes, and in that case 1-byte atomic, have to be emulated through
libatomic. This library is automatically added at link time by GCC when
thread support is enabled. Unfortunately cmake defaults to use -lpthread
instead of using -pthread, which doesn't fully enable thread support.
Therefore the attached patch fixes the FTBFS issue on riscv64. Would it
be possible to include it in the next upload?
Thanks,
Aurelien
-- System Information:
Debian Release: bullseye/sid
APT prefers testing
APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 5.4.0-3-amd64 (SMP w/4 CPU cores)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE=fr (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Description: Link with -pthread instead of -lpthread to fix FTBFS on riscv64
Forwarded: no
Last-Update: 2020-03-01
--- ceph-14.2.7.orig/CMakeLists.txt
+++ ceph-14.2.7/CMakeLists.txt
@@ -28,6 +28,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_S
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(LINUX ON)
+ set(THREADS_PREFER_PTHREAD_FLAG ON)
FIND_PACKAGE(Threads)
elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
set(FREEBSD ON)
Reply to: