交叉編譯 configure 常見參數含義

--host --build --target

host:就是你編譯好的程序能夠運行的平臺, build:就是你正在使用的機器平臺,能夠不用配置。 target:就是你編譯的程序能夠處理的平臺,通常用不到。linux

build和host相同時表示本地編譯,若不相同則表示交叉編譯。 通常來講,咱們平時所說的交差編譯用不到target的,由於通常咱們都是編譯程序,而不是編譯工具。若是咱們編譯工具,好比gcc,這個target就有用了.若是咱們須要在一個咱們的機器上爲arm開發板編譯一個能夠處理mips程序的gcc,那麼target就是mips。工具


例:ui

  1. './configure --build=mipsel-linux --host=mipsel-linux --target=mipsel-linux' will build native mipsel-linux binutils on mipsel-linux.
  1. './configure --build=i386-linux --host=mipsel-linux --target=mipsel-linux' will cross-build native mipsel-linux binutils on i386-linux.
  1. './configure --build=i386-linux --host=i386-linux --target=mipsel-linux' will build mipsel-linux cross-binutils on i386-linux.
  1. './configure --build=mipsel-linux --host=i386-linux --target=mipsel-linux' will cross-build mipsel-linux cross-binutils for i386-linux on mipsel-linux.

As you see, only if $build != $host a cross-compilation is performed.orm

--prefix

--prefix選項是配置安裝的路徑。把全部install的文件放在統一的路徑中ip


例:資源

./configure --prefix=/usr/local/test開發

若是不配置該選項,安裝後可執行文件默認放在/usr/local/bin,庫文件默認放在/usr/local/lib,配置文件默認放在/usr/local/etc,其它的資源文件放在/usr/local/share,比較凌亂。get

--enable-static --disable-shared

enable-static: 編譯成靜態庫 disable-shared: 不編譯成動態庫io

相關文章
相關標籤/搜索