pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: openssl: "architecture lacks an FPU" on Debian 12/armv7



"Sijmen J. Mulder" <ik%sjmulder.nl@localhost> writes:

> On my Raspberry 2B (armv7) running Debian 12, or rather Raspberry Pi OS, 
> I set up pkgsrc and tried to build a package. However security/openssl 
> failed with this compile error:
>
>   cc1: error: '-mfloat-abi=hard': selected architecture lacks an FPU
>
> It turns out having to with openssl's configure adding -march=armv7-a
> which is easy to reproduce in isolation:
>
>   $ cc hello.c
>   $ cc hello.c -march=armv7-a
>   cc1: error: ‘-mfloat-abi=hard’: selected architecture lacks an FPU
>
> As far as I'm aware this only happens with Debian 12. I'm not sure why.

Many cpu families have a lot of members  with varying capabilities.   A
compiler (and really an os/packging system) choose a least common
denominator and configure the compiler to target that specific
capability.  Then the code will run on that member and any strictly
greater members.

Last I knew, NetBSD i386 targetted i486.

NetBSD earmv7hf-el is the build that runs on the RPI2/3, and that
assumes float.   I bet there are armv7 that do not have hardware
floating point.

It seems that RaspiOS is targetting an armv7 w/o FP.  This is very
strange to me.


> There's an upstream ticket[1] suggesting explicitly selecting the armv4 
> target. This seems like a downgrade from armv4 but in fact the 
> automatically selected target is armv4 anyway except with the 
> problematic -march added.
>
> In security/openssl/Makefile the change is to add:
>
>   OPENSSL_HOST.Linux-armv7l=	linux-armv4
>  
> Is this a suitable solution? In that case I can commit. Full patch 
> attached below.
>
> 1: https://github.com/openssl/openssl/issues/21630
>
> Index: Makefile
> ===================================================================
> RCS file: /cvsroot/pkgsrc/security/openssl/Makefile,v
> retrieving revision 1.301
> diff -u -u -r1.301 Makefile
> --- Makefile	5 Jun 2024 07:47:33 -0000	1.301
> +++ Makefile	12 Jul 2024 18:31:25 -0000
> @@ -110,6 +110,7 @@
>  OPENSSL_HOST.SunOS-x86_64=	solaris64-x86_64-gcc
>  .endif
>  OPENSSL_HOST.Darwin-aarch64=	darwin64-arm64-cc
> +# Prevent configure adding breaking -march=armv7-a:
> +# https://github.com/openssl/openssl/issues/21630
> +OPENSSL_HOST.Linux-armv7l=	linux-armv4
>  
>  # Ensure consistent socket interfaces are used across the codebase.
>  CPPFLAGS.SunOS+=	-D_XOPEN_SOURCE=600 -D__EXTENSIONS__

This feels wrong.  If building for a target w/o FP, then the fix is to
not pass -mfloat-abi-hard.

But the real fix is that RaspiOS for RPI2 should target hardfloat.


Home | Main Index | Thread Index | Old Index