Libraries issues when cross compiling for ARM
Hello,
I'm trying to cross compile my project for my raspberry Pi 3 without success, I'm using Ubuntu 16.04 LTS . I have the following warning (which leads to an error) :
CMake Warning at kobuki/yocs_velocity_smoother/CMakeLists.txt.20 (add_library):
Cannot generate a safe linker search path for target
yocs_velocity_smoother_nodelet because files in some directories may
conflict with libraries in implicit directories:
link library [libpthread.so] in /usr/arm-linux-gnueabihf/lib may be hidden by files in:
/usr/lib/x86_64-linux-gnu
Some of these libraries may not be found correctly
I have this Warning for all my packages and with libdl.so
and librt.so
too, it's generating those kind of errors :
/opt/ros/kinetic/lib/libnodeletlib.so: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status
Here's my rostoolchain.cmake
:
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_C_COMPILER /usr/bin/arm-linux-gnueabihf-gcc)
SET(CMAKE_CXX_COMPILER /usr/bin/arm-linux-gnueabihf-g++)
SET(CMAKE_FIND_ROOT_PATH /usr/arm-linux-gnueabihf)
set(CMAKE_LIBRARY_PATH
/usr/arm-linux-gnueabihf/
/usr/arm-linux-gnueabihf/lib)
set(LD_LIBRARY_PATH ${LD_LIBRARY_PATH}
/usr/arm-linux-gnueabihf/
/usr/arm-linux-gnueabihf/lib)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)
I can't manage to tell CMake to look only for the libraries in usr/arm-linux-gnueabihf/lib
instead of /usr/lib/x86_64-linux-gnu
, which variables need to be set to do that ? Or is my rostoolchain.cmake
incomplete/wrong ?
Thank you in advance
UPDATE :
See #q296016 for a more detailed question about this issue (and cross compilation in general)