b0t*_*0ti 5 linker autoconf gcc g++ 32bit-64bit
我有一个 i386 debian 系统在 lxc 容器中运行。用户态是32位,内核是64位。因此配置检测到这一点:
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
Run Code Online (Sandbox Code Playgroud)
这可能是从uname -m的输出中获取的
我有一个可以用 gcc 构建的软件包,结果是一个正确的 32 位二进制文件。不幸的是,在另一个 C++ 项目中我得到了这个:
configure:8595: checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries
Run Code Online (Sandbox Code Playgroud)
从这里开始,链接器使用此开关,因此将尝试链接 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
Run Code Online (Sandbox Code Playgroud)
虽然库 .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
Run Code Online (Sandbox Code Playgroud)
奇怪的是,configure 对于其他项目工作正常,并且正确检测到链接器以使用正确的架构(elf_i386):
checking whether the gcc linker (/usr/bin/ld -m elf_i386) supports shared libraries... yes
Run Code Online (Sandbox Code Playgroud)
有什么提示吗?
这可能是从 uname -m 的输出中获取的
这个配置脚本显然很混乱。
为了消除它的困惑,请准确地告诉它你想要它做什么:
./configure --host=i686-unknown-linux-gnu --build=i686-unknown-linux-gnu \
--target=i686-unknown-linux-gnu
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6815 次 |
| 最近记录: |