2013-02-20 134 views
0

我想交叉编译PowerPC架构的Boost库(线程,系统)。我遵循下面的步骤,但面临问题。PowerPC架构的交叉编译Boost库

我运行一个shell脚本来设置我的工具链。编译器ppc_4xx-g ++在shell中可见。

步骤如下:

  1. 添加行 “用gcc:功率:ppc_4xx-G ++;”到文件user-config.jam
  2. 在根目录下运行./bootstrap.sh --prefix = BoostPowerPC。
  3. 运行./b2安装--build-DIR = BoostPowerPC工具包= GCC-功率--with线程--with系统级

结果:所有的目录被创建,但编译失败。我无法附上错误日志(请将您的电子邮件发送给我,以便我可以根据需要向您发送错误日志)。以下是错误日志的快照。

Component configuration: 

- atomic     : not building 
- chrono     : not building 
- context     : 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 
- math      : 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     : building 
- test      : not building 
- thread     : building 
- timer     : not building 
- wave      : not building 

...patience... 
...found 20376 targets... 
...updating 10110 targets... 
common.mkdir BoostPowerPC 
common.mkdir BoostPowerPC/lib 
common.mkdir BoostPowerPC/boost 
common.mkdir BoostPowerPC/boost/bin.v2 
common.mkdir BoostPowerPC/boost/bin.v2/libs 
common.mkdir BoostPowerPC/boost/bin.v2/libs/system 
common.mkdir BoostPowerPC/boost/bin.v2/libs/system/build 
common.mkdir BoostPowerPC/boost/bin.v2/libs/system/build/gcc-power 
common.mkdir BoostPowerPC/boost/bin.v2/libs/system/build/gcc-power/release 
common.mkdir BoostPowerPC/boost/bin.v2/libs/system/build/gcc-power/release/threading-multi 
gcc.compile.c++ BoostPowerPC/boost/bin.v2/libs/system/build/gcc-power/release/threading-multi/error_code.o 
In file included from ./boost/config/select_stdlib_config.hpp:18, 
      from ./boost/config.hpp:40, 
      from ./boost/system/config.hpp:13, 
      from libs/system/src/error_code.cpp:18: 
/opt/ELDK/4.2/ppc_4xx/usr/include/c++/4.2.2/cstddef:50:28: error: bits/c++config.h: No such file or directory 
In file included from /opt/ELDK/4.2/ppc_4xx/usr/include/c++/4.2.2/ios:43, 
      from /opt/ELDK/4.2/ppc_4xx/usr/include/c++/4.2.2/ostream:45, 
      from /opt/ELDK/4.2/ppc_4xx/usr/include/c++/4.2.2/iterator:70, 
      from ./boost/iterator.hpp:17, 
      from ./boost/operators.hpp:86, 
      from ./boost/system/error_code.hpp:17, 
      from libs/system/src/error_code.cpp:19: 
. 
. 
. 

它抱怨找不到文件C++ config.h。但该文件存在于/opt/ELDK/4.2/usr/include/c++/4.2.2/powerpc-linux/bits目录中

然后我尝试在b2命令中使用标记“include”。但是后来我得到一个错误,即文件cstddef没有找到,它出现在目录/opt/ELDK/4.2/usr/include/c++/4.2.2中。我认为我已经写完了包含路径。

您认为是什么问题?为什么我的编译器找不到该文件,即使它存在?有什么建议么 ?

更新:

我用-d + 2和-q选项和下面是结果。

"ppc_4xx-g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -pedantic -pthread -fPIC -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_DYN_LINK=1 -DNDEBUG -I"." -I"/opt/ELDK/4.2/ppc_4xx/usr/include" -c -o "BoostPowerPC/boost/bin.v2/libs/system/build/gcc-power/release/threading-multi/error_code.o" "libs/system/src/error_code.cpp" 

编译日志:

In file included from ./boost/config/select_stdlib_config.hpp:18, 
      from ./boost/config.hpp:40, 
      from ./boost/system/config.hpp:13, 
      from libs/system/src/error_code.cpp:18: 
/opt/ELDK/4.2/ppc_4xx/usr/include/c++/4.2.2/cstddef:50:28: error: bits/c++config.h: No such file or directory 

正如我们可以看到包括在内,可见的编译器,具有所需的文件更高的目录。我甚至尝试使用-L命令并指定根目录。它仍然没有帮助。

我检查的ppc_4xx-g ++以及2个选项编译选项我感兴趣

  1. --sysroot =:这是所有包含和由编译器使用的库的根目录。

  2. -B:使用这个我们可以为编译器添加一个搜索路径。

我试过了,它没有帮助。有什么建议么 ?

回答

0

问题出在编译器中的一个错误。它无法递归搜索目录以查找包含文件夹。当我手动提供额外的包含路径时,它拒绝它说明多余的包含路径(因为它位于相同的目录结构中) - 通过使用-v选项找到了此路径。然后我创建了一个目录,创建了一个到具有必要包含文件的目录的软链接,并将此新目录包含在我的包含路径中(解决方法)。这工作,我可以生成库。例如:包含文件存在于abc/include/xyz/include目录中,编译器不接受,因为我已经指定了路径abc/include。因此,我创建了一个目录别名并将其链接到abc/include/xyz/include。然后,我将./alias作为包含路径之一,并且工作正常。这是一个已知的编译器问题,它在后来的版本中得到修复,我认为在4.6

PS:这个想法不是我的,但发现了一个类似的帖子在线帮助我。

+0

你有指向有问题的错误的指针吗? – 2013-02-23 11:51:51

+0

@VladimirPrus:我没有指向错误的指针,但是我从这个[post]中找到了解决方案(http://stackoverflow.com/questions/4643197/missing-include-bits-cconfig-h-when-交叉编译-64位程序-32位) – Neo 2013-02-23 19:41:00

+0

谢谢。看起来像Ubuntu特定的错误。 – 2013-02-24 05:33:33

0

您的包含路径不正确,并且错误清楚地表明了这一点,因为每个工具链都有自己的路径,请确保STL等包含路径更新为指向新位置。它应该解决你的问题!

+0

我发现我的问题的解决方案,检查解决方案。谢谢你的帮助。 – Neo 2013-02-23 08:18:54

1

首先,这不是Boost.Build的问题。这意味着通过执行最后一条命令(失败)可以更容易地修复它,在命令行上手动运行它,然后调整它直到它工作。

如前所述,您应该从命令行中删除-I"/opt/ELDK/4.2/ppc_4xx/usr/include"

通常,编译器应自动查找自己的头文件。两种可能的情况会干扰:

  1. 您正在从不同于实际安装编译器头文件的位置运行ppc_4xx-g ++。用which ppc_4xx-g++搞清楚。您还可以将-v添加到编译器调用中,以检查它正在搜索哪些目录。
  2. 编译器以未知方式未正确构建。迂回地说,'ppc_4xx'甚至不是有效的目标三元组,但我不知道这是否会按照你所描述的方式破坏编译。

作为最后的手段,你可以尝试--sysroot=/opt/ELDK/4.2/ppc_4xx/usr/bin

+0

感谢您的意见,正如您所提到的那样,它不是Boost的问题,我找到了问题并发布了答案。 – Neo 2013-02-23 08:18:04