我使用本指南enter link description here文档安装交叉编译器4.9.3以及qt4.8.6.I安装它们并检查它们更正的版本。 http://www.mediafire.com/file/g0afghia7rkqx05/arm-cortexa9-linux-gnueabihf-4.9.3-20160512.tar.xz
http://www.mediafire.com/file/d54dbygdadergl1/target-qte-4.8.6-to-hostpc.tgz
然后:
cd ~
mkdir helloqt
vi main.cpp
然后我写了它:
#include <QApplication>
#include <QPushButton>
int main(int argc, char **argv)
{
QApplication app (argc, argv);
QPushButton button ("Hello world !");
button.show();
return app.exec();
}
并保存
cd ~/helloqt
/usr/local/Trolltech/QtEmbedded-4.8.6-arm/bin/qmake -project
/usr/local/Trolltech/QtEmbedded-4.8.6-arm/bin/qmake
make
当我在ubuntu-qt核心运行这个程序时,我看到了这个神:
root@NanoPC-T2:/# tftp 192.168.101.4
tftp> get helloqt
Received 11660 bytes in 0.4 seconds
tftp> quit
root@NanoPC-T2:/# chmod +x helloqt
root@NanoPC-T2:/# .setqt4env
-bash: .setqt4env: command not found
root@NanoPC-T2:/# . setqt4env
ctp = 1
root@NanoPC-T2:/# ./helloqt -qws &
[1] 1909
root@NanoPC-T2:/# ./helloqt -qws &
[2] 1910
[1] Segmentation fault ./helloqt -qws
root@NanoPC-T2:/# ./helloqt -qws
[2]+ Segmentation fault ./helloqt -qws
Segmentation fault
root@NanoPC-T2:/# ./helloqt -qws
Segmentation fault
root@NanoPC-T2:/# [2]+ Segmentation fault ./helloqt -qws
-bash: [2]+: command not found
root@NanoPC-T2:/# Segmentation fault
-bash: Segmentation: command not found
root@NanoPC-T2:/# file ./helloqt
./helloqt: ERROR: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3 error reading (Invalid argument)
如何解决此错误?
答案 0 :(得分:0)
这意味着你的文件二进制文件是损坏的。我这样做是为了纠正这个问题:
我的tslib配置不好,这段代码解决了我的第一个问题:
sudo ac_cv_func_malloc_0_nonnull = yes ./configure CC = / opt / FriendlyARM / toolchain / 4.9.3 / bin / arm-none-linux-gnueabihf-gcc CXX = / opt / FriendlyARM / toolchain / 4.9.3 / bin / arm -none-linux-gnueabihf-g ++ --host = arm-none-linux-gnueabihf target = arm-none-linux-gnueabihf --enable-static = yes --enable-shared = yes -prefix = / home / tslib < / p>
您应该使用SFTP(安全ftp)将可运行程序复制到您的设备,它不会更改您的文件类型。