[英]How to compile and install a 32Bit library on a 64 Bit (Ubuntu 12.04LTS) Linux using autotools, make and gcc?
I'm trying to compile a 32Bit version of a linux library on a 64Bit Ubuntu 12.04LTS running inside a VM (VirtualBox). 我正在尝试在VM(VirtualBox)内运行的64位Ubuntu 12.04LTS上编译Linux库的32位版本。
So far I've downloaded the source, unzipped it and performed the following steps to build the lib: 到目前为止,我已经下载了源代码,将其解压缩并执行以下步骤来构建库:
libtoolize --force
automake --add-missing
./configure --build=i686-pc-linux-gnu "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32"
make
sudo make install
With this I've been able to build an compile the library but, once I run "readelf -h" on the compiled lib I get the following output: 有了这个,我已经能够构建一个编译库,但是,一旦我在编译后的库上运行“ readelf -h”,我将得到以下输出:
ELF Header:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: DYN (Shared object file)
Machine: Advanced Micro Devices X86-64
Version: 0x1
Entry point address: 0x1ac0
Start of program headers: 64 (bytes into file)
Start of section headers: 53904 (bytes into file)
Flags: 0x0
Size of this header: 64 (bytes)
Size of program headers: 56 (bytes)
Number of program headers: 7
Size of section headers: 64 (bytes)
Number of section headers: 35
Section header string table index: 32
So I'm stuck with a 64Bit Version of the library and have not yet found a way to force the build and installation of a 32Bit Version. 因此,我坚持使用该库的64位版本,还没有找到一种方法来强制构建和安装32位版本。 I'd be grateful for hints on how to solve this problem. 非常感谢您提供有关如何解决此问题的提示。
You only set --build
in your options for ./configure
. 您只需在./configure
的选项中设置--build
。 That means that ./configure
should behave as if the program is being compiled on a 32-bit computer. 这意味着./configure
行为就像在32位计算机上编译程序一样。 If you want it to run on a 32-bit computer as well, you should use --host=i386-linux-gnu
. 如果希望它也能在32位计算机上运行,则应使用--host=i386-linux-gnu
。 So the real configure command you want to run is: 因此,您要运行的真正的configure命令是:
./configure --build=i386-linux-gnu --host=i386-linux-gnu
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.