问题描述
我试图交叉编译Boost库(线程,系统)为PowerPC架构。我也跟着下面的步骤,但面临的问题。
I am trying to cross compile Boost library (Thread, System) for PowerPC architecture. I followed the below steps but facing problems.
我运行一个shell脚本设置我的工具链。编译器ppc_4xx-G ++是可见的外壳。
I run a shell script which sets up my toolchain. The compiler ppc_4xx-g++ is visible at the shell.
步骤如下:
- 添加行使用gcc:功率:ppc_4xx-G ++;该文件的用户config.jam中
- 运行./bootstrap.sh - preFIX = BoostPowerPC根目录 。
- 运行./b2安装--build-DIR = BoostPowerPC工具= GCC-功率--with线程--with系统级
结果:所有的目录被创建,但编译失败。我不能附加的错误日志(请给我您的电子邮件,这样如果你需要我可以给你错误日志)。下面是错误日志的快照。
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:
.
.
.
其抱怨文件c ++ config.h中是找不到的。但是,该文件中的位置/opt/ELDK/4.2/usr/include/c++/4.2.2/powerpc-linux/bits目录present
Its complaining that the file c++config.h is not found. But the file is present in the location /opt/ELDK/4.2/usr/include/c++/4.2.2/powerpc-linux/bits directory
然后我试图在B2命令使用标签包含。但后来我得到一个错误,该文件cstddef找不到这是在目录/opt/ELDK/4.2/usr/include/c++/4.2.2 present。我想我在写包含路径。
Then I tried to use the tag "include" in the b2 command. 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. I think I am over writing the include path.
你认为这是什么问题?为什么我的编译器找到该文件,即使其present?有什么建议?
What do you think is the problem ? Why can't my compiler find the file even if its present ? Any suggestions ?
更新:
我用-d + 2和-q选项及以下是结果。
I used -d+2 and -q options and below is the result.
"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命令尝试和指定的根目录。它仍然没有帮助。
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. It still didn't help.
我检查的ppc_4xx-G ++编译选项和2个选项我感兴趣
I checked the compilation options of ppc_4xx-g++ and 2 options interested me
-
- SYSROOT =:这是根目录下的所有包括与编译器使用库
--sysroot=: This is the root directory of all the includes and libraries used by the compiler.
-B:使用此我们可以添加一个搜索路径编译器
-B : Using this we can add a search path for the compiler.
我都尝试,它并没有帮助。有什么建议?
I tried both and it didn't help. Any suggestions ?
推荐答案
问题是因为在编译器中的错误。它不能递归搜索目录以查找包含的文件夹。当我手动提供的附加包含路径,它拒绝了它,说明冗余包含路径(因为它是在相同的目录结构) - 使用-v选项找到这一点。然后,我创建了一个目录,建立了一个软链接到有必要的目录包括文件,包括这个新的目录在我的include路径(解决方法)。这个工作我可以生成库。
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. 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.
如:包含文件是目录中的ABC / present包括/ XYZ /包括编译器不接受,因为我已经指定的路径ABC /包括。因此,我创建了一个目录别名和链接它ABC /有/ XYZ /包括。然后我包括./alias作为包含路径之一,它的工作。这是固定在以后的版本一个已知的编译器的问题,我认为在4.6
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. Hence I created a directory alias and linked it to abc/include/xyz/include. Then I included ./alias as one of the include paths and it worked. This was a known compiler issue which is fixed in later versions, I think in 4.6
PS:这个想法是不是我的,但发现了一个类似的帖子在网上这让我
PS: The idea was not mine but found a similar post online which helped me.
这篇关于交叉编译Boost库为PowerPC架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!