[Debian-med-packaging] Bug#1001520: fastp: FTBFS on riscv64, linked with -lpthread instead of -pthread

Aurelien Jarno aurel32 at debian.org
Sat Dec 11 13:14:07 GMT 2021


Package: fastp
Version: 0.23.2+dfsg-1
Severity: normal
Tags: ftbfs upstream patch
User: debian-riscv at lists.debian.org
Usertags: riscv64

Dear maintainer,

fastp currently fails to build from source on riscv64:

| g++ ./obj/adaptertrimmer.o ./obj/basecorrector.o ./obj/duplicate.o ./obj/evaluator.o ./obj/fastareader.o ./obj/fastqreader.o ./obj/filter.o ./obj/filterresult.o ./obj/htmlreporter.o ./obj/jsonreporter.o ./obj/main.o ./obj/nucleotidetree.o ./obj/options.o ./obj/overlapanalysis.o ./obj/peprocessor.o ./obj/polyx.o ./obj/processor.o ./obj/read.o ./obj/readpool.o ./obj/seprocessor.o ./obj/sequence.o ./obj/stats.o ./obj/threadconfig.o ./obj/umiprocessor.o ./obj/unittest.o ./obj/writer.o ./obj/writerthread.o -o fastp -Wl,-z,relro -Wl,-z,now  -lisal -ldeflate -lpthread
| /usr/bin/ld: ./obj/duplicate.o: in function `Duplicate::applyBloomFilter(unsigned long*)':
| ./src/duplicate.cpp:157: undefined reference to `__atomic_fetch_or_1'
| /usr/bin/ld: ./obj/duplicate.o: in function `Duplicate::seq2intvector(char const*, int, unsigned long*, int)':
| ./src/duplicate.cpp:110: undefined reference to `__atomic_fetch_or_1'
| /usr/bin/ld: ./obj/duplicate.o: in function `std::__atomic_base<unsigned long>::fetch_add(unsigned long, std::memory_order)':
| /usr/include/c++/11/bits/atomic_base.h:636: undefined reference to `__atomic_fetch_or_1'
| collect2: error: ld returned 1 exit status
| make[2]: *** [Makefile:26: fastp] Error 1
| make[2]: Leaving directory '/<<PKGBUILDDIR>>'
| dh_auto_build: error: make -j4 "INSTALL=install --strip-program=true" returned exit code 2
| make[1]: *** [debian/rules:12: override_dh_auto_build] Error 25
| make[1]: Leaving directory '/<<PKGBUILDDIR>>'
| make: *** [debian/rules:7: binary-arch] Error 2
| dpkg-buildpackage: error: debian/rules binary-arch subprocess returned exit status 2

The full build log is available there:
https://buildd.debian.org/status/fetch.php?pkg=fastp&arch=riscv64&ver=0.23.2%2Bdfsg-1&stamp=1638916332&raw=0

The problem is that the linking is not done correctly, it uses -lpthread
meaning linking with the pthread library, instead of -pthread which
means enable thread support, and which brings libatomic.so on riscv64.
BTW, bonus point for correctly passing -pthread for compiling individual
source file, this is often forgotten.

The attached patch updates the Makefile to link with -pthread instead of
using -lpthread. Could you please include it in the next upload?

Thanks,
Aurelien
-------------- next part --------------
diff -Nru fastp-0.23.2+dfsg/debian/changelog fastp-0.23.2+dfsg/debian/changelog
--- fastp-0.23.2+dfsg/debian/changelog	2021-12-07 22:34:23.000000000 +0100
+++ fastp-0.23.2+dfsg/debian/changelog	2021-12-11 11:29:12.000000000 +0100
@@ -1,3 +1,9 @@
+fastp (0.23.2+dfsg-1+riscv64) unreleased; urgency=medium
+
+  * Fix build on riscv64.
+
+ -- Aurelien Jarno <aurel32 at debian.org>  Sat, 11 Dec 2021 11:29:12 +0100
+
 fastp (0.23.2+dfsg-1) unstable; urgency=medium
 
   * New upstream version
diff -Nru fastp-0.23.2+dfsg/debian/patches/fix-riscv64.patch- fastp-0.23.2+dfsg/debian/patches/fix-riscv64.patch-
--- fastp-0.23.2+dfsg/debian/patches/fix-riscv64.patch-	1970-01-01 01:00:00.000000000 +0100
+++ fastp-0.23.2+dfsg/debian/patches/fix-riscv64.patch-	2021-12-11 11:29:12.000000000 +0100
@@ -0,0 +1,18 @@
+Description: Correctly link the binary with -pthread, to include -latomic when needed.
+Author: Aurelien Jarno <aurel32 at debian.org>
+Last-Update: 2021-12-11
+
+--- fastp-0.23.2+dfsg.orig/Makefile
++++ fastp-0.23.2+dfsg/Makefile
+@@ -16,9 +16,9 @@ BIN_TARGET := ${TARGET}
+ 
+ CXX ?= g++
+ CXXFLAGS += -std=c++11 -pthread -g -O3 -I${DIR_INC} $(foreach includedir,$(INCLUDE_DIRS),-I$(includedir))
+-LIBS := -lisal -ldeflate -lpthread
++LIBS := -lisal -ldeflate
+ STATIC_FLAGS := -static -Wl,--no-as-needed -pthread
+-LDFLAGS += $(foreach librarydir,$(LIBRARY_DIRS),-L$(librarydir)) $(LIBS)
++LDFLAGS += $(foreach librarydir,$(LIBRARY_DIRS),-L$(librarydir)) $(LIBS) -pthread
+ STATIC_LD_FLAGS := $(foreach librarydir,$(LIBRARY_DIRS),-L$(librarydir)) $(STATIC_FLAGS) $(LIBS) $(STATIC_LD_FLAGS)
+ 
+ 
diff -Nru fastp-0.23.2+dfsg/debian/patches/series fastp-0.23.2+dfsg/debian/patches/series
--- fastp-0.23.2+dfsg/debian/patches/series	2021-12-07 22:34:23.000000000 +0100
+++ fastp-0.23.2+dfsg/debian/patches/series	2021-12-11 11:29:12.000000000 +0100
@@ -1,2 +1,3 @@
 makefile.patch
 fix-i386.patch
+fix-riscv64.patch-


More information about the Debian-med-packaging mailing list