Package: libcrypto++
Version: 8.6.0-2
Severity: serious
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu jammy ubuntu-patch

Hi Laszlo,

Libcrypto++ is failing to build on armhf because gcc there defaults to an
implied -mfloat-abi=hard, which conflicts with -march=armv7-a because
armv7-a does not guarantee floating-point support, and libcrypto++
hard-codes -march=armv7-a in its makefile:

g++ -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -pthread -g -O2 
-ffile-prefix-map=/build/libcrypto++-WzcQPh/libcrypto++-8.6.0=. 
-fstack-protector-strong -Wformat -Werror=format-security -DNDEBUG -c zlib.cpp
g++ -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -pthread -g -O2 
-ffile-prefix-map=/build/libcrypto++-WzcQPh/libcrypto++-8.6.0=. 
-fstack-protector-strong -Wformat -Werror=format-security -DNDEBUG 
-march=armv7-a -Wa,--noexecstack -c aes_armv4.S
cc1: error: ‘-mfloat-abi=hard’: selected architecture lacks an FPU
make[2]: *** [GNUmakefile:1586: aes_armv4.o] Error 1
[...]

There are various ways to reconcile this incompatibility between build
options, but given this is armhf which is guaranteed to have floating-point
support, I think the simplest may be as in the attached patch, which adjusts
to using -march=armv7-a+fp instead of just -march=armv7-a.  However, I have
not tested that this results in correct behavior on armel, which is also
still a Debian architecture but not an Ubuntu architecture.

-- 
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 libcrypto++-8.6.0/debian/patches/correct-arm-arch.patch 
libcrypto++-8.6.0/debian/patches/correct-arm-arch.patch
--- libcrypto++-8.6.0/debian/patches/correct-arm-arch.patch     1969-12-31 
16:00:00.000000000 -0800
+++ libcrypto++-8.6.0/debian/patches/correct-arm-arch.patch     2021-12-19 
12:21:44.000000000 -0800
@@ -0,0 +1,25 @@
+Description: Use the correct architecture target for armhf.
+Author: Steve Langasek <steve.langa...@ubuntu.com>
+Last-Update: 2021-12-19
+Forwarded: no
+
+Index: libcrypto++-8.6.0/GNUmakefile
+===================================================================
+--- libcrypto++-8.6.0.orig/GNUmakefile
++++ libcrypto++-8.6.0/GNUmakefile
+@@ -1174,11 +1174,11 @@
+ # Also see https://www.cryptopp.com/wiki/Cryptogams.
+ ifeq ($(IS_ARM32)$(IS_LINUX),11)
+   ifeq ($(CLANG_COMPILER),1)
+-    CRYPTOGAMS_ARMV4_FLAG = -march=armv7-a -Wa,--noexecstack
+-    CRYPTOGAMS_ARMV4_THUMB_FLAG = -march=armv7-a -mthumb -Wa,--noexecstack
++    CRYPTOGAMS_ARMV4_FLAG = -march=armv7-a+fp -Wa,--noexecstack
++    CRYPTOGAMS_ARMV4_THUMB_FLAG = -march=armv7-a+fp -mthumb -Wa,--noexecstack
+   else
+-    CRYPTOGAMS_ARMV4_FLAG = -march=armv7-a -Wa,--noexecstack
+-    CRYPTOGAMS_ARMV4_THUMB_FLAG = -march=armv7-a -Wa,--noexecstack
++    CRYPTOGAMS_ARMV4_FLAG = -march=armv7-a+fp -Wa,--noexecstack
++    CRYPTOGAMS_ARMV4_THUMB_FLAG = -march=armv7-a+fp -Wa,--noexecstack
+   endif
+   SRCS += aes_armv4.S sha1_armv4.S sha256_armv4.S sha512_armv4.S
+ endif
diff -Nru libcrypto++-8.6.0/debian/patches/series 
libcrypto++-8.6.0/debian/patches/series
--- libcrypto++-8.6.0/debian/patches/series     2021-09-25 10:38:20.000000000 
-0700
+++ libcrypto++-8.6.0/debian/patches/series     2021-12-19 12:20:29.000000000 
-0800
@@ -1 +1,2 @@
 fix_library_name.patch
+correct-arm-arch.patch

Reply via email to