在PC机ubuntu16.04系统下为树莓派4B交叉编译ROS应用程序包整到绝望-菜鸟的几天奋战经历

ROS从入门到精通系列(五)catkin详解与catkin_make编译 介绍catkin的编译系统,catkin工作空间的创建和结构,package软件包的创建和结构,介绍CMakeLists.txt文件,package.xml以及其他常见文件。从而系统的梳理了ROS文件空间的结构,对于我们ROS学习和开发有着重要的作用。 阅读详情

参考文献:
[1] https://medium.com/@tahsincankose/cross-compiling-ros-project-for-arm-263642b405ac

宿主机平台:虚拟机ubuntu16.04LTS系统
目标运行平台:树莓派4B
目标平台系统:Raspbian Buster with desktop and recommended software
采用的方法:

  1. 在树莓派平台上编译好ROS kinetic,并拷贝到PC ubuntu16下面(/home/liqiang/work/linux/raspberrypi/lib/);
  2. 拷贝树莓派系统下的/usr和/lib两个目录拷贝到PC ubuntu16下面(/home/liqiang/work/linux/raspberrypi/lib/);
  3. 可以查看ROS kinetic的share目录下的cmake的find_package命令所需的配置文件中的内容,比如cv_bridgeConfig.cmake,其中有:
`set(libraries "cv_bridge;/usr/local/lib/libopencv_core.so.3.4.3;/usr/local/lib/libopencv_imgproc.so.3.4.3;/usr/local/lib/libopencv_imgcodecs.so.3.4.3")`

可以看到,其连接的共享库都指向本地目录这都是PC环境下运行的共享库,我们需要替换其中的内容;
4. 修改kinect下所有文件中跟PC环境库和头文件相关的位置到从树莓派4b拷贝过来的目录对应位置:其中(以下指令均在kinect目录下执行)

find . -type f  | xargs sed -i 's#/opt/ros/kinetic#${CMAKE_CROSS_COMPILE_PREFIX}#g'

