c++ - 在 Ubuntu 13 的 64 位环境中构建 32 位 FCGI++ 二进制文件

标签 c++ c linux gcc fastcgi

下午好。

我正在尝试在我的 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 to std::ios_base::Init::Init()' /usr/include/c++/4.8/iostream:74: undefined reference tostd::ios_base::Init::~Init()'

...................... 很多相似的台词...................... …………

fcgio.lo: In function ~basic_ios': /usr/include/c++/4.8/bits/basic_ios.h:276: undefined reference tovtable for std::basic_ios >' /usr/include/c++/4.8/bits/basic_ios.h:276: undefined reference to std::ios_base::~ios_base()' /usr/include/c++/4.8/bits/basic_ios.h:276: undefined reference tovtable for std::basic_ios >' /usr/include/c++/4.8/bits/basic_ios.h:276: undefined reference to std::ios_base::~ios_base()' fcgio.lo: In functionfcgi_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 安装库)。

这是一个如何做到这一点的例子:

https://askubuntu.com/questions/60751/is-it-possible-to-have-32-bit-libraries-installed-on-a-64-bit-system

这里是如何安装 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/

相关文章:

c - int值意外改变

linux - 将 STDerr 和 STDout 放入 bash 脚本内的日志文件中

linux - 监视日志文件时的错误处理

C++ 语音识别 API

c++ - 用 C++ 思考?

c - 如何验证 C 宏中的类型

C 替换特殊字符

linux - 在 Mac OS X 中清理信号量

c++ - 在每次调用 : should I pass the engine, 分配或两者时生成不同数字的函数?

C++,错误,Native' 已退出,代码为 -1073741819 (0xc0000005)