Bug#969396: sleef FTBFS on arm64 with gcc-10, sve code requires __sizeless_struct

peter green plugwash at p10link.net
Tue Sep 1 22:40:59 BST 2020


Package: sleef
Version: 3.4.1-4
Severity: serious

The most recent upload of sleef fixed the build on amd64, armhf, i386 and ppc64el. Unfortunately
it is still failing on arm64, with the following error.

> In file included from /<<PKGBUILDDIR>>/src/libm/sleefsimdsp.c:209:
> /<<PKGBUILDDIR>>/src/arch/helpersve.h:94:27: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
>    94 | typedef __sizeless_struct {
>       |                           ^

It looks like __sizeless_struct is a compiler feature that was proposed for adding to gcc,
but it doesn't appear to have actually been added, at least not under that name.

It looks like this bug has shown up now because gcc-10 added support for "arm_sve.h". previously
this header was not present and so COMPILER_SUPPORTS_SVE was false, but now it is true and
sleef tries and fails to build the arm sve code.

I whipped up a patch that changes the detection code so it will not try to build the sve code
if the compiler does not support __sizeless_struct. Unfortunately it then failed with

[ 50%] Building C object src/libm-tester/CMakeFiles/iutypurec_scalar.dir/iutsimd.c.o
cd /sleef-3.4.1/obj-aarch64-linux-gnu/src/libm-tester && /usr/bin/cc -DDETERMINISTIC=1 -DENABLE_ALIAS=1 -DENABLE_PUREC_SCALAR=1 -DENABLE_SYS_getrandom=1 -I/sleef-3.4.1/src/common -I/sleef-3.4.1/src/arch -I/sleef-3.4.1/obj-aarch64-linux-gnu/include -I/sleef-3.4.1/src/libm -I/sleef-3.4.1/obj-aarch64-linux-gnu/src/libm/include -Wall -Wno-unused -Wno-attributes -Wno-unused-result -Wno-psabi -ffp-contract=off -fno-math-errno -fno-trapping-math -O2 -g -DNDEBUG -std=gnu99 -o CMakeFiles/iutypurec_scalar.dir/iutsimd.c.o -c /sleef-3.4.1/src/libm-tester/iutsimd.c
/sleef-3.4.1/src/libm-tester/iutsimd.c:198:9: error: unknown type name ‘Sleef_double_2’
   198 | typedef Sleef_double_2 vdouble2;
       |         ^~~~~~~~~~~~~~
/sleef-3.4.1/src/libm-tester/iutsimd.c:199:9: error: unknown type name ‘Sleef_float_2’
   199 | typedef Sleef_float_2 vfloat2;
       |

That was about where I reached the limit of my skills as someone not familiar with the package,
a work-in progress debdiff is attatched.


Alternatively it looks like there is a new upstream release of sleef that revamps the sve
code so it can be built with gcc 10. So that might be an alternative route.
-------------- next part --------------
diff -Nru sleef-3.4.1/debian/changelog sleef-3.4.1/debian/changelog
--- sleef-3.4.1/debian/changelog	2020-07-30 12:55:23.000000000 +0000
+++ sleef-3.4.1/debian/changelog	2020-09-01 21:17:11.000000000 +0000
@@ -1,3 +1,12 @@
+sleef (3.4.1-4.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Make sve detection code check for __sizeless_struct. gcc 10 has
+    arm_sve.h but not __sizeless_struct which is needed by the sve
+    implementation in this version.
+
+ -- Peter Michael Green <plugwash at debian.org>  Tue, 01 Sep 2020 21:17:11 +0000
+
 sleef (3.4.1-4) unstable; urgency=medium
 
   * Team Upload.
diff -Nru sleef-3.4.1/debian/patches/check-for-sizeless-struct.patch sleef-3.4.1/debian/patches/check-for-sizeless-struct.patch
--- sleef-3.4.1/debian/patches/check-for-sizeless-struct.patch	1970-01-01 00:00:00.000000000 +0000
+++ sleef-3.4.1/debian/patches/check-for-sizeless-struct.patch	2020-09-01 21:17:11.000000000 +0000
@@ -0,0 +1,15 @@
+Description: Make sve detection code check for __sizeless_struct. 
+ gcc 10 has arm_sve.h but not __sizeless_struct which is needed by the sve
+ implementation in this version.
+Author: Peter Michael Green <plugwash at debian.org>
+
+--- sleef-3.4.1.orig/Configure.cmake
++++ sleef-3.4.1/Configure.cmake
+@@ -554,6 +554,7 @@ if(SLEEF_ARCH_AARCH64 AND NOT DISABLE_SV
+   set (CMAKE_REQUIRED_FLAGS ${FLAGS_ENABLE_SVE})
+   CHECK_C_SOURCE_COMPILES("
+   #include <arm_sve.h>
++  typedef __sizeless_struct { svint32_t x, y;} vmask2;
+   int main() {
+     svint32_t r = svdup_n_s32(1); }"
+     COMPILER_SUPPORTS_SVE)
diff -Nru sleef-3.4.1/debian/patches/series sleef-3.4.1/debian/patches/series
--- sleef-3.4.1/debian/patches/series	2020-07-30 12:55:23.000000000 +0000
+++ sleef-3.4.1/debian/patches/series	2020-09-01 21:17:11.000000000 +0000
@@ -1,2 +1,3 @@
 disable-neon-on-armel.patch
 fix-gcc10-build.patch
+check-for-sizeless-struct.patch


More information about the debian-science-maintainers mailing list