find . -type f  | xargs sed -i 's#/usr/lib#${CMAKE_CROSS_COMPILE_PREFIX}/usr/lib#g'
`
find . -type f  | xargs sed -i 's#/usr/local/lib#${CMAKE_CROSS_COMPILE_PREFIX}/usr/local/lib#g'

find . -type f  | xargs sed -i 's#/usr/local/include#${CMAKE_CROSS_COMPILE_PREFIX}/usr/local/include#g'

find . -type f  | xargs sed -i 's#/usr/include#${CMAKE_CROSS_COMPILE_PREFIX}/usr/include#g'
  1. 配置好交叉编译环境,这里下载自:https://github.com/raspberrypi/tools,使用的是gcc-linaro-arm-linux-gnueabihf-raspbian-x64 (大坑)
  2. 编写rostoolchain.cmake文件,其内容为,详见参考文献1,
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)

set(CMAKE_LIBRARY_ARCHITECTURE arm-linux-gnueabihf)

set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)


SET(RASPBERRY_ROOT_PATH /home/liqiang/work/linux/raspberrypi/lib)
SET(RASPBERRY_KINETIC_PATH ${RASPBERRY_ROOT_PATH}/opt/ros/kinetic)

SET(CMAKE_FIND_ROOT_PATH ${RASPBERRY_ROOT_PATH} ${CATKIN_DEVEL_PREFIX})

SET(CMAKE_PREFIX_PATH ${RASPBERRY_KINETIC_PATH} ${RASPBERRY_ROOT_PATH}/usr)

# Have to set this one to BOTH, to allow CMake to find rospack
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)


#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --sysroot=${RASPBERRY_ROOT_PATH}" CACHE INTERNAL "" FORCE)
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --sysroot=${RASPBERRY_ROOT_PATH}" CACHE INTERNAL "" FORCE)
#SET(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} --sysroot=${RASPBERRY_ROOT_PATH}" CACHE INTERNAL "" FORCE)
#SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} --sysroot=${RASPBERRY_ROOT_PATH}" CACHE INTERNAL "" FORCE)

SET(LD_LIBRARY_PATH ${RASPBERRY_KINETIC_PATH}/lib)

include_directories(/home/liqiang/work/linux/raspberrypi/lib/usr/include/arm-linux-gnueabihf)
set(CMAKE_CROSS_COMPILE_PREFIX /home/liqiang/work/linux/raspberrypi/lib)
LINK_DIRECTORIES(${CMAKE_CROSS_COMPILE_PREFIX}/lib/arm-linux-gnueabihf)

  1. 在catkin工程目录下运行以下指令,进行编译
catkin_make -DCMAKE_TOOLCHAIN_FILE=/home/liqiang/work/mobileRobot/rostoolchain.cmake

备注:得到这样的结果已经奋战了好几天了,离成功不远了。

解决试探:
可以看到库有问题,但究竟谁的库有问题了(交叉编译器的自带的库还是从目标机器拷贝的库),标准c:库交叉编译器自带的为libc-2.13.so,而树莓派的库为libc-2.28.so,标准C++库:通过执行以下指令:

readelf -a libstdc++.so | grep 3.4

比较得知,交叉编译器的c++库只支持到GLIBCXX_3.4.19,而树莓派系统自带的库支持到GLIBCXX_3.4.25,故编译器的库版本较低。从编译错误看出,需要支持到GLIBCXX_3.4.21。
决定用树莓派的库替换交叉编译器的库,结果是连编译都无法完成了,不是连接错误。
看来需要更高版本的交叉编译器了,查看编译器的版本:

arm-linux-gnueabihf-gcc -v

树莓派:gcc version 8.3.0 (Raspbian 8.3.0-6+rpi1)
交叉编译器: gcc version 4.8.3 20140303 (prerelease) (crosstool-NG linaro-1.13.1+bzr2650 - Linaro GCC 2014.03)

可以看出,交叉编译器的版本很低,进而需要寻找更高版本的交叉编译器,在错误编译结果之后给出寻找正确交叉编译器的过程:

错误编译结果:
[ 66%] Building CXX object robot_base/bin/CMakeFiles/robot_base.dir/src/Communication.cpp.o
[ 66%] Building CXX object robot_base/bin/CMakeFiles/robot_base.dir/src/main.cpp.o
[100%] Linking CXX executable robot_base
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/libcrypt.so.1: undefined reference to `__open_nocancel@GLIBC_PRIVATE'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf.so: undefined reference to `VTT for std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/liblog4cxx.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_M_replace_aux(unsigned int, unsigned int, unsigned int, wchar_t)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libroscpp.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_mutate(unsigned int, unsigned int, char const*, unsigned int)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libroscpp.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find(char const*, unsigned int, unsigned int) const@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libroscpp.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::rfind(char, unsigned int) const@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find(char, unsigned int) const@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/local/lib/libboost_regex.so: undefined reference to `bool std::has_facet<std::__cxx11::messages<char> >(std::locale const&)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append(char const*, unsigned int)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/liblog4cxx.so: undefined reference to `VTT for std::__cxx11::basic_stringstream<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/local/lib/libboost_regex.so: undefined reference to `bool std::has_facet<std::__cxx11::messages<wchar_t> >(std::locale const&)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/liblog4cxx.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_M_append(wchar_t const*, unsigned int)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf2_ros.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/libuuid.so.1: undefined reference to `fcntl64@GLIBC_2.28'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf2_ros.so: undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream(std::_Ios_Openmode)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/liblog4cxx.so: undefined reference to `std::__cxx11::basic_stringbuf<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_M_sync(wchar_t*, unsigned int, unsigned int)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/libcrypt.so.1: undefined reference to `__read_nocancel@GLIBC_PRIVATE'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::reserve(unsigned int)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/liblog4cxx.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::rfind(char const*, unsigned int, unsigned int) const@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf.so: undefined reference to `std::runtime_error::runtime_error(char const*)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/librt.so.1: undefined reference to `__close_nocancel@GLIBC_PRIVATE'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/libapr-1.so.0: undefined reference to `__fdelt_chk@GLIBC_2.15'
/home/liqiang/work/linux/raspberrypi/lib/usr/local/lib/libboost_filesystem.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_M_replace(unsigned int, unsigned int, wchar_t const*, unsigned int)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf.so: undefined reference to `vtable for std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/librosconsole.so: undefined reference to `std::logic_error::logic_error(char const*)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf.so: undefined reference to `std::runtime_error::runtime_error(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libroscpp.so: undefined reference to `typeinfo for std::ios_base::failure[abi:cxx11]@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf2_ros.so: undefined reference to `operator delete(void*, unsigned int)@CXXABI_1.3.9'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/liblog4cxx.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_M_create(unsigned int&, unsigned int)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libroscpp.so: undefined reference to `std::__cxx11::numpunct<char> const& std::use_facet<std::__cxx11::numpunct<char> >(std::locale const&)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::resize(unsigned int, char)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/librt.so.1: undefined reference to `__recv@GLIBC_PRIVATE'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/librt.so.1: undefined reference to `__clock_getres@GLIBC_PRIVATE'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_erase(unsigned int, unsigned int)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/local/lib/libboost_regex.so: undefined reference to `std::invalid_argument::invalid_argument(char const*)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/local/lib/libboost_regex.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::operator=(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&&)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/libdl.so.2: undefined reference to `_dl_catch_error@GLIBC_PRIVATE'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libroscpp.so: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)@GLIBCXX_3.4.20'
/home/liqiang/work/linux/raspberrypi/lib/usr/local/lib/libboost_regex.so: undefined reference to `std::out_of_range::out_of_range(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/librt.so.1: undefined reference to `__shm_directory@GLIBC_PRIVATE'
/home/liqiang/work/linux/raspberrypi/lib/usr/local/lib/libboost_filesystem.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find_last_of(char const*, unsigned int, unsigned int) const@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/librt.so.1: undefined reference to `__pthread_barrier_wait@GLIBC_PRIVATE'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace_aux(unsigned int, unsigned int, unsigned int, char)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace(unsigned int, unsigned int, char const*, unsigned int)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf2_ros.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/liblog4cxx.so: undefined reference to `std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::_M_sync(char*, unsigned int, unsigned int)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf.so: undefined reference to `std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_stringstream()@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf2_ros.so: undefined reference to `std::runtime_error::runtime_error(char const*)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libroscpp.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find_first_of(char const*, unsigned int, unsigned int) const@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/liblog4cxx.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct(unsigned int, char)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libroscpp.so: undefined reference to `fcntl@GLIBC_2.28'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/liblog4cxx.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(unsigned int, unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf2_ros.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign(char const*)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf2_ros.so: undefined reference to `std::logic_error::logic_error(std::logic_error const&)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/local/lib/libboost_filesystem.so: undefined reference to `__cxa_throw_bad_array_new_length@CXXABI_1.3.8'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/librt.so.1: undefined reference to `__pthread_get_minstack@GLIBC_PRIVATE'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf.so: undefined reference to `vtable for std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/local/lib/libboost_regex.so: undefined reference to `std::overflow_error::overflow_error(char const*)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/local/lib/libboost_regex.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::compare(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&) const@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf.so: undefined reference to `vtable for std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/libdl.so.2: undefined reference to `_dl_signal_error@GLIBC_PRIVATE'
/home/liqiang/work/linux/raspberrypi/lib/usr/local/lib/libboost_regex.so: undefined reference to `std::__cxx11::collate<char> const& std::use_facet<std::__cxx11::collate<char> >(std::locale const&)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/local/lib/libboost_regex.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_M_construct(unsigned int, wchar_t)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf.so: undefined reference to `std::runtime_error::runtime_error(std::runtime_error const&)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/liblog4cxx.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::insert(unsigned int, char const*)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/libuuid.so.1: undefined reference to `getrandom@GLIBC_2.25'
/home/liqiang/work/linux/raspberrypi/lib/usr/local/lib/libboost_thread.so: undefined reference to `std::basic_istream<char, std::char_traits<char> >& std::getline<char, std::char_traits<char>, std::allocator<char> >(std::basic_istream<char, std::char_traits<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, char)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::append(char const*)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/librt.so.1: undefined reference to `__clock_gettime@GLIBC_PRIVATE'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/librt.so.1: undefined reference to `__clock_nanosleep@GLIBC_PRIVATE'
/home/liqiang/work/linux/raspberrypi/lib/usr/local/lib/libboost_regex.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::compare(wchar_t const*) const@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/local/lib/libboost_filesystem.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find_first_not_of(char const*, unsigned int, unsigned int) const@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf.so: undefined reference to `std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::basic_stringstream(std::_Ios_Openmode)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/libaprutil-1.so.0: undefined reference to `__explicit_bzero_chk@GLIBC_2.25'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/liblog4cxx.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_M_assign(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned int&, unsigned int)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/liblog4cxx.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(unsigned int, unsigned int, char const*) const@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/librt.so.1: undefined reference to `__clock_getcpuclockid@GLIBC_PRIVATE'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/librt.so.1: undefined reference to `__libc_pread@GLIBC_PRIVATE'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf.so: undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_ostringstream()@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf2_ros.so: undefined reference to `std::out_of_range::out_of_range(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf2_ros.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(char const*) const@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf.so: undefined reference to `std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::str() const@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::swap(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/liblog4cxx.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(unsigned int, unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, unsigned int) const@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf.so: undefined reference to `VTT for std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/liblog4cxx.so: undefined reference to `std::__cxx11::basic_ostringstream<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::~basic_ostringstream()@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/liblog4cxx.so: undefined reference to `VTT for std::__cxx11::basic_ostringstream<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/libcrypt.so.1: undefined reference to `__snprintf@GLIBC_PRIVATE'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/librt.so.1: undefined reference to `__socket@GLIBC_PRIVATE'
/home/liqiang/work/linux/raspberrypi/lib/usr/local/lib/libboost_regex.so: undefined reference to `std::__cxx11::collate<wchar_t> const& std::use_facet<std::__cxx11::collate<wchar_t> >(std::locale const&)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/libtf.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/local/lib/libboost_regex.so: undefined reference to `std::__cxx11::numpunct<wchar_t> const& std::use_facet<std::__cxx11::numpunct<wchar_t> >(std::locale const&)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/local/lib/libboost_regex.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::~basic_string()@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/liblog4cxx.so: undefined reference to `vtable for std::__cxx11::basic_ostringstream<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/local/lib/libboost_regex.so: undefined reference to `std::__cxx11::messages<wchar_t> const& std::use_facet<std::__cxx11::messages<wchar_t> >(std::locale const&)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/liblog4cxx.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find_last_not_of(char, unsigned int) const@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/librt.so.1: undefined reference to `__clock_settime@GLIBC_PRIVATE'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/librt.so.1: undefined reference to `__pthread_barrier_init@GLIBC_PRIVATE'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/liblog4cxx.so: undefined reference to `vtable for std::__cxx11::basic_stringstream<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/local/lib/libboost_regex.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::reserve(unsigned int)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/liblog4cxx.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find_first_not_of(char, unsigned int) const@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/opt/ros/kinetic/lib/librosconsole.so: undefined reference to `std::runtime_error::runtime_error(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/lib/arm-linux-gnueabihf/liblog4cxx.so: undefined reference to `vtable for std::__cxx11::basic_stringbuf<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >@GLIBCXX_3.4.21'
/home/liqiang/work/linux/raspberrypi/lib/usr/local/lib/libboost_regex.so: undefined reference to `std::__cxx11::messages<char> const& std::use_facet<std::__cxx11::messages<char> >(std::locale const&)@GLIBCXX_3.4.21'
collect2: error: ld returned 1 exit status
robot_base/bin/CMakeFiles/robot_base.dir/build.make:143: recipe for target 'robot_base/bin/robot_base' failed
make[2]: *** [robot_base/bin/robot_base] Error 1
CMakeFiles/Makefile2:2080: recipe for target 'robot_base/bin/CMakeFiles/robot_base.dir/all' failed
make[1]: *** [robot_base/bin/CMakeFiles/robot_base.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j8 -l8" failed

参考文献1,直接在PC端ubuntu上安装交叉编译工具:
sudo apt install gcc-arm-linux-gnueabihf
sudo apt install g++-arm-linux-gnueabihf
经确认,其自带的c库支持到GLIBC_2.23,自带的C++库支持到GLIBCXX_3.4.21,对于上面C++库兼容性问题,此工具链自带的库刚好满足,试着编译ros应用包,结果成功。

alsa 使用动态库链接遇到undefined reference to `fstat64@GLIBC_2.33‘ libasound.so动态库 链接异常的解决 阅读详情

相关推荐

UE5新手必看:Gameplay框架中的GameInstance与子系统实战指南(含蓝图配置)

本文为UE5新手提供了Gameplay框架中GameInstance与子系统的实战指南。文章深入解析了GameInstance作为全局数据中枢的核心作用与生命周期,并手把手演示了如何创建自定义GameInstance、构建模块化的子系统(如存档管理),以实现跨关卡的持久数据管理。指南旨在帮助开发者构建清晰、可维护的项目架构,解决数据管理混乱的常见痛点。

weixin_29015801的博客 579

linux程序 移植 ros,搭建ros交叉编译环境(从x86到nvidia arm)

方法1:交叉编译环境搭建流程交叉编译环境搭建的主要思路是利用catkin提供的rostoolchain脚本设置相应的交叉编译工具、lib库地址等,中间遇到问题再针对性解决。基础环境:目标运行环境arm64 cpuUbuntu 16.04ros kinetic for arm编译环境x86_64 cpuUbuntu Kylin(16.04)ros kinetic for amd64环境设置流程:1 ...

weixin_33208391的博客 2042

4G LTE 与 5G 无线网络规划对比:从 BBU/RRU 到 CU/DU/AAU 的架构演进解析

本文深度解析4G LTE与5G无线网络架构的演进差异,从BBU/RRU分立式架构到CU/DU/AAU三级重构,揭示移动通信代际跃迁的技术本质。重点对比了网络规划中的覆盖能力、容量规划、传输网络等九大维度,为通信工程师提供实用的技术对照手册,助力5G网络高效部署。

weixin_32821533的博客 292

ROS之交叉编译配置(树莓派)

1、环境 编译平台:x86_64 ubuntu 16.04 目标平台:arm ubuntu 16.04(树莓派3b) ROS版本:ROS kinetic for amd64 CPU架构:编译环境64位和运行环境32位 2在PC上安装arm的编译工具链 https://www.cnblogs.com/sherlock-lin/p/15916143.html https://blog.csdn.net/RobotLife/article/details/105899602 ...

沧海一帆的专栏 3817

使用逻辑分析仪处理IIC信号

逻辑分析仪

xc_123的博客 4490

脑电数据处理——预处理

可以看到,分段和基线校正已经完成了。

weixin_48539970的博客 7004

TX2调试随笔(GPU占有率查看\Cmake 链接静态库出现undefined reference to错误)

1)CPU GPU占有率查看 sudo ~/tegrastats|grep GR3D查看GPU,GR3D就是GPU top查看cpu,按1,显示详细信息

m0_37598942的博客 1735

Cadence仿真数字电路功耗

Cadence仿真数字电路功耗 数字电路的功耗采用平均电流乘电源电压获得,所以本文的关键是测量平均电流。 仿真前设置好仿真参数后,在仿真的ADE街边选择:outputs➡to be saved➡select on design 选择电源的负端电流(若选择正端,则电流为负): 选择完成后,在ADE界面讲所选节点的plot也勾选上,点击run。仿真完成后自动显示波形。在波形上选中该电流曲线,右击选择:send to➡calculator 注意上图中,商店前的波形不稳定,需要进行截取。在calculator

qq_41519780的博客 1万+

[跟我学ROS]1.ROS系统介绍及安装

原文链接:http://www.robotos.net/thread-11-1-1.html 描述:这篇文章主要介绍ROS(机器人操作系统,Robot Operating System)的用途及安装方式; 1.1 ROS的主要用途 ROS(机器人操作系统,Robot Operating System),是专为机器人软件开发所设计出来的一套电脑操作系统架构。它是一个开源的元级操

RobotOS专栏 2499

第三课 NXP S32K144 MCAL 集成到Vector davinci SIP-第一弹

将NXP S32K144 MCAL 集成到Vector davinci SIP的第三方库,导出ARXMl给Vector davinci SIP使用

candleer的博客 5861

搭建微信机器人的方案都在这了!

功能超级强大,虽不支持二次开发,但已有的功能足够个人使用,可惜官方作品已被腾讯告死,好在市面上还流落着不少破解版,有需要的自行搜索。可惜的是,微信官方已不准许新的微信号再使用 web 登录,这就直接从源头扼杀了 web 协议的微信机器人,虽说老的微信号还是能凑合着用,不过部分功能也受限。所以,这些都属于 PC 端的微信机器人。无论是 PC 端还是手机端,用 hook 方式实现的最大缺点就是要和某一个版本的微信客户端进行绑定,如果框架本身不对最新版本的微信适配,那使用的时候就无法升级到最新版本的微信。

weixin_47246330的博客 1万+

ffmpeg ubuntu18.04编译报错fcntl64

可见版本和ldd匹配,而且此库中并没有实现fcntl64,所以考虑升级glibc的版本,但是由于系统ubuntu18.04和此内核版本官方源提供的匹配版本就是如上的版本,尝试源码编译glibc库31版本,然后手动源码安装成功,ffmpeg可以编译成功,并且不会报错,但是切换到此路径下的glibc库的话,系统很多的命令都会报段错误,所以,glibc并不能如此的在系统下升级。猜测应该是ffmpeg的某些依赖库调用了fcntl64,如此的话,重点就是分析glibc的是否真的存在fcntl64。

百鸣的专栏 2627

【Flink】Flink 消费一段时间1万多条数据就卡死

我们有个现场环境,发现了奇怪的现象,就是每次启动任务后,消费1万多条数据后就会卡死,然后整个流不消费,也不往下输出,看起来卡死了一样。缺图这里面出现的网闸原因导致的,但是经过我们写了一个简单的kafka消费程序,然后在出问题的节点上消费数据,实际排查,发现不是这个问题。这个问题,发现也不是,这段时间没有进行过kafka数据清理。里面的问题。因为这个问题,我们后面的代码刻意规范了,不这样操作。后来是在没办法了,然后我们dump了线程,发现有如下代码。

九师兄 354

2.28

1: 题解:方法重写应遵循“三同一小一大”原则: “三同”:即方法名相同,形参列表相同,返回值类型相同; “一小”:子类方法声明抛出的异常比父类方法声明抛出的异常更小或者相等; “一大”:子类方法的访问修饰符应比父类方法更大或相等。 A选项是重写,但是默认访问修饰符比父类小,插入第五行编辑器会报错。 B、D不是重写。因为形参列表和返回值类型不同,不满足“三同”。所以写在第五行以普通方法对待,插入第...

qq_44788119的博客 741

全球国家地区城市数据

MySQL全球国家地区城市数据报。。。。。。。。。。。。

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

FastDFS安装笔记和使用

环境:ubuntu19.10 本文中的#表示linux下面的管理员权限 安装libfastcommon 获取libfastcommon安装包: wget https://github.com/happyfish100/libfastcommon/archive/V1.0.38.tar.gz 解压安装包:tar -zxvf V1.0.38.tar.gz 进入目录...

微电子学与固体电子学-俞驰 1624

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

安装fastdfs出现/usr/local/lib/libfastcommon.so: undefined reference to `fcntl64@GLIBC_2.28‘

完整报错如下: /usr/local/lib/libfastcommon.so: undefined reference to `fcntl64@GLIBC_2.28' collect2: error: ld returned 1 exit status objs/Makefile:236: recipe for target 'objs/nginx' failed make[1]: *** [...

微电子学与固体电子学-俞驰 1万+

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

ros2交叉编译 x86到arm

ros2交叉编译方法

weixin_45174417的博客 7177

libevent 报 undefined reference to `getrandom‘

/home/sec/xxx/serviced/libs-x86/libevent.a(evutil_rand.o): In function `arc4_seed_getrandom': /home/xxx/open_src/libevent-2.1.12-stable/./arc4random.c:188: undefined reference to `getrandom' collect2: error: ld returned 1 exit status 主要原因是libevent.a 是在一台.

好习惯成就伟大 2173

ROS交叉编译

-platform linux/arm64 使设备识别为arm64。ros版本为melodic,需要根据需求自行修改。2.拉取ARM对应的docker。5.安装vim,换arm源。3.然后是拉一个配置。4.挂载docker。

qq_30238467的博客 1190

搭建ros交叉编译环境(从x86到nvidia arm)

方法1: 交叉编译环境搭建流程 交叉编译环境搭建的主要思路是利用catkin提供的rostoolchain脚本设置相应的交叉编译工具、lib库地址等,中间遇到问题再针对性解决。 基础环境: 目标运行环境 arm64 cpu Ubuntu 16.04 ros kinetic for arm 编译环境 x86_64 cpu Ubuntu Kylin(16.04) ros kinetic for amd64 环境设置流程: 1 ARM ubuntu环境上安装arm-...

lovely_yoshino的博客 6763

undefined reference to错误的解决方法

undefined reference to错误的解决方法 2010-12-09 17:15:44 分类: LINUX 陈运文 Linux下编译程序时,经常会遇到“undefined reference to XXX” 报错, 这里总结一些可能的原因和解决方案,给需要的朋友: 说道undefined reference error,先提一下Linux gc

zhyjunFov的专栏 2439

[X3m]ros交叉编译

若使用minimal_build.sh进行最小化编译,还可通过执行./minimal_deploy.sh -d “install_path”,进一步压缩部署包大小。将编译生成的install目录拷贝至地平线RDK中并重命名为tros,这里我们将部署包放在/opt/tros目录下与deb安装目录保持一致。中,默认是获取的最新版本tros.b源码。该部分操作均在开发机的docker内完成。该部分操作均在开发机的docker内完成。该部分操作均在开发机的docker内完成。,在地平线RDK中的路径为。

ldinvicible的专栏 649

对‘fcntl@GLIBC_2.28‘未定义的引用

说明: 1、上图红框xxxxxlibc.so为自己编译的动态库 2、上图为编译某可执行程序,需要引用到xxxxxlibc.so 3、xxxxxlibc.so不是本地编译,是在另外的电脑端编译将动态库移植过来的 解决方法: 找到xxxxxlibc.so的源码,在本地进行编译,将编译出来的xxxxxlibc.so动态库替换掉原来的,再重新执行编译命令,“对‘fcntl@GLIBC_2.28’未定义的引用”问题就会解决。 ...

佳佳鸽的博客 6832
上一篇: 在ubuntu14.04 LTS 上交叉编译ARM平台RK3326上运行的opencv2.4.9
下一篇: 程序加速
RobotLife
博客等级 码龄10年 39粉丝 40原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值