Search code examples
buildraspberry-piopenssl

openssl 3.0.5 failing on rasperrypi 22.04


I have tried following build from source steps

curl -OJ https://www.openssl.org/source/openssl-3.0.5.tar.gz
tar -xzf openssl-3.0.5.tar.gz
cd openssl-3.0.5
./config shared -Wl,-rpath=/opt/openssl/lib64 --prefix=/opt/openssl --openssldir=/opt/openssl/ssl
make -j 4
make install
cd ..
rm /usr/bin/openssl
ln -s /opt/openssl/bin/openssl /usr/bin/openssl
ln -s /etc/ssl/certs/*.* /opt/openssl/ssl/certs/
echo "/opt/openssl/lib64" > /etc/ld.so.conf.d/openssl.conf
ldconfig
reboot

However during the make process I get the following error:

'-mfloat-abi=hard': selected processor lacks an FPU

I however believe that the rpi4 does in fact have one. Am I mistaken or is there some other error? Help would be appreciated


Solution

  • So what you can do to solve this is include the instruction set to which you are compiling openSSL

    #!/bin/bash
    set -e
    
    if [[ $1 != '' ]]
    then
        echo "Getting openssl version ${1}"
        sudo apt -y install libcurl4-openssl-dev librtmp-dev curl
        curl -OJ "https://www.openssl.org/source/openssl-${1}.tar.gz"
        tar -xzf openssl-${1}.tar.gz
        cd openssl-${1}
        ./config shared -Wl,-rpath=/opt/openssl/lib --prefix=/opt/openssl --openssldir=/opt/openssl/ssl -march=armv7-a+fp
        make -j 4
        make install
        cd ..
        rm /usr/bin/openssl
        ln -s /opt/openssl/bin/openssl /usr/bin/openssl
        ln -s /etc/ssl/certs/*.* /opt/openssl/ssl/certs/
        echo "/opt/openssl/lib" > /etc/ld.so.conf.d/openssl.conf
        echo "export LD_LIBRARY_PATH=/opt/openssl/lib" > /etc/profile.d/openssl.sh
        ldconfig
        rm openssl-${1}.tar.gz
        rm -rf openssl-${1}
        reboot
    else
        echo Please provide latest openssl version \(3.x.x\) from:
        echo https://www.openssl.org/source/
    fi
    

    The above script when saved to a bash file. Eg. openssl.sh

    Will take care of your problem. Remember to feed in the openssl version you are targeting.

    ./openssl.sh 3.0.7
    

    -march=armv7-a+fp is only meant for hardware that supports 32 bit arm based instructions such as RaspberryPi's.

    Hope this helps!