On 2020-01-04 12:37, Ximin Luo wrote:
> Aurelien Jarno:
> > On 2020-01-04 01:56, Ximin Luo wrote:
> >> Source: z3
> >> Version: 4.8.7-2
> >> Severity: important
> >> Tags: patch
> >>
> >> Dear Maintainer,
> >>
> >> Please apply the attached patch to fix the FTBFS on riscv64.
> >>
> >
> > Thanks for the patch. I however do not get why it disables java
> > support. Both javahelper and default-jdk are available on riscv64.
> >
> > In addition to that there is no need to add a depends on libatomic1, it
> > is (indirectly) part of build-essential.
> >
>
> Mirroring our IRC discussion on #debian-ports for the record:
>
> - I disabled java on riscv64 because I couldn't make it work when
> cross-building from amd64 to riscv64, but it was during an early part of my
> experimentation and perhaps you are right and it doesn't have to be disabled.
I have actually found that while the dependencies are there, the
java packages are not built. I have verified they build fine on riscv64.
Please find the patch attached.
> - You are working on a better way to fix this, using -pthread instead of
> -lpthread -latomic. In any case the cross-compiling patch from my OP should
> still be useful, as it allows one to test with a regular schroot rather than
> qemu-riscv64.
I confirm this approach work. By using -pthread instead of -lpthread,
threads support is enabled, including linking with libatomic if
necessary, instead of just linking with the thread library.
Aurelien
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
[email protected] http://www.aurel32.net
diff -Nru z3-4.8.7/debian/control z3-4.8.7/debian/control
--- z3-4.8.7/debian/control 2019-12-09 13:39:38.000000000 +0100
+++ z3-4.8.7/debian/control 2020-01-04 21:31:27.000000000 +0100
@@ -87,7 +87,7 @@
Package: libz3-java
Section: java
-Architecture: amd64 arm64 armel armhf i386 mips mips64el mipsel powerpc ppc64el s390x alpha kfreebsd-amd64 kfreebsd-i386 powerpcspe sparc64 x32
+Architecture: amd64 arm64 armel armhf i386 mips mips64el mipsel powerpc ppc64el s390x alpha kfreebsd-amd64 kfreebsd-i386 powerpcspe riscv64 sparc64 x32
Multi-Arch: foreign
Depends: libz3-jni (>= ${binary:Version}), libz3-jni (<< ${source:Version}.1~), libz3-dev, ${misc:Depends}, ${java:Depends}
Description: theorem prover from Microsoft Research - java bindings
@@ -98,7 +98,7 @@
Package: libz3-jni
Section: java
-Architecture: amd64 arm64 armel armhf i386 mips mips64el mipsel powerpc ppc64el s390x alpha kfreebsd-amd64 kfreebsd-i386 powerpcspe sparc64 x32
+Architecture: amd64 arm64 armel armhf i386 mips mips64el mipsel powerpc ppc64el s390x alpha kfreebsd-amd64 kfreebsd-i386 powerpcspe riscv64 sparc64 x32
Multi-Arch: same
Pre-Depends: ${misc:Pre-Depends}
Depends: libz3-dev (= ${binary:Version}), ${misc:Depends}, ${shlibs:Depends}
diff -Nru z3-4.8.7/debian/patches/06-pthread.patch z3-4.8.7/debian/patches/06-pthread.patch
--- z3-4.8.7/debian/patches/06-pthread.patch 1970-01-01 01:00:00.000000000 +0100
+++ z3-4.8.7/debian/patches/06-pthread.patch 2020-01-04 21:31:27.000000000 +0100
@@ -0,0 +1,25 @@
+Description: Link with -pthread instead of -lpthread to correctly enable threads support
+Author: Aurelien Jarno <[email protected]>
+Forwarded: no
+Last-Update: 2020-01-04
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- z3-4.8.7.orig/scripts/mk_util.py
++++ z3-4.8.7/scripts/mk_util.py
+@@ -2621,13 +2621,13 @@ def mk_config():
+ config.write('LINK_FLAGS=\n')
+ config.write('LINK_OUT_FLAG=-o \n')
+ if is_linux() and (build_static_lib() or build_static_bin()):
+- config.write('LINK_EXTRA_FLAGS=-Wl,--whole-archive -lpthread -Wl,--no-whole-archive %s\n' % LDFLAGS)
++ config.write('LINK_EXTRA_FLAGS=-Wl,--whole-archive -pthread -Wl,--no-whole-archive %s\n' % LDFLAGS)
+ else:
+- config.write('LINK_EXTRA_FLAGS=-lpthread %s\n' % LDFLAGS)
++ config.write('LINK_EXTRA_FLAGS=-pthread %s\n' % LDFLAGS)
+ config.write('SO_EXT=%s\n' % SO_EXT)
+ config.write('SLINK=%s\n' % CXX)
+ config.write('SLINK_FLAGS=%s\n' % SLIBFLAGS)
+- config.write('SLINK_EXTRA_FLAGS=-lpthread %s\n' % SLIBEXTRAFLAGS)
++ config.write('SLINK_EXTRA_FLAGS=-pthread %s\n' % SLIBEXTRAFLAGS)
+ config.write('SLINK_OUT_FLAG=-o \n')
+ config.write('OS_DEFINES=%s\n' % OS_DEFINES)
+ if is_verbose():
diff -Nru z3-4.8.7/debian/patches/series z3-4.8.7/debian/patches/series
--- z3-4.8.7/debian/patches/series 2019-12-09 13:39:38.000000000 +0100
+++ z3-4.8.7/debian/patches/series 2020-01-04 21:31:27.000000000 +0100
@@ -4,3 +4,4 @@
03-kfreebsd.patch
04-soname.patch
05-reproducibility.patch
+06-pthread.patch