在为 QNX 交叉编译后,boost 文件系统 (1.63) 因未定义的引用错误而失败

boost filesystem (1.63) fails with undefined reference error after cross compiling for QNX

我已经为 QNX 交叉编译了 boost,所有构建文件都存在于路径下 /home/hari1234/qnx_cross_compile/src/arm/boost_1_63_0/build/include 和 /home/hari1234/qnx_cross_compile/src/arm/boost_1_63_0/build/lib

我正在尝试从源代码编译 ROS 但它失败了

/opt/qnx/install/host/linux/x86_64/usr/bin/arm-unknown-nto-qnx7.0.0eabi-ld: warning: bin.v2/libs/system/build/qcc-arm/release/target-os-qnx/threading-multi/libboost_system.so.1.63.0, needed by /home/hari1234/qnx_cross_compile/src/arm/boost_1_63_0/build/lib/libboost_filesystem.so, not found (try using -rpath or -rpath-link) /opt/qnx/install/arm_catkin_ros/devel_isolated/rospack/lib/librospack.so: warning: The 'tmpnam' function is dangerous. Use 'mkstemp' instead. /opt/qnx/install/arm_catkin_ros/devel_isolated/rospack/lib/librospack.so: warning: The 'tempnam' function is dangerous. Use 'mkstemp' instead. /opt/qnx/install/host/linux/x86_64/usr/bin/arm-unknown-nto-qnx7.0.0eabi-ld: warning: bin.v2/libs/system/build/qcc-arm/release/target-os-qnx/threading-multi/libboost_system.so.1.63.0, needed by /home/hari1234/qnx_cross_compile/src/arm/boost_1_63_0/build/lib/libboost_filesystem.so, not found (try using -rpath or -rpath-link) /opt/qnx/install/arm_catkin_ros/devel_isolated/rospack/lib/librospack.so: undefined reference to boost::program_options::validate(boost::any&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, int)' /opt/qnx/install/arm_catkin_ros/devel_isolated/rospack/lib/librospack.so: undefined reference toboost::program_options::abstract_variables_map::operator[](std::__1::basic_string, std::__1::allocator > const&) const' /opt/qnx/install/arm_catkin_ros/devel_isolated/rospack/lib/librospack.so: undefined reference to boost::program_options::options_description::options_description(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned int, unsigned int)' /opt/qnx/install/arm_catkin_ros/devel_isolated/rospack/lib/librospack.so: undefined reference toboost::program_options::detail::cmdline::cmdline(std::__1::vector, std::__1::allocator >, std::__1::allocator, std::__1::allocator > > > const&)' /opt/qnx/install/arm_catkin_ros/devel_isolated/rospack/lib/librospack.so: undefined reference to boost::program_options::to_internal(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)' /opt/qnx/install/arm_catkin_ros/devel_isolated/rospack/lib/librospack.so: undefined reference toboost::program_options::arg' /opt/qnx/install/arm_catkin_ros/devel_isolated/rospack/lib/librospack.so: undefined reference to `boost::program_options::value_semantic_codecvt_helper::parse(boost::any&, std::__1::vector, std::__1::allocator >, std::__1::allocator, std::__1::allocator > > > const&, bool) const' cc: /opt/qnx/install/host/linux/x86_64/usr/bin/arm-unknown-nto-qnx7.0.0eabi-ld error 1 CMakeFiles/rospackexe.dir/build.make:106: recipe for target '/opt/qnx/install/arm_catkin_ros/devel_isolated/rospack/bin/rospack' failed

警告提示 libboost_filesystem.so 查找 bin.v2/libs/system/build/qcc-arm/release/target-os-qnx/threading-multi/libboost_system.so.1.63.0,但未找到。我不确定在为 QNX 交叉编译 boost 时是否会生成 bin.v2 文件夹。我认为这就是 boost::filesystem::validate 未定义引用错误发生的原因。

任何指点或帮助将不胜感激

提前致谢

我能够通过将 boost 库编译为静态库而不是动态库来解决这个问题。有人告诉我,最初的问题与设置 rpath

有关