在開始移植前,默認已經下載好庫文件並解壓好
移植三部曲:
./configuer : 配置參數 make : 編譯 make install : 安裝
configure 配置參數說名
1 說明
在linux 中,常常須要用到交叉編譯,在ubuntu系統中,交叉編譯能夠運行在arm平臺上的bin文件。對於大部分代碼, 都有configure文件,讓開發者進行配置,配置完畢以後自動生成makefile,而後進行編譯。本文旨在說明configure中 經常使用的一些參數。
2 開發環境
軟件環境: ubuntu 操做系統 編譯工具鏈:arm-openwrt-linux 硬件平臺:高通ipq
3 configure參數說明
3.1 查看configure 配置選項
在configure目錄下,運行 ./configure --help 命令,能夠查看到configure的配置參數一共有哪些。
3.2 參數說明
3.2.1 build 參數 : 執行代碼編譯的主機,能夠默認不寫
--build=BUILD configure for building on BUILD [guessed]
3.2.2 host 參數 : 指定軟件運行的系統平臺
--host=HOST cross-compile to build programs to run on HOST [BUILD]
例如 arm-openwrt-linux 這個平臺時:linux
--host=arm-openwrt-linux
3.2.3 target 參數 : 創建交叉編譯環境,通常可不填,若是填寫,和 host 保持一致
--target=TARGET configure for building compilers for TARGET [HOST]
3.2.4 CC 參數 : 交叉編譯器命令
CC C compiler command
舉例:git
CC=arm-openwrt-linux-muslgnueabi-gcc
3.2.5 prefix 參數 :指定編譯 make install 後,文件安裝的目錄ubuntu
--program-prefix=PREFIX prepend PREFIX to installed program names
注:不指定prefix,則可執行文件默認放在/usr/local/bin,庫文件默認放在/usr/local/lib,配置文件默認放在/usr/local/etc。其餘的資源文件放在/usr/local/share
--prefix=/home/tmp/test
3.3 編譯參數示例
./configure --target=arm-openwrt-linux --host=arm-openwrt-linux --build=x86_64-linux-gnu --prefix=/usr 或者 ./configure --host=arm-openwrt-linux --build=x86_64-linux-gnu 或者 ./configure --host=arm-openwrt-linux