
废话不多说,直接上方法:
解压 openssl 库文件
tar -xzf openssl-1.1.1l.tar.gz
提前准备好君正的交叉编译工具,我放的位置是:/opt/mips-gcc472-glibc216-64bit
进入 openssl源码目录后执行:
第一步:
./Configure linux-mips32 --cross-compile-prefix=/opt/mips-gcc472-glibc216-64bit/bin/mips-linux-uclibc-gnu- no-async no-shared --prefix=$(pwd)/output
第二步:
make
第三步:
make install
以上步骤不会编译报错,到这里就可以获取到可用的 openssl 静态库文件和 openssl 头文件了。
这里用 /opt/mips-gcc472-glibc216-64bit 的方式,是因为防止当前路径的环境变量里的交叉编译工具版本不对而出现报错。
生成的库文件在 output/lib/*.a 头文件在 output/include
测试 demo 编译命:
OPENSSL_LIB_PATH=openssl 库文件路径
openssl_test.c 测试 openssl 代码
/opt/mips-gcc472-glibc216-64bit/bin/mips-linux-uclibc-gnu-gcc openssl_test.c -O2 -Wall -march=mips32r2 -g -ffunction-sections -Wl,-gc-sections -g -lpthread -lm -lrt -ldl -lstdc++ -I/OPENSSL_LIB_PATH/include /OPENSSL_LIB_PATH/lib/libssl.a /OPENSSL_LIB_PATH/lib/libcrypto.a -L/OPENSSL_LIB_PATH/lib/ -lssl -lcrypto -o test
测试通过:
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)