Cross compilation for arm64 fails during linking

asked 2017-01-29 04:14:34 -0600

inspire gravatar image

I try to cross-compile a simple package for the aarch64 architecture with a x86_64 computer. The aarch64 libs are in place and my toolchain looks like this:

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_SYSTEM_PROCESSOR aarch64)

set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)
set(CMAKE_FIND_ROOT_PATH /usr /usr/lib/aarch64-linux-gnu /opt/ros/kinetic /lib/aarch64-linux-gnu)

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_LIBRARY_PATH /usr/lib/aarch64-linux-gnu)

set(CMAKE_IGNORE_PATH /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/lib/)

But now I'm stuck with the following error:

Linking CXX executable /home/martin/Desktop/AARCH64/test/devel_isolated/beginner_tutorials/lib/beginner_tutorials/talker
/usr/lib/gcc-cross/aarch64-linux-gnu/5/../../../../aarch64-linux-gnu/bin/ld: warning: libicudata.so.55, needed by //usr/lib/aarch64-linux-gnu/libicuuc.so.55, not found (try using -rpath or -rpath-link)
//usr/lib/aarch64-linux-gnu/libicuuc.so.55: undefined reference to `icudt55_dat'
collect2: error: ld returned 1 exit status
CMakeFiles/talker.dir/build.make:113: recipe for target '/home/martin/Desktop/AARCH64/test/devel_isolated/beginner_tutorials/lib/beginner_tutorials/talker' failed
make[2]: *** [/home/martin/Desktop/AARCH64/test/devel_isolated/beginner_tutorials/lib/beginner_tutorials/talker] Error 1
CMakeFiles/Makefile2:325: recipe for target 'CMakeFiles/talker.dir/all' failed
make[1]: *** [CMakeFiles/talker.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2

The files /usr/lib/aarch64-linux-gnu/libicuuc.so.55 and /usr/lib/aarch64-linux-gnu/libicudata.so.55 exist. But why is there a "undefined reference" error? Both files are copied from the arm64 target board. Is it possible to ignore this error and continue compilation?

Do you have a hint for me? :) Thanks in advance!

edit retag flag offensive close merge delete

Comments

Firstly, you should check if the sybolic links points to a valid libraries (if you copied it from target board). It means, check $ file /usr/lib/aarch64-linux-gnu/libicuuc.so.55 etc.

abrzozowski gravatar image abrzozowski  ( 2017-01-30 03:46:24 -0600 )edit

For example pcl_kdtree lib (on my local x86 notebook):

<:/usr/lib$ file libpcl_kdtree.so
libpcl_kdtree.so: symbolic link to `libpcl_kdtree.so.1.7' 
<:/usr/lib$ file libpcl_kdtree.so.1.7
libpcl_kdtree.so.1.7: symbolic link to `libpcl_kdtree.so.1.7.1'
abrzozowski gravatar image abrzozowski  ( 2017-01-30 03:46:57 -0600 )edit

And check if your ending point is compiled on the proper architecture:

<:/usr/lib$ file libpcl_kdtree.so.1.7.1 
libpcl_kdtree.so.1.7.1: ELF 64-bit LSB  shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=f6763c53b5ec596a240f762bd9c1b838886b8eb7, stripped
abrzozowski gravatar image abrzozowski  ( 2017-01-30 03:48:54 -0600 )edit

Hi, the links and files are correct, I think:

martin #  file /usr/lib/aarch64-linux-gnu/libicuuc.so.55
/usr/lib/aarch64-linux-gnu/libicuuc.so.55: symbolic link to libicuuc.so.55.1
inspire gravatar image inspire  ( 2017-01-30 11:53:41 -0600 )edit

and

martin # file /usr/lib/aarch64-linux-gnu/libicuuc.so.55.1
/usr/lib/aarch64-linux-gnu/libicuuc.so.55.1: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=a91010c69969ceefe5d0ace436baaf0b158b95db, stripped
inspire gravatar image inspire  ( 2017-01-30 11:54:00 -0600 )edit

Hi, i have the same problem trying to cross-compile ROS application to aarch64.

Did you can resolv it?

eruiz gravatar image eruiz  ( 2019-07-11 10:35:42 -0600 )edit