代码之家  ›  专栏  ›  技术社区  ›  Stoogy

colcon找不到第三方库(Poco)

  •  0
  • Stoogy  · 技术社区  · 7 年前

    我试图交叉编译Arm的ROS2。我正在执行的步骤可以在此处找到: https://github.com/ros2-for-arm/ros2/wiki/ROS2-on-arm-architecture

    使用的build命令是 colcon build --symlink-install --cmake-force-configure --cmake-args -DCMAKE_TOOLCHAIN_FILE=aarch64_toolchainfile.cmake -DTHIRDPARTY=ON -DBUILD_TESTING:BOOL=OFF

    无法找到poco库,但它位于“ /work/ROS2_Bouncy/ros2_ws/install/poco_vendor/lib/libPocoFoundation.so.50 “这是正确的交叉编译:

    /work/ROS2_Bouncy/ros2_ws/install/poco_vendor/lib/libPocoFoundation.so.50: ELF 64-bit LSB shared object, ARM aarch64, version 1 (GNU/Linux), dynamically linked, BuildID[sha1]=6ba44c72e2162ca056b0dbde681dd4a8b5da5e35, not stripped
    

    我想知道在哪里可以修改CMake脚本来指定第三方库的路径。我试图手动指定Poco的路径,但没有成功:

    add_library(Poco_import SHARED IMPORTED)
    set_target_properties(Poco_import PROPERTIES
        IMPORTED_LOCATION "/work/ROS2_Bouncy/ros2_ws/install/poco_vendor/lib/libPocoFoundation.so.50"
    )
    

    我还尝试在 CMAKE_EXE_LINKER_FLAGS (-L)但没有成功。

    一切看起来都被正确地编译了,但是我在链接阶段出错了:

    Failed   <<< examples_rclcpp_minimal_publisher  [ Exited with code 2 ]
    --- stderr: examples_rclcpp_minimal_timer
    /work/Documents/aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/6.1.1/../../../../aarch64-linux-gnu/bin/ld: warning: libPocoFoundation.so.50, needed by /work/ROS2_Bouncy/ros2_ws/install/rosidl_typesupport_cpp/lib/librosidl_typesupport_cpp.so, not found (try using -rpath or -rpath-link)
    /work/Documents/aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/6.1.1/../../../../aarch64-linux-gnu/bin/ld: warning: libyaml.so, needed by /work/ROS2_Bouncy/ros2_ws/install/rcl_yaml_param_parser/lib/librcl_yaml_param_parser.so, not found (try using -rpath or -rpath-link)
    /work/ROS2_Bouncy/ros2_ws/install/rcl_yaml_param_parser/lib/librcl_yaml_param_parser.so: undefined reference to `yaml_event_delete'
    /work/ROS2_Bouncy/ros2_ws/install/rcl_yaml_param_parser/lib/librcl_yaml_param_parser.so: undefined reference to `yaml_parser_parse'
    /work/ROS2_Bouncy/ros2_ws/install/rosidl_typesupport_cpp/lib/librosidl_typesupport_cpp.so: undefined reference to `Poco::SharedLibrary::getSymbol(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
    /work/ROS2_Bouncy/ros2_ws/install/rcl_yaml_param_parser/lib/librcl_yaml_param_parser.so: undefined reference to `yaml_parser_delete'
    /work/ROS2_Bouncy/ros2_ws/install/rcl_yaml_param_parser/lib/librcl_yaml_param_parser.so: undefined reference to `yaml_parser_initialize'
    /work/ROS2_Bouncy/ros2_ws/install/rosidl_typesupport_cpp/lib/librosidl_typesupport_cpp.so: undefined reference to `Poco::SharedLibrary::hasSymbol(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
    /work/ROS2_Bouncy/ros2_ws/install/rosidl_typesupport_cpp/lib/librosidl_typesupport_cpp.so: undefined reference to `Poco::SharedLibrary::SharedLibrary(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
    /work/ROS2_Bouncy/ros2_ws/install/rcl_yaml_param_parser/lib/librcl_yaml_param_parser.so: undefined reference to `yaml_parser_set_input_file'
    collect2: error: ld returned 1 exit status
    gmake[2]: *** [timer_lambda] Error 1
    gmake[1]: *** [CMakeFiles/timer_lambda.dir/all] Error 2
    gmake[1]: *** Waiting for unfinished jobs....
    /work/Documents/aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/6.1.1/../../../../aarch64-linux-gnu/bin/ld: warning: libPocoFoundation.so.50, needed by /work/ROS2_Bouncy/ros2_ws/install/rosidl_typesupport_cpp/lib/librosidl_typesupport_cpp.so, not found (try using -rpath or -rpath-link)
    /work/Documents/aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/6.1.1/../../../../aarch64-linux-gnu/bin/ld: warning: libyaml.so, needed by /work/ROS2_Bouncy/ros2_ws/install/rcl_yaml_param_parser/lib/librcl_yaml_param_parser.so, not found (try using -rpath or -rpath-link)
    /work/ROS2_Bouncy/ros2_ws/install/rcl_yaml_param_parser/lib/librcl_yaml_param_parser.so: undefined reference to `yaml_event_delete'
    /work/ROS2_Bouncy/ros2_ws/install/rcl_yaml_param_parser/lib/librcl_yaml_param_parser.so: undefined reference to `yaml_parser_parse'
    /work/ROS2_Bouncy/ros2_ws/install/rosidl_typesupport_cpp/lib/librosidl_typesupport_cpp.so: undefined reference to `Poco::SharedLibrary::getSymbol(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
    /work/ROS2_Bouncy/ros2_ws/install/rcl_yaml_param_parser/lib/librcl_yaml_param_parser.so: undefined reference to `yaml_parser_delete'
    /work/ROS2_Bouncy/ros2_ws/install/rcl_yaml_param_parser/lib/librcl_yaml_param_parser.so: undefined reference to `yaml_parser_initialize'
    /work/ROS2_Bouncy/ros2_ws/install/rosidl_typesupport_cpp/lib/librosidl_typesupport_cpp.so: undefined reference to `Poco::SharedLibrary::hasSymbol(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
    /work/ROS2_Bouncy/ros2_ws/install/rosidl_typesupport_cpp/lib/librosidl_typesupport_cpp.so: undefined reference to `Poco::SharedLibrary::SharedLibrary(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
    /work/ROS2_Bouncy/ros2_ws/install/rcl_yaml_param_parser/lib/librcl_yaml_param_parser.so: undefined reference to `yaml_parser_set_input_file'
    collect2: error: ld returned 1 exit status
    gmake[2]: *** [timer_member_function] Error 1
    gmake[1]: *** [CMakeFiles/timer_member_function.dir/all] Error 2
    gmake: *** [all] Error 2
    
    1 回复  |  直到 7 年前
        1
  •  0
  •   Stoogy    7 年前

    感谢茨瓦雷夫指着我正确的旗帜。 我在工具链文件中添加了以下内容,它解决了这个问题。

    set(PATH_POCO_LIB "${CMAKE_CURRENT_LIST_DIR}/build/poco_vendor/poco_external_project_install/lib/")
    set(PATH_YAML_LIB "${CMAKE_CURRENT_LIST_DIR}/build/libyaml_vendor/libyaml_install/lib/")
    set(CMAKE_BUILD_RPATH "${PATH_POCO_LIB};${PATH_YAML_LIB}")
    
    推荐文章