Ubuntu16.04 ARM平台移植libcurl curl-7.63.0


libcurl是免費的輕量級的客戶端網絡庫,支持DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS,POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet, TFTP.支持SSL, HTTPPOST,HTTPPUT, FTP上傳, HTTP form上傳,代理,cookies, 用戶名與密碼認證。

系統環境:Ubuntu 16.04
源碼:curl-7.63.0.tar.gz , 下載地址  https://curl.haxx.se/libcurl/
交叉編譯環境:arm-none-linux-gnueabihf
 
libcurl原代碼內包含了CMakeLists.txt和configure,兩種方式都可以進行交叉編譯

1. toolchain.cmake

#toolchain cmake file 
#cmake -DCMAKE_TOOLCHAIN_FILE=~/toolchain.cmake ../
SET(CMAKE_SYSTEM_NAME Linux)
SET(TOOLCHAIN_DIR "complier_dir")
SET(3RDPART_LIBS_DIR "thirdpart_dir")

#specify the cross compiler
SET(CMAKE_C_COMPILER ${TOOLCHAIN_DIR}/bin/arm-linux-gnueabihf-gcc CACHE FILEPATH "Archiver")
SET(CMAKE_CXX_COMPILER ${TOOLCHAIN_DIR}/bin/arm-linux-gnueabihf-g++ CACHE FILEPATH "Archiver")

#SET(CMAKE_GFORTRAN  ${TOOLCHAIN_DIR}/bin/arm-linux-gnueabihf-gfortran)
SET(CMAKE_AR ${TOOLCHAIN_DIR}/bin/arm-linux-gnueabihf-ar CACHE FILEPATH "Archiver")
SET(CMAKE_AS ${TOOLCHAIN_DIR}/bin/arm-linux-gnueabihf-as CACHE FILEPATH "Archiver")
SET(CMAKE_LD  ${TOOLCHAIN_DIR}/bin/arm-linux-gnueabihf-ld CACHE FILEPATH "Archiver")
SET(CMAKE_NM ${TOOLCHAIN_DIR}/bin/arm-linux-gnueabihf-nm CACHE FILEPATH "Archiver")
SET(CMAKE_STRIP  ${TOOLCHAIN_DIR}/bin/arm-linux-gnueabihf-strip CACHE FILEPATH "Archiver")

# where is the target environment 
SET(CMAKE_FIND_ROOT_PATH  ${TOOLCHAIN_DIR} ${3RDPART_LIBS_DIR})

# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

交叉編譯指令

cmake -DCMAKE_TOOLCHAIN_FILE=toochain._dir ../

2. configure

./configure --prefix=install_dir --host=arm-linux/arm-linux-gnueabihf/others CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM