openssl 交叉编译 移植到rk3588s

69 阅读1分钟

下载

wget https://github.com/openssl/openssl/releases/download/openssl-3.5.1/openssl-3.5.1.tar.gz

解压

tar xf openssl-3.5.1.tar.gz

切换到源码目录

cd openssl-3.5.1/

配置

./config no-asm no-async shared --prefix=/home/lingke/projects/rk3588s_install_path/openssl --cross-compile-prefix=aarch64-rockchip1031-linux-gnu-

编译

make

编译报错

报错信息,如下:

make[1]: Entering directory '/home/lingke/projects/openssl-3.5.1'
aarch64-rockchip1031-linux-gnu-gcc  -I. -Iinclude -Iapps/include  -fPIC -pthread -m64 -Wall -O3 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSLDIR="\"/home/lingke/projects/rk3588s_install_path/openssl/ssl\"" -DENGINESDIR="\"/home/lingke/projects/rk3588s_install_path/openssl/lib64/engines-3\"" -DMODULESDIR="\"/home/lingke/projects/rk3588s_install_path/openssl/lib64/ossl-modules\"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG  -MMD -MF apps/lib/libapps-lib-app_libctx.d.tmp -c -o apps/lib/libapps-lib-app_libctx.o apps/lib/app_libctx.c
aarch64-rockchip1031-linux-gnu-gcc: error: unrecognized command-line option '-m64'
make[1]: *** [Makefile:5605: apps/lib/libapps-lib-app_libctx.o] Error 1
make[1]: Leaving directory '/home/lingke/projects/openssl-3.5.1'
make: *** [Makefile:3867: build_sw] Error 2

将Makefile的3817、3818行的 -m64 删掉

 3812 ##### Project flags ##################################################
 3813
 3814 # Variables starting with CNF_ are common variables for all product types
 3815
 3816 CNF_CPPFLAGS=-DOPENSSL_BUILDING_OPENSSL -DNDEBUG
 3817 CNF_CFLAGS=-pthread -m64
 3818 CNF_CXXFLAGS=-std=c++11 -pthread -m64
 3819 CNF_LDFLAGS=
 3820 CNF_EX_LIBS=-ldl -pthread

改完后,如下:

 3812 ##### Project flags ##################################################
 3813
 3814 # Variables starting with CNF_ are common variables for all product types
 3815
 3816 CNF_CPPFLAGS=-DOPENSSL_BUILDING_OPENSSL -DNDEBUG
 3817 CNF_CFLAGS=-pthread
 3818 CNF_CXXFLAGS=-std=c++11 -pthread
 3819 CNF_LDFLAGS=
 3820 CNF_EX_LIBS=-ldl -pthread

再次编译

make

安装

make install