Package: nzbget
Version: 21.0+dfsg-2
Severity: important
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu jammy ubuntu-patch

Hi Andreas,

The nzbget package is failing to build from source in Ubuntu on armhf,
because Ubuntu's compiler is currently stricter with compiler options than
Debian's:

[...]
g++ -DHAVE_CONFIG_H -I.  -I./daemon/connect -I./daemon/extension 
-I./daemon/feed -I./daemon/frontend -I./daemon/main -I./daemon/nntp 
-I./daemon/postprocess -I./daemon/queue -I./daemon/remote -I./daemon/util 
-I./daemon/nserv -I./lib/par2 -I./lib/yencode  -Wdate-time -D_FORTIFY_SOURCE=2 
-I/usr/include/libxml2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600    -g -O2 
-ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat 
-Werror=format-security -fpermissive -march=armv8-a+crc -fpermissive -c -o 
lib/yencode/AcleCrc.o lib/yencode/AcleCrc.cpp
cc1plus: error: ‘-mfloat-abi=hard’: selected architecture lacks an FPU
make[2]: *** [Makefile:1774: lib/yencode/AcleCrc.o] Error 1
[...]

  
(https://launchpad.net/ubuntu/+source/nzbget/21.0+dfsg-2ubuntu1/+build/22597345)

The compiler doesn't like the use of -march=armv8-a+crc as a target because
this override of a default target doesn't specify the presence of an FPU,
which is required for hard-float (the 'hf' in armhf).

However, the correct fix here is NOT to pass -march=armv8-a+crc+fp, because
armv8 code is not guaranteed to run on the armhf architecture!  The baseline
for armhf in Debian is armv6 and in Ubuntu is armv7, so having code that
doesn't do CPU detection but is built for armv8 (or neon/simd, as appears
elsewhere in the build scripts) will generate SIGILL on various hardware
that is supposed to be supported.

I therefore think the simplest correct fix is to disable these optimizations
for armhf - if someone wants better performance on the hardware in question
they can use the arm64 build instead.

Attached is the patch I've uploaded to Ubuntu to solve this there.  Please
consider applying it in Debian as well.

Thanks,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                   https://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org
diff -Nru nzbget-21.0+dfsg/debian/patches/armv7-only.patch 
nzbget-21.0+dfsg/debian/patches/armv7-only.patch
--- nzbget-21.0+dfsg/debian/patches/armv7-only.patch    1969-12-31 
16:00:00.000000000 -0800
+++ nzbget-21.0+dfsg/debian/patches/armv7-only.patch    2022-03-11 
10:19:23.000000000 -0800
@@ -0,0 +1,24 @@
+Description: don't use NEON, armv8 instructions on armhf
+ The guaranteed ISA for armhf is armv7+fpu and does not include SIMD or
+ armv8.  Do not try to optimize the armhf binary with these extensions;
+ users who want this should run the arm64 port.
+Author: Steve Langasek <steve.langa...@ubuntu.com>
+Last-Update: 2022-03-11
+Forwarded: no
+
+Index: nzbget-21.0+dfsg/configure.ac
+===================================================================
+--- nzbget-21.0+dfsg.orig/configure.ac
++++ nzbget-21.0+dfsg/configure.ac
+@@ -572,11 +572,6 @@
+               PCLMUL_CXXFLAGS="-msse4.1 -mpclmul"
+               USE_SIMD=yes
+               ;;
+-      arm*)
+-              NEON_CXXFLAGS="-mfpu=neon"
+-              ACLECRC_CXXFLAGS="-march=armv8-a+crc -fpermissive"
+-              USE_SIMD=yes
+-              ;;
+       aarch64)
+               ACLECRC_CXXFLAGS="-march=armv8-a+crc -fpermissive"
+               USE_SIMD=yes
diff -Nru nzbget-21.0+dfsg/debian/patches/series 
nzbget-21.0+dfsg/debian/patches/series
--- nzbget-21.0+dfsg/debian/patches/series      2021-12-07 04:28:18.000000000 
-0800
+++ nzbget-21.0+dfsg/debian/patches/series      2022-03-11 10:17:49.000000000 
-0800
@@ -1,2 +1,3 @@
 0001-dont-embed-libraries.patch
 fips_mode.patch
+armv7-only.patch

Reply via email to