1.开发环境
(1)装有openssl的ubuntu
(2)交叉编译工具arm-linux-gnueabihf-gcc
(3)openssl和libcurl源码
交叉编译工具的安装 https://blog.youkuaiyun.com/qq_46777053/article/details/110221159
libcurl源码的获取 https://github.com/curl/curl/releases/tag/curl-7_71_1
openssl源码的获取 终端输入wget --no-check-certificate https://www.openssl.org/source/openssl-1.1.1a.tar.gz
2.安装openssl
如果系统已经有,不需要再次安装 通过whereis openssl 命令查看
解压后进入openssl-1.1.1a文件夹
./config //默认安装位置在/usr/local,此时需要在安装curl时 在后面添加 --wirh-ssl,具体的内容看 curl-7.71.1/docs/dINSTALL.md
make
sudo make install
以上步骤得到的openssl 是x86的
curl-7.71.1/docs/dINSTALL.md的部分内容
The configure script always tries to find a working SSL library unless
explicitly told not to. If you have OpenSSL installed in the default search
path for your compiler/linker, you don't need to do anything special. If you
have OpenSSL installed in `/usr/local/ssl`, you can run configure like:
./configure --with-ssl
3.交叉编译curl
进入解压后的curl-7.71.1
./configure --prefix=$PWD/_installPi --host=arm-linux-gnueabihf CC=arm-linux-gnueabihf-gcc