[英]Cross Compile Boost library for PowerPC architecture
我正在尝试交叉编译PowerPC体系结构的Boost库(线程,系统)。 我按照以下步骤操作,但是遇到了问题。
我运行一个Shell脚本来设置我的工具链。 编译器ppc_4xx-g ++在外壳上可见。
遵循的步骤:
结果:创建了所有目录,但是编译失败。 我无法附加错误日志(请给我发送您的电子邮件,以便在需要时可以向您发送错误日志)。 下面是错误日志的快照。
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”。 但是然后我得到一个错误,即找不到目录/opt/ELDK/4.2/usr/include/c++/4.2.2中存在的文件cstddef。 我想我写了包含路径。
您认为是什么问题? 为什么编译器即使存在也找不到该文件? 有什么建议么 ?
更新:
我使用了-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个感兴趣的选项
--sysroot =:这是编译器使用的所有包含和库的根目录。
-B:使用它我们可以为编译器添加搜索路径。
我都尝试了两次,但没有帮助。 有什么建议么 ?
首先,Boost.Build并不是真正的问题。 这意味着通过执行最后一条命令(失败),在命令行上手动运行它,然后对其进行调整直到起作用,可以更轻松地修复它。
如前所述,您应该-I"/opt/ELDK/4.2/ppc_4xx/usr/include"
删除-I"/opt/ELDK/4.2/ppc_4xx/usr/include"
。
通常,编译器应自动找到其自己的头文件。 有两种可能的影响因素:
which ppc_4xx-g++
可以找出which ppc_4xx-g++
。 您还可以在编译器调用中添加-v
,以检查其正在搜索的目录。 作为最后的选择,您可以尝试--sysroot=/opt/ELDK/4.2/ppc_4xx/usr/bin
。
您的包含路径不正确,错误清楚地表明了这一点,因为每个工具链都有自己的路径,请确保将STL等的包含路径更新为指向新位置。 它应该可以解决您的问题!
问题是由于编译器中的错误。 它无法递归搜索目录以找到包含文件夹。 当我手动提供其他包含路径时,它拒绝了它,并指出了冗余的包含路径(因为它位于同一目录结构中)-使用-v选项找到了它。 然后,我创建了一个目录,创建了到包含必需包含文件的目录的软链接,并将此新目录包含在我的包含路径中(解决方法)。 这行得通,我可以生成库。
例如:包含文件存在于目录abc / include / xyz / include中,编译器不接受,因为我已经指定了路径abc / include。 因此,我创建了目录别名并将其链接到abc / include / xyz / include。 然后,我将./alias包含为包含路径之一,并且可以正常工作。 我认为这是一个已知的编译器问题,在以后的版本中已修复
PS:这个想法不是我的,但在网上找到了类似的帖子对我有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.