Cross Compiling for iMX6 using arm-linux-gnueabi-g++

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Cross Compiling for iMX6 using arm-linux-gnueabi-g++

5,040 Views
danlaks
Contributor II

I compiled a C++ program on my Ubuntu computer using arm-linux-gnueabi-g++ and copied it over to my device that has an iMX6 (a Gateworks GW5100 board with a yocto build). Unfortunately, I'm getting a "no such file or directory" error when I try to execute the program. I've verified the permissions on the file are correct and that the file copied successfully. I just can't execute it.

Is there any reason arm-linux-gnueabi-g++ is the wrong cross compiler to use for the iMX6? Is there another one I should use instead?

Here is the output of running "file" on the executable:

sw: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=34622f94d6f088b50e31bcd08ecd14f57947fee5, not stripped

Thank you.

Labels (2)
Tags (1)
0 Kudos
Reply
4 Replies

3,356 Views
danlaks
Contributor II

I managed to figure this out and get it to work. It was one of two things, but I'm not sure which one it is.

My program required libusb, which I had previously cross-compiled using arm-linux-gnueabihf-gcc (note the hard float suffix). But I compiled my code using arm-linux-gnueabi-g++ (not hard float). After that, I had the problem I described above. When I went back and recompiled everything with the hf compilers, it worked.

So either 1) both libusb and my code needed to be compiled with the same float-type or 2) the iMX6 requires hard float regardless of anything else. Either way my program works on the iMX6 board now.

535 Views
linksrain
Contributor I

I specifically registered an account to reply to you, and your solution works

0 Kudos
Reply

521 Views
linksrain
Contributor I
set(CMAKE_C_COMPILER /usr/bin/arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER /usr/bin/arm-linux-gnueabihf-g++)


set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_PREFIX_PATH "/home//tool/qt-everywhere-src-5.12.9/armqt-5.12.9" CACHE PATH "Path to Qt")
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
It is noted that both the QT library and other dependent libraries use toolchains with the arm-linux-gnueabihf, depending on whether your device supports it
0 Kudos
Reply

3,356 Views
b36401
NXP Employee
NXP Employee

As libusb required by your code requires hardware floating point library you need to have this library on the filesystem even if your code itself uses software floating point.

Have a great day,
Victor

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply