2012-10-10 20 views
4

我有一個運行在lxc容器中的i386 debian系統。 userland是32位,內核是64位。因此配置檢測此:配置無法在32位用戶空間的64位系統上檢測到適當的ld

checking build system type... x86_64-unknown-linux-gnu 
checking host system type... x86_64-unknown-linux-gnu 
checking target system type... x86_64-unknown-linux-gnu 

這大概是從輸出採取UNAME -m

我有一個包,其中建立精細用gcc並且結果是適當的32位二進制。不幸的是在另一個C++項目我得到這個:

configure:8595: checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries 

從這裏開始的連接使用此開關,因此將嘗試鏈接64個庫,而不是32位和失敗:

/usr/bin/ld: skipping incompatible /usr/lib/libboost_program_options.so when searching for -lboost_program_options 
/usr/bin/ld: skipping incompatible /usr/lib/libboost_program_options.a when searching for -lboost_program_options 
/usr/bin/ld: cannot find -lboost_program_options 
collect2: ld returned 1 exit status 

雖然庫.so文件是正確的32位ELF:

file /usr/lib/libboost_program_options.so.*  
/usr/lib/libboost_program_options.so.1.42.0: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, stripped 

有什麼奇怪的是,配置能正常工作的其他項目,並在檢測到連接器正確使用正確的弓(elf_i386):

checking whether the gcc linker (/usr/bin/ld -m elf_i386) supports shared libraries... yes 

任何提示?

回答

1

這大概是從uname -m輸出

此配置腳本輸出拍攝顯然是混淆。

要取消混淆,告訴它究竟想要它做的事情:

./configure --host=i686-unknown-linux-gnu --build=i686-unknown-linux-gnu \ 
    --target=i686-unknown-linux-gnu 
+0

其實它看起來像這種情況需要被視爲一個交叉編譯類似。使用上面的配置標誌,我仍然有一些地方的構建與本地32位env不一樣。例如,我在代碼中有一個#ifdef LINUX條件,即使使用這些開關也不滿意。在C++項目中,configure是從一個複雜的Makefile中調用的,因此要準確地告訴它該做什麼並不那麼容易。考慮到#ifdef LINUX情況,可能會有其他一些驚喜。我決定回到本地32位虛擬機更容易和更安全。 – b0ti

2

我只是刪除未知的命令的語法。 問題是目標:/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/ 一個想法重新配置在目標的目標?

這個工作對我來說:

替換: ./configure --host=x86_64-unknown-linux-gnu --build=x86_64-unknown-linux-gnu \ --target=x86_64-unknown-linux-gnu --options...

通過: ./configure --host=x86_64-linux-gnu --build=x86_64-linux-gnu --options...

相關問題