Cross compiled ROS can't find pthread
I have managed to successfully cross compile ROS melodic for aarch64
using my x86_64
PC. But when I try to catkin_make
with it, I get
make[2]: * No rule to make target '/usr/aarch64-linux-gnu/lib/libpthread.so', needed by '/home/soap/catkin_ws/devel/lib/test_cpp/listener'. Stop.
I have simple talker/listener nodes in my workspace. Nothing fancy.
I cross compiled using aarch64-linux-gnu-gcc/g++
. Therefore, the file /usr/aarch64-linux-gnu/lib/libpthread.so
exists. But in the host machine (a jetson nano) it does not. Instead there is /usr/lib/aarch64-linux-gnu/libpthread.so
(Notice the directory order)
I have my cross compiled workspace in /xcompiled_aarch64/ros_melodic/
.Before catkin_make, I source ROS by
source /xcompiled_aarch64/ros_melodic/install/setup.bash
Note: I have apt installed ROS as well in the host machine. If I source that and catkin_make, everything works fine. (When sourcing my cross compiled ROS, I do not source the apt installed one before that)
Full output of catkin_make is as follows
Base path: /home/soap/catkin_ws
Source space: /home/soap/catkin_ws/src
Build space: /home/soap/catkin_ws/build
Devel space: /home/soap/catkin_ws/devel
Install space: /home/soap/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/soap/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/soap/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /xcompiled_aarch64/ros_melodic/install;/xcompiled_aarch64/ros_melodic/devel
-- This workspace overlays: /xcompiled_aarch64/ros_melodic/install;/xcompiled_aarch64/ros_melodic/devel
-- Found PythonInterp: /usr/bin/python2 (found suitable version "2.7.17", minimum required is "2")
-- Using PYTHON_EXECUTABLE: /usr/bin/python2
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/soap/catkin_ws/build/test_results
-- Found gtest sources under '/usr/src/googletest': gtests will be built
-- Found gmock sources under '/usr/src/googletest': gmock will be built
-- Found PythonInterp: /usr/bin/python2 (found version "2.7.17")
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.26
-- BUILD_SHARED_LIBS is on
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~ traversing 1 packages in topological order:
-- ~~ - test_cpp
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'test_cpp'
-- ==> add_subdirectory(test_cpp)
-- catkin_DIR= /xcompiled_aarch64/ros_melodic/install/share/catkin/cmake
-- Configuring done
-- Generating done
-- Build files have been written to: /home/soap/catkin_ws/build
####
#### Running command: "make -j4 -l4" in "/home/soap/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/soap/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /xcompiled_aarch64/ros_melodic/install;/xcompiled_aarch64/ros_melodic/devel
-- This workspace overlays: /xcompiled_aarch64/ros_melodic/install;/xcompiled_aarch64/ros_melodic/devel
-- Found PythonInterp: /usr/bin/python2 (found suitable version "2.7.17", minimum required is "2")
-- Using PYTHON_EXECUTABLE: /usr/bin/python2
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/soap/catkin_ws/build/test_results
-- Found gtest sources under '/usr/src/googletest': gtests will be built
-- Found gmock sources under '/usr/src/googletest': gmock will be built
-- Found PythonInterp: /usr/bin/python2 (found version "2.7.17")
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.26
-- BUILD_SHARED_LIBS is on
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~ traversing 1 packages in topological order:
-- ~~ - test_cpp
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'test_cpp'
-- ==> add_subdirectory(test_cpp)
-- catkin_DIR= /xcompiled_aarch64/ros_melodic/install/share/catkin/cmake
-- Configuring done
-- Generating done
-- Build files have ...