openssl交叉编译

1. 下载源代码

有外网可以去github上下载,这里贴一个下载好的 openssl-3.3.0

2. 在根目录下建一个build文件夹,切换到里面,再建一个install文件夹

openssl-3.3.0$ mkdir build/install -p
openssl-3.3.0$ cd build/
openssl-3.3.0/build$

3. 将自己的编译工具链路径导入PATH

openssl-3.3.0/build$ export PATH=$PATH:/path/to/cross_comiler_tool/bin #注意一定到到bin,建议采用绝对路径,以免出问题

4. 执行config,注意修改--cross-compile-prefix为自己的工具链指令前缀

openssl-3.3.0/build$ ../config no-asm --prefix=./install --cross-compile-prefix=aarch64-buildroot-linux-gnu- #这个是编译工具链指令前面那部分
Configuring OpenSSL version 3.3.0 for target linux-x86_64
Using os-specific seed configuration
Created configdata.pm
Running configdata.pm
Created Makefile.in
...

5. 删除Makefile中的-m64

执行完config后,会在build下生成很多文件,打开其中的Makefile,找到“-m64”并删除,否则下一步会遇到错误:

aarch64-buildroot-linux-gnu-gcc.br_real: error: unrecognized command line option '-m64'

6. 执行make & main install

openssl-3.3.0/build$ make & make install

7. install路径下就是我们编译完的结果

openssl-3.3.0/build$ tree -L 2 install
install
├── bin
│   ├── c_rehash
│   └── openssl
├── include
│   └── openssl
├── lib64
│   ├── cmake
│   ├── engines-3
│   ├── libcrypto.a
│   ├── libcrypto.so -> libcrypto.so.3
│   ├── libcrypto.so.3
│   ├── libssl.a
│   ├── libssl.so -> libssl.so.3
│   ├── libssl.so.3
│   ├── ossl-modules
│   └── pkgconfig
├── share
│   ├── doc
│   └── man
└── ssl
    ├── certs
    ├── ct_log_list.cnf
    ├── ct_log_list.cnf.dist
    ├── misc
    ├── openssl.cnf
    ├── openssl.cnf.dist
    └── private

15 directories, 12 files

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值