简体   繁体   English

用于PowerPC架构的交叉编译Boost库

[英]Cross Compile Boost library for PowerPC architecture

I am trying to cross compile Boost library (Thread, System) for PowerPC architecture. 我正在尝试交叉编译PowerPC体系结构的Boost库(线程,系统)。 I followed the below steps but facing problems. 我按照以下步骤操作,但是遇到了问题。

I run a shell script which sets up my toolchain. 我运行一个Shell脚本来设置我的工具链。 The compiler ppc_4xx-g++ is visible at the shell. 编译器ppc_4xx-g ++在外壳上可见。

Steps followed: 遵循的步骤:

  1. Add the line "using gcc : power : ppc_4xx-g++ ;" 添加行“使用gcc:power:ppc_4xx-g ++;” to the file user-config.jam 到文件user-config.jam
  2. Run ./bootstrap.sh --prefix=BoostPowerPC in root directory. 在根目录中运行./bootstrap.sh --prefix = BoostPowerPC。
  3. Run ./b2 install --build-dir=BoostPowerPC toolset=gcc-power --with-thread --with-system stage 运行./b2 install --build-dir = BoostPowerPC toolset = gcc-power --with-thread --with-system阶段

Result: All the directories gets created but compilation fails. 结果:创建了所有目录,但是编译失败。 I can't attach the error log (Please send me your email so that I can send you the error log if you need). 我无法附加错误日志(请给我发送您的电子邮件,以便在需要时可以向您发送错误日志)。 Below is the snapshot of the error log. 下面是错误日志的快照。

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:
.
.
.

Its complaining that the file c++config.h is not found. 它抱怨找不到文件c ++ config.h。 But the file is present in the location /opt/ELDK/4.2/usr/include/c++/4.2.2/powerpc-linux/bits directory 但是该文件位于/opt/ELDK/4.2/usr/include/c++/4.2.2/powerpc-linux/bits目录中

Then I tried to use the tag "include" in the b2 command. 然后,我尝试在b2命令中使用标签“ include”。 But then I get a error that the file cstddef is not found which is present in the directory /opt/ELDK/4.2/usr/include/c++/4.2.2. 但是然后我得到一个错误,即找不到目录/opt/ELDK/4.2/usr/include/c++/4.2.2中存在的文件cstddef。 I think I am over writing the include path. 我想我写了包含路径。

What do you think is the problem ? 您认为是什么问题? Why can't my compiler find the file even if its present ? 为什么编译器即使存在也找不到该文件? Any suggestions ? 有什么建议么 ?

Update: 更新:

I used -d+2 and -q options and below is the result. 我使用了-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"

Compilation log: 编译日志:

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

As we can see the the higher directory which has the required file is included and visible to the compiler. 如我们所见,包含所需文件的上级目录已包括在内,并且对编译器可见。 I even tried using -L command and specify the root directory. 我什至尝试使用-L命令并指定根目录。 It still didn't help. 它仍然没有帮助。

I checked the compilation options of ppc_4xx-g++ and 2 options interested me 我检查了ppc_4xx-g ++的编译选项和2个感兴趣的选项

  1. --sysroot=: This is the root directory of all the includes and libraries used by the compiler. --sysroot =:这是编译器使用的所有包含和库的根目录。

  2. -B : Using this we can add a search path for the compiler. -B:使用它我们可以为编译器添加搜索路径。

I tried both and it didn't help. 我都尝试了两次,但没有帮助。 Any suggestions ? 有什么建议么 ?

First of all, this is not really a problem with Boost.Build. 首先,Boost.Build并不是真正的问题。 Which means that it will be easier to fix it by taking your last command (which fails), running it by hand on the command-line, and then adjusting it until it works. 这意味着通过执行最后一条命令(失败),在命令行上手动运行它,然后对其进行调整直到起作用,可以更轻松地修复它。

As said already, you should then remove -I"/opt/ELDK/4.2/ppc_4xx/usr/include" from your command line. 如前所述,您应该-I"/opt/ELDK/4.2/ppc_4xx/usr/include"删除-I"/opt/ELDK/4.2/ppc_4xx/usr/include"

Normally, the compiler should find its own header files automatically. 通常,编译器应自动找到其自己的头文件。 Two possible things can interfere with that: 有两种可能的影响因素:

  1. You are running ppc_4xx-g++ from a different place from where compiler headers are actually installed. 您正在从实际安装编译器头文件的其他位置运行ppc_4xx-g ++。 Using which ppc_4xx-g++ do find out. 使用which ppc_4xx-g++可以找出which ppc_4xx-g++ You can also add -v to compiler invocation to check which directories it is searching in. 您还可以在编译器调用中添加-v ,以检查其正在搜索的目录。
  2. The compiler is improperly built in unknown ways. 编译器的构建方式不正确。 Pedantically speaking, 'ppc_4xx' is not even valid target triplet, but I don't know whether that would break compilation in the way you have described. 从脚步上讲,“ ppc_4xx”甚至不是有效的目标三元组,但我不知道这是否会破坏您所描述的编译方式。

As the last resort, you can try --sysroot=/opt/ELDK/4.2/ppc_4xx/usr/bin . 作为最后的选择,您可以尝试--sysroot=/opt/ELDK/4.2/ppc_4xx/usr/bin

Your include paths are not correct, and error clearly denotes this, as each toolchain got its own path, make sure your include path for STL etc are updated to point to new location. 您的包含路径不正确,错误清楚地表明了这一点,因为每个工具链都有自己的路径,请确保将STL等的包含路径更新为指向新位置。 It should solve your problem! 它应该可以解决您的问题!

The problem was because of a bug in the compiler. 问题是由于编译器中的错误。 It couldn't recursively search for directories to find the include folders. 它无法递归搜索目录以找到包含文件夹。 When I manually provided the additional include path, it rejected it stating redundant include path (since it was in the same directory structure) - Found this by using -v option. 当我手动提供其他包含路径时,它拒绝了它,并指出了冗余的包含路径(因为它位于同一目录结构中)-使用-v选项找到了它。 Then I created a directory, created a soft link to the directory which had the necessary include files and included this new directory in my include path (Workaround). 然后,我创建了一个目录,创建了到包含必需包含文件的目录的软链接,并将此新目录包含在我的包含路径中(解决方法)。 This worked and I could generate the libraries. 这行得通,我可以生成库。

Eg: The include files were present in the directory abc/include/xyz/include which the compiler was not accepting as I had already specified the path abc/include. 例如:包含文件存在于目录abc / include / xyz / include中,编译器不接受,因为我已经指定了路径abc / include。 Hence I created a directory alias and linked it to abc/include/xyz/include. 因此,我创建了目录别名并将其链接到abc / include / xyz / include。 Then I included ./alias as one of the include paths and it worked. 然后,我将./alias包含为包含路径之一,并且可以正常工作。 This was a known compiler issue which is fixed in later versions, I think in 4.6 我认为这是一个已知的编译器问题,在以后的版本中已修复

PS: The idea was not mine but found a similar post online which helped me. PS:这个想法不是我的,但在网上找到了类似的帖子对我有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM