I've a simple Qt helloworld.cpp that I cross compiled for armv7l using Linaro GCC arm-linux-gnueabihf-g++ on Ubuntu 16.04 and copied the file on a target ARM board running Linux Kernel 4.4, GCC 5.3. The target is TI Vayu ES 2.0 (which has ARM Cortex A15 core).
Source
helloworld.cpp
#include <QApplication>
#include <QLabel>
int main(int argc, char **argv){
QApplication app(argc,argv);
QLabel label("Hello World");
label.show();
return app.exec();
}
helloworld.pro
QT += core gui widgets
SOURCES += helloworld.cpp
Build:
patel@11:02:43~$make
arm-linux-gnueabi-g++ -c -pipe -O2 -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I/opt/Qt5.7/Qt-v5.7.1-armv7l/include -I/opt/Qt5.7/Qt-v5.7.1-armv7l/include/QtWidgets -I/opt/Qt5.7/Qt-v5.7.1-armv7l/include/QtGui -I/opt/Qt5.7/Qt-v5.7.1-armv7l/include/QtCore -I. -I/opt/Qt5.7/Qt-v5.7.1-armv7l/mkspecs/linux-arm-gnueabi-g++ -o helloworld.o helloworld.cpp
arm-linux-gnueabi-g++ -Wl,-O1 -Wl,-rpath,/opt/Qt5.7/Qt-v5.7.1-armv7l/lib -o helloworld helloworld.o -L/opt/Qt5.7/Qt-v5.7.1-armv7l/lib -lQt5Widgets -lQt5Gui -lQt5Core -lpthread
Other debug info:
patel@11:04:06~$file helloworld
helloworld: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=e4f5148d70a7ad793c951f68b398ee7f9a4d9069, not stripped
patel@11:04:11~$readelf -a helloworld | grep interpreter
[Requesting program interpreter: /lib/ld-linux.so.3]
patel@11:04:45~$objdump -x helloworld | grep NEEDED
NEEDED libQt5Widgets.so.5
NEEDED libQt5Core.so.5
NEEDED libstdc++.so.6
NEEDED libc.so.6
NEEDED ld-linux.so.3
SCP the file to the target ARM board and trying to run it.
root@dra7xx-evm:~# ls -l
-rwxr-xr-x 1 root root 16792 Oct 7 15:07 helloworld
-rwxr-xr-x 1 root root 9784 Oct 7 14:22 helloworld-arm
-rwxr-xr-x 1 root root 9784 Oct 7 14:21 helloworld-gcc
-rwxr-xr-x 1 root root 16792 Oct 7 15:06 helloworld-qt
root@dra7xx-evm:~# ./helloworld
-sh: ./helloworld: No such file or directory
This post had a similar problem to mine and I did try creating a symlink for ld-linux.so.3 like this and tried to run again -
root@dra7xx-evm:/lib# ln -s ld-2.21.so ld-linux.so.3
root@dra7xx-evm:/lib# cd -
root@dra7xx-evm:~# ./helloworld
Segmentation fault (core dumped)
What am I doing wrong here or missing any lib?