为ARMv7L交叉编译Qt 5 HelloWorld应用程序

时间:2016-10-07 15:32:38

标签: linux qt gcc arm cross-compiling

我有一个简单的Qt helloworld.cpp,我在Ubuntu 16.04上使用Linaro GCC arm-linux-gnueabihf-g ++为armv7l交叉编译,并将该文件复制到运行Linux Kernel 4.4,GCC 5.3的目标ARM板上。目标是TI Vayu ES 2.0(具有ARM Cortex A15内核)。

来源

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 

构建

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 

其他调试信息:

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

将文件保存到目标ARM板并试图运行它。

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

这个post有类似的问题,我尝试为ld-linux.so.3创建一个符号链接,并试图再次运行 -

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)

我在这里做错了什么或错过任何一个lib?

0 个答案:

没有答案