libcurl+openssl交叉编译

目录

编译环境

Openssl

libcurl

验证


编译环境

Ubuntu20.04 + 正点原子RV1126交叉编译工具链

Openssl

openssl-1.1.1f:https://www.openssl.org/source/old/1.1.1/openssl-1.1.1f.tar.gz

./config no-asm shared --prefix=/home/linux/arm/openssl --cross-compile-prefix=arm-linux-gnueabihf-

去掉Makefile中 -m64

make -j4
make install

libcurl

libcurl-7.68.0:https://github.com/moparisthebest/static-curl/archive/refs/tags/v7.68.0.tar.gz

tar xzf curl-7.68.0.tar.gz
cd static-curl-7.68.0

wget https://curl.haxx.se/download/curl-7.68.0.tar.gz https://curl.haxx.se/download/curl-7.68.0.tar.gz.asc

gpg --no-default-keyring --yes -o ./curl.gpg --dearmor mykey.asc

gpg --no-default-keyring --keyring ./curl.gpg --verify curl-7.68.0.tar.gz.asc


tar xzf curl-7.68.0.tar.gz

cd curl-7.68.0
CPPFLAGS="-I/home/linux/arm/openssl/ -I/home/linux/arm/openssl/include" LDFLAGS="-L/home/linux/arm/openssl/lib" LIBS="-ldl" ./configure --host=arm-linux-gnueabihf CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ --with-ssl=/home/linux/arm/openssl/ --enable-shared --enable-static --disable-dict --disable-ftp --disable-imap --disable-ldap --disable-ldaps --disable-pop3 --disable-proxy --disable-rtsp --disable-smtp --disable-telnet --disable-tftp --disable-zlib --without-ca-bundle --without-gnutls --without-libidn --without-librtmp --without-libssh2 --without-nss --without-zlib --prefix=/home/linux/arm/curl

make -j4

make install

验证

将/home/linux/arm/curl/bin/curl + /home/linux/arm/curl/lib/libcurl.so 移植到开发板

./curl https://www.baidu.com -k