Source: babl
Version: 0.1.50-1
Severity: important
Justification: failed to build from source (but built in the past)
Tags: patch
User: debian-al...@lists.debian.org
Usertags: ftbfs

babl FTBFS on Alpha [1] with what on the surface looks like a linker error
but is actually misuse of the -Ofast compiler option.  babl unconditionally
uses the -Ofast option when compiling with gcc.  This implies
-ffast-math which the gcc manual makes clear is not compliant with
standards and on some architectures may break if used with non-finite
math.  Alpha is one of those architectures. 

If we remove -Wl,-z,defs from the linker flags specified in debian/rules
then the link succeeds on Alpha but the test suite fails with floating
point exceptions, because non-finite math is used.

I attach a patch that adds a --disable-ofast option to the configure
script so it is possible to build without -Ofast.  The second patch
is a change to debian/rules to detect if building with Alpha then
supply the --disable-ofast option when invoking configure. With these
babl builds to completion, with the test suite passing, on Alpha.

Cheers
Michael.

[1]
https://buildd.debian.org/status/fetch.php?pkg=babl&arch=alpha&ver=0.1.50-1&stamp=1526902985&raw=0
--- a/configure.ac
+++ b/configure.ac
@@ -136,6 +136,9 @@
 WEBSITE_LOCATION=public_html/babl/
 AC_SUBST(WEBSITE_LOCATION)
 
+AC_ARG_ENABLE([ofast],
+              [  --disable-ofast          disable use of -Ofast (default=no)],,
+              enable_ofast="yes")
 
 if eval "test x$GCC = xyes"; then
   case " $CFLAGS " in
@@ -161,8 +164,13 @@
 BABL_DETECT_CFLAGS(extra_warnings, '-Wold-style-definition')
 CFLAGS="$CFLAGS $extra_warnings"
 
-BABL_DETECT_CFLAGS(extra_warnings, '-Ofast' )
-CFLAGS="$CFLAGS $extra_warnings"
+if test "x$enable_ofast" = xyes; then
+  BABL_DETECT_CFLAGS(extra_warnings, '-Ofast' )
+  CFLAGS="$CFLAGS $extra_warnings"
+else
+  BABL_DETECT_CFLAGS(extra_warnings, '-O3' )
+  CFLAGS="$CFLAGS $extra_warnings"
+fi
 
 fi
 
--- babl-0.1.50/debian/rules	2018-05-21 14:36:01.000000000 +1200
+++ babl-0.1.50+alpha/debian/rules	2018-07-14 21:14:49.322785083 +1200
@@ -10,6 +10,12 @@
 	sse_flags := --enable-mmx --enable-sse --enable-sse2
 endif
 
+# Disable use of -Ofast (thus -ffath-math) on Alpha
+ofast_flags :=
+ifeq ($(DEB_HOST_ARCH_CPU),alpha)
+	ofast_flags := --disable-ofast
+endif
+
 %:
 	dh $@ --with gnome
 
@@ -20,7 +26,8 @@
 	dh_auto_configure -- \
 		$(sse_flags) \
 		--disable-sse4_1 \
-		--disable-f16c
+		--disable-f16c \
+		$(ofast_flags)
 
 override_dh_install:
 	find debian/tmp -name '*.la' -print -delete

Reply via email to