【交叉编译一】openssl-1.1.1编译

君正平台

1、源码包下载

https://www.openssl.org/source/old/1.1.1/

https://www.openssl.org/source/下载openssl-1.1.1源代码

2、进入目录

# tar zxvf openssl-1.1.1.tar.gz  
# cd openssl-1.1.1

3、执行

./config no-asm no-sse2 no-ssl3 no-zlib no-bf no-camellia no-cast no-cms no-comp no-dso no-idea  no-md2 no-mdc2 no-rc2 no-rc5 no-ripemd no-seed --prefix=$(pwd)/ISVP -fPIC --cross-compile-prefix=/opt/mips-gcc472-glibc216-64bit/bin/mips-linux-uclibc-gnu-

    参数说明:

    no-asm:    在交叉编译过程中不使用汇编代码代码加速编译过程.原因是它的汇编代码是对arm格式不支持的。
    no-async: 交叉编译工具链没有提供GNU C的ucontext库
    –prefix=: 安装路径,编译完成install后将有bin,lib,include等文件夹
    –cross-compile-prefix=: 交叉编译工具 

4、make

此时会有一个【报错】:

mips-linux-gnu-gcc: error: unrecognized command line option '-m64'

解决办法,我们打开makefile

搜索-m64选项并删除,共两处

NF_CFLAGS=-pthread -m64

CNF_CXXFLAGS=-std=c++11 -pthread -m64

再一次执行make后

【报错】如下:

./libcrypto.so: undefined reference to `getcontext'
./libcrypto.so: undefined reference to `setcontext'
./libcrypto.so: undefined reference to `makecontext'
collect2: error: ld returned 1 exit status

主要原因是:mipsel-linux没有提供GNU C的ucontext库

解决办法:config 配置时添加 no-async

./config no-asm no-async no-sse2 no-ssl3 no-zlib no-async no-bf no-camellia no-cast no-cms no-comp no-dso no-idea  no-md2 no-mdc2 no-rc2 no-rc5 no-ripemd no-seed --prefix=$(pwd)/ISVP -fPIC --cross-compile-prefix=/opt/mips-gcc472-glibc216-64bit/bin/mips-linux-uclibc-gnu-

5.make && make install

6.编译成功

猜你喜欢

转载自blog.csdn.net/Swallow_he/article/details/108361551
今日推荐