linux交叉编译 lcurl库

下载curl包(网站上找最新版本下载 http://curl.haxx.se/download/

​wget https://curl.haxx.se/download/curl-7.65.3.tar.gz

解压中
​​tar -xzvf  curl-7.65.3.tar.gz

ubuntu的终端操作:
export PATH=$PATH:/home/work/arm-linux-toolchain/bin/
export ARCH=arm
export CROSS_COMPILE=arm-none-linux-gnueabi-
export CC=arm-none-linux-gnueabi-gcc
export CXX=arm-none-linux-gnueabi-g++
make clean

cd   curl-7.65.3

正式开始

(1)./configure   --host=arm-linux     --prefix=/home/curl
     //host表明目标是arm平台,--host=mipsel-linux 表明目标是mips平台;
      //   交叉安装 安装的目录/home/curl。

(2)静态库和动态库都编译
CPPFLAGS="-I/home/linux/opt/openssl/ -I/home/linux/opt/openssl/include" LDFLAGS="-L/home/linux/opt/openssl/lib" LIBS="-ldl" ./configure --with-ssl --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/opt/curl

(3)只编译静态库

CPPFLAGS="-I/home/linux/opt/openssl/-I/home/linux/opt/openssl/include"LDFLAGS="-L/home/linux/opt/openssl/lib" LIBS="-ldl"./configure --with-ssl --disable-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/opt/curl


make


make install

如果是因为权限问题,使用sudo make install

交叉编译使用的时候:如下所示

SDK/CameraHDV/*.cpp SDK/Common/CameraSDK.cpp SDK/Common/CameraSDKHDV.cpp -Lx64/Debug -lCommon -lcurl -fPIC -shared -o x64/Debug/libCameraSDKHDV.so
/usr/bin/g++ -g -DLINUX Test/SdkCamera/*.cpp -ICommon/Common -ISDK/Common -Lx64/Debug -lCommon -lCameraSDKHDV -lpthread -ldl -fPIC -o x64/Debug/SdkCamere

要将lib和include都要包含

使用 curl --version 检查是否更新成功