下午好。
我正在尝试在我的 64 位环境下构建 32 位 fcgi++ 二进制文件。我通过以下方式配置了 FCGI++:
CC="gcc -m32" ./configure
输入“make”后,我看到了一些构建过程,最后出现了以下错误(片段在这里):
gcc -m32 -shared fcgio.lo -Wl,--rpath -Wl,/home/eotovchits/Downloads/fcgi/fcgi-2.4.1-SNAP-0311112127/libfcgi/.libs -Wl,--rpath -Wl,/usr/local/lib /home/eotovchits/Downloads/fcgi/fcgi-2.4.1-SNAP-0311112127/libfcgi/.libs/libfcgi.so -Wl,-soname -Wl,libfcgi++.so.0 -o .libs/libfcgi++.so.0.0.0 /usr/bin/ld: i386:x86-64 architecture of input file
fcgio.lo' is incompatible with i386 output fcgio.lo: In function
__static_initialization_and_destruction_0': /usr/include/c++/4.8/iostream:74: undefined reference tostd::ios_base::Init::Init()' /usr/include/c++/4.8/iostream:74: undefined reference to
std::ios_base::Init::~Init()'
...................... 很多相似的台词...................... …………
fcgio.lo: In function
~basic_ios': /usr/include/c++/4.8/bits/basic_ios.h:276: undefined reference to
vtable for std::basic_ios >' /usr/include/c++/4.8/bits/basic_ios.h:276: undefined reference tostd::ios_base::~ios_base()' /usr/include/c++/4.8/bits/basic_ios.h:276: undefined reference to
vtable for std::basic_ios >' /usr/include/c++/4.8/bits/basic_ios.h:276: undefined reference tostd::ios_base::~ios_base()' fcgio.lo: In function
fcgi_istream::~fcgi_istream()': /home/eotovchits/Downloads/fcgi/fcgi-2.4.1-SNAP-0311112127/libfcgi/../include/fcgio.h:120: undefined reference to `operator delete(void*)' /usr/bin/ld: fcgio.lo: file class ELFCLASS64 incompatible with ELFCLASS32 /usr/bin/ld: final link failed: File in wrong format collect2: error: ld returned 1 exit status
我假设我需要一些额外的 32 位构建环境来制作 32 位二进制文件(以及所有需要的第 3 方库,.a-s 和 .so-s)
你知道我如何在本地设置这样的环境以及 native 64 位环境并为 32 位环境构建我的 fcgi++ 二进制文件吗?
谢谢。
最佳答案
在 Ubuntu 上,您可以通过在末尾附加“:i386”来安装 i386 库和 x64 库,哦,您要安装的包的名称(假设您正在使用 apt-get 安装库)。
这是一个如何做到这一点的例子:
这里是如何安装 32 位编译器(还有 STL 和其他东西):
http://en.kioskea.net/faq/1137-compiling-testing-in-32-bit-on-ubuntu-x86-64
关于c++ - 在 Ubuntu 13 的 64 位环境中构建 32 位 FCGI++ 二进制文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20370344/