Ask Your Question
0

Libraries issues when cross compiling for ARM

asked 2018-06-25 05:23:18 -0600

Delb gravatar image

updated 2018-07-03 01:57:43 -0600

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)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-06-25 05:29:52 -0600

gvdhoorn gravatar image

Not a cross-compilation expert, but this:

set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)

seems weird to me. According to the docs, that searches both gnueabihf paths and the hosts paths ..

edit flag offensive delete link more

Comments

You're right I updated it but I have a new issue now I edited the question

Delb gravatar image Delb  ( 2018-06-25 06:48:38 -0600 )edit

If I may suggest: please undo your edit and mark the question as answered if setting things to ONLY resolved it. Then post a new question about your new problem.

ROS Answers has a 1-to-1 ratio of Qs and As. At least, that is the idea. Let's keep it that way.

gvdhoorn gravatar image gvdhoorn  ( 2018-06-25 08:03:05 -0600 )edit
1

Alright, I will post an other question.

Delb gravatar image Delb  ( 2018-06-25 08:17:22 -0600 )edit

Thanks. Could you post a link to it to keep things connected?

gvdhoorn gravatar image gvdhoorn  ( 2018-06-25 08:20:03 -0600 )edit

Yes, will do once i'll post it

Delb gravatar image Delb  ( 2018-06-25 09:00:58 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-06-25 05:23:18 -0600

Seen: 1,553 times

Last updated: Jul 03 '18