Source: numactl
Version: 2.0.14-3
Severity: important
Tags: ftbfs patch upstream
Justification: fails to build from source (but built successfully in the past)
X-Debbugs-Cc: i...@hack3r.moe

Dear maintainer,

numactl currently failed to build on riscv64 from source:

...
/usr/bin/ld: ./.libs/libnuma.so: undefined reference to `__atomic_fetch_and_1'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:899: migratepages] Error 1
make[2]: *** Waiting for unfinished jobs....
/usr/bin/ld: ./.libs/libnuma.so: undefined reference to `__atomic_fetch_and_1'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:903: migspeed] Error 1
/usr/bin/ld: ./.libs/libnuma.so: undefined reference to `__atomic_fetch_and_1'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:907: numactl] Error 1
/usr/bin/ld: ./.libs/libnuma.so: undefined reference to `__atomic_fetch_and_1'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:911: numademo] Error 1
...

Full buildd log: 
https://buildd.debian.org/status/fetch.php?pkg=numactl&arch=riscv64&ver=2.0.14-3&stamp=1632275973&raw=0

This can be fixed by linking to libatomic on riscv64, which I've written a
patch solving the problem. I will submit it to the upstream repo soon.

Please let me know if I miss something.

Cheers,
Eric

-- System Information:
Debian Release: bookworm/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.0-17-amd64 (SMP w/8 CPU threads)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
--- a/Makefile.am
+++ b/Makefile.am
@@ -41,6 +41,9 @@
 
 libnuma_la_SOURCES = libnuma.c syscall.c distance.c affinity.c affinity.h 
sysfs.c sysfs.h rtnetlink.c rtnetlink.h versions.ldscript
 libnuma_la_LDFLAGS = -version-info 1:0:0 
-Wl,--version-script,$(srcdir)/versions.ldscript -Wl,-init,numa_init 
-Wl,-fini,numa_fini
+if RISCV64
+libnuma_la_LDFLAGS += -latomic
+endif
 
 check_PROGRAMS = \
        test/distance \
--- a/configure.ac
+++ b/configure.ac
@@ -22,6 +22,9 @@
 AX_CHECK_COMPILE_FLAG([-ftree-vectorize], [tree_vectorize="true"])
 AM_CONDITIONAL([HAVE_TREE_VECTORIZE], [test x"${tree_vectorize}" = x"true"])
 
+AC_CANONICAL_TARGET
+AM_CONDITIONAL([RISCV64], [test x"${target_cpu}" = x"riscv64"])
+
 AC_CONFIG_FILES([Makefile])
 
 # GCC tries to be "helpful" and only issue a warning for unrecognized

Reply via email to