4

lxc コンテナで i386 debian システムを実行しています。ユーザーランドは 32 ビット、カーネルは 64 ビットです。したがって、configure はこれを検出します。

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

ここから、リンカーはこのスイッチを使用しているため、32 ビットではなく 64 ビットのライブラリをリンクしようとして失敗します。

/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

ヒントはありますか?

4

2 に答える 2

2

コマンドの構文からunknownを削除するだけです。問題はターゲットです: /usr/local/libexec/gcc/x86_64-unknown-linux-gnu/ conf flie でターゲットを再構成するアイデアはありますか?

これは私のために働く:

交換: ./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...

于 2016-06-30T14:23:52.730 に答える
1

Probably this is taken from the output of uname -m

This configure script is clearly confused.

To un-confuse it, tell it exactly what you want it to do:

./configure --host=i686-unknown-linux-gnu --build=i686-unknown-linux-gnu \
  --target=i686-unknown-linux-gnu
于 2012-10-11T01:44:24.763 に答える