linux - 为 power-pc 交叉编译 boost 库失败

标签 linux gcc boost g++ cross-compiling

我需要为 power-pc 交叉编译 boost 库。

请在下面找到我为让它运行而执行的步骤:

我有

  1. 下载 boost 1.61
  2. 解压到/home/emh2
  3. 并执行 sudo ./home/bootstrap.sh 来 boost 构建器 b2
  4. Boost.Builder b2 已成功创建。

交叉编译器 powerpc-bt-linux-gnuspe-g++ 位于以下路径下:

/usr/local/cross/i686-bt-linux/usr/bin/powerpc-bt-linux-gnuspe/

交叉编译器的include目录如下

/usr/local/cross/ppce500v2-bt-linux-gnuspe/usr/include/c++/5.2.0/powerpc-bt-linux-gnuspe

/usr/local/cross/ppce500v2-bt-linux-gnuspe/usr/include/c++/5.2.0/

/usr/local/cross/ppce500v2-bt-linux-gnuspe/usr/include/

接下来,我在 /home 中创建了包含以下内容的 user-config.jam:

 using gcc 
 : ppc 
 : /usr/local/cross/i686-bt-linux/usr/bin/powerpc-bt-linux-gnuspe/powerpc-bt-linux-gnuspe-g++ 
 : <compilerflags>-I/usr/local/cross/ppce500v2-bt-linux-gnuspe/usr/include/c++/5.2.0/powerpc-bt-linux-gnuspe -I/usr/local/cross/ppce500v2-bt-linux-gnuspe/usr/include/c++/5.2.0/ -I/usr/local/cross/ppce500v2-bt-linux-gnuspe/usr/include/    ;

然后我开始交叉编译

./b2 toolset=gcc-ppc --with-log

这是表明找不到文件/目录的输出:

Performing configuration checks
- 32-bit                   : yes (cached)
- arm                      : no  (cached)
- mips1                    : no  (cached)
- power                    : yes (cached)

Building the Boost C++ Libraries.
- symlinks supported       : yes (cached)
- compiler-supports-visibility : yes (cached)
- has_icu builds           : no  (cached)
- lockfree boost::atomic_flag : no  (cached)
Component configuration:

- atomic                   : not building
- chrono                   : not building
- container                : not building
- context                  : not building
- coroutine                : not building
- coroutine2               : not building
- date_time                : not building
- exception                : not building
- filesystem               : not building
- graph                    : not building
- graph_parallel           : not building
- iostreams                : not building
- locale                   : not building
- log                      : building
- math                     : not building
- metaparse                : not building
- mpi                      : not building
- program_options          : not building
- python                   : not building
- random                   : not building
- regex                    : not building
- serialization            : not building
- signals                  : not building
- system                   : not building
- test                     : not building
- thread                   : not building
- timer                    : not building
- type_erasure             : not building
- wave                     : not building
...patience...
...patience...
...patience...
...patience...
...found 4056 targets...
...updating 208 targets...
gcc.compile.c++ bin.v2/libs/atomic/build/gcc-ppc/release/threading- multi/lockpool.o
libs/atomic/src/lockpool.cpp:15:19: fatal error: cstddef: No such file or   directory
compilation terminated.

"/usr/local/cross/i686-bt-linux/usr/bin/powerpc-bt-linux-gnuspe/powerpc-bt-linux-gnuspe-g++"  -ftemplate-depth-128 -O3 -finline-functions -Wno-inline    -Wall -pthread -fPIC -m32  -DBOOST_ALL_NO_LIB=1 -DBOOST_ATOMIC_DYN_LINK=1   -DBOOST_ATOMIC_SOURCE -DNDEBUG  -I"." -c -o "bin.v2/libs/atomic/build/gcc-ppc   /release/threading-multi/lockpool.o" "libs/atomic/src/lockpool.cpp"

...failed gcc.compile.c++ bin.v2/libs/atomic/build/gcc-ppc/release/threading-  multi/lockpool.o...
...skipped <pbin.v2/libs/atomic/build/gcc-ppc/release/threading-  multi>libboost_atomic.so.1.61.0 for lack of <pbin.v2/libs/atomic/build/gcc-ppc  /release/threading-multi>lockpool.o...
...skipped <pstage/lib>libboost_atomic.so.1.61.0 for lack of <pbin.v2/libs /atomic/build/gcc-ppc/release/threading-multi>libboost_atomic.so.1.61.0...
...skipped <pstage/lib>libboost_atomic.so for lack of   <pstage/lib>libboost_atomic.so.1.61.0...
gcc.compile.c++ bin.v2/libs/date_time/build/gcc-ppc/release/threading-  multi/gregorian/greg_month.o
In file included from ./boost/date_time/gregorian/greg_month.hpp:12:0,
             from libs/date_time/src/gregorian/greg_month.cpp:14:
./boost/date_time/constrained_value.hpp:12:21: fatal error: exception: No    such file or directory
compilation terminated.

我在这里缺少什么?为什么我会收到这些“没有这样的文件或目录”错误?

最佳答案

首先,我会跑

./b2 --debug-configuration -n 

描述here .这应该允许您确认 b2 正在抓取正确的 jam 文件。它会在/home/user/中查找 user-config.jam,因此您可能需要将其移至该目录(如果该目录不存在)。

此外,我发现自己需要写出 <compileflag>-option1 <compileflag>-option2 etc...可能有一种方法可以传递一整串选项,但只是在单个 <compileflags> 之后将它们分开。似乎不起作用。

输出显示了运行的完整编译命令。您应该会看到您的编译标志显示在那里,并且可以使用它来验证您的 jam 文件语法是否正常工作。

在你上面的输出中,你可以看到你想要的包含没有出现

"/usr/local/cross/i686-bt-linux/usr/bin/powerpc-bt-linux-gnuspe/powerpc-bt-linux-gnuspe-g++"  -ftemplate-depth-128 -O3 -finline-functions -Wno-inline    -Wall -pthread -fPIC -m32  -DBOOST_ALL_NO_LIB=1 -DBOOST_ATOMIC_DYN_LINK=1   -DBOOST_ATOMIC_SOURCE -DNDEBUG  -I"." -c -o "bin.v2/libs/atomic/build/gcc-ppc   /release/threading-multi/lockpool.o" "libs/atomic/src/lockpool.cpp"

关于linux - 为 power-pc 交叉编译 boost 库失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43952456/

相关文章:

c++ - 与 hash_combine 发生太多冲突

php - CentOS Linux 控制台命令与 PHP exec(command)

linux - 为什么来自某些脚本(python、perl、libtool)的 shebang 和命令会被 bash 错误地解释?

linux - 限制 top 命令只在命令行显示前 X 个进程

linux - 如何在 bash 中的 ssh expect 脚本中自动执行 ctrl+d 操作?

c - 我应该如何为 gcc 的 -nostartfiles 或 -nostdlib 选项编写代码?

c - 编译C文件时出现Unsupported x86-64 instruction set错误

c++ - 在 Windows 上使用 Boost.Asio 的半并发 ICMP ping

python - 从哪里获得 boost/python.hpp?

c++ - 当我编译指令 __atomic_add_fetch 时到底发生了什么