简体   繁体   English

如何使用自动工具,make和gcc在64位(Ubuntu 12.04LTS)Linux上编译和安装32Bit库?

[英]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.

相关问题 如何在32位Linux Mint中构建64位FastCGI库? - How 64bit FastCGI library can be built within 32bit Linux Mint? 旧的32位linux程序最终如何调用64位库? - How does an old 32bit linux program end up calling a 64bit library? 如何在 X86_64 CentOS 系统上安装 32 位 gcc 编译器 - How to install a 32bit gcc compiler on a X86_64 CentOS system 如何使用gcc / cmake在64位Linux机器上编译32位二进制文​​件 - How to compile a 32-bit binary on a 64-bit linux machine with gcc/cmake 尝试从64位Linux编译32位Linux的GTK应用程序 - Trying to compile GTK application for 32bit linux from 64bit linux 在Ubuntu 32bit下编译LuaJava - Compile LuaJava under Ubuntu 32bit 在Fedora 20 x86_64上编译32位linux应用程序时使用sndfile库 - using sndfile library when compiling 32bit linux application on Fedora 20 x86_64 在ubuntu 64位上编译32位程序(libjvm.so问题) - compile 32bit program on ubuntu 64bit (libjvm.so problems) 对于64位Windows OS和32位Ubuntu Linux OS,Tesseract解码结果不同 - Tesseract decoding result is different for 64bit Windows OS and 32bit Ubuntu Linux OS 在64位Linux操作系统上编译32位程序会导致致命错误 - Compile program for 32bit on 64bit Linux OS causes fatal error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM