在 32 位 Ubuntu 12.04 上构建 64 位应用程序

在 32 位 Ubuntu 12.04 上构建 64 位应用程序

我想将 64 cpp 应用程序制作成 32 位 Ubuntu。编译时出现以下错误:

In file included from /usr/include/c++/4.6/i686-linux-gnu/64/bits/os_defines.h:40:0,
                 from /usr/include/c++/4.6/i686-linux-gnu/64/bits/c++config.h:393,
                 from /usr/include/c++/4.6/string:40,
                 from ./util.h:4,
                 from cb/allBalances.cpp:4:
/usr/include/features.h:324:26: fatal error: bits/predefs.h: No such file or directory
compilation terminated.
In file included from /usr/include/c++/4.6/i686-linux-gnu/64/bits/os_defines.h:40:0,
                 from /usr/include/c++/4.6/i686-linux-gnu/64/bits/c++config.h:393,
                 from /usr/include/c++/4.6/string:40,
                 from ./util.h:4,
                 from cb/dumpTX.cpp:4:
/usr/include/features.h:324:26: fatal error: bits/predefs.h: No such file or directory
compilation terminated.
In file included from /usr/include/c++/4.6/i686-linux-gnu/64/bits/os_defines.h:40:0,
                 from /usr/include/c++/4.6/i686-linux-gnu/64/bits/c++config.h:393,
                 from /usr/include/c++/4.6/string:40,
                 from ./util.h:4,
                 from cb/closure.cpp:4:
/usr/include/features.h:324:26: fatal error: bits/predefs.h: No such file or directory
compilation terminated.
c++ -- cb/rewards.cpp
In file included from /usr/include/c++/4.6/i686-linux-gnu/64/bits/os_defines.h:40:0,
                 from /usr/include/c++/4.6/i686-linux-gnu/64/bits/c++config.h:393,
                 from /usr/include/c++/4.6/bits/stl_algobase.h:60,
                 from /usr/include/c++/4.6/bits/stl_tree.h:63,
                 from /usr/include/c++/4.6/map:60,
                 from callback.cpp:2:
/usr/include/features.h:324:26: fatal error: bits/predefs.h: No such file or directory
compilation terminated.
In file included from /usr/include/stdio.h:28:0,
                 from cb/help.cpp:4:
/usr/include/features.h:324:26: fatal error: bits/predefs.h: No such file or directory
compilation terminated.
make: *** [.objs/dumpTX.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [.objs/allBalances.o] Error 1
make: *** [.objs/closure.o] Error 1
In file included from /usr/include/c++/4.6/i686-linux-gnu/64/bits/os_defines.h:40:0,
                 from /usr/include/c++/4.6/i686-linux-gnu/64/bits/c++config.h:393,
                 from /usr/include/c++/4.6/string:40,
                 from ./util.h:4,
                 from cb/pristine.cpp:4:
/usr/include/features.h:324:26: fatal error: bits/predefs.h: No such file or directory
compilation terminated.
make: *** [.objs/callback.o] Error 1
In file included from /usr/include/c++/4.6/i686-linux-gnu/64/bits/os_defines.h:40:0,
                 from /usr/include/c++/4.6/i686-linux-gnu/64/bits/c++config.h:393,
                 from /usr/include/c++/4.6/string:40,
                 from ./util.h:4,
                 from cb/rewards.cpp:4:
/usr/include/features.h:324:26: fatal error: bits/predefs.h: No such file or directory
compilation terminated.

我猜想可以通过下载适当的 64blibc环境来解决这个问题。是这样吗?我该怎么做?

答案1

根据包索引libc6-dev-amd64包含bits/predefs.h(您的错误是由于缺少该头文件)。因此请安装它:

sudo apt-get install libc6-dev-amd64

相关内容