原创 该死的illegal instruction错误

2011-8-7 13:50 8566 9 9 分类: MCU/ 嵌入式

这是个臭名昭著的问题,试了很多方法,也没有解决。

715~16日加起来搞了一天,把4.6.3重新编译了两次,还是没有解决,而且还证明用mini6410提供的4.5.1版本的gcc,能够编译成功,但是QT4.6.3下载到开发板运行Demo程序,提示错误,不兼容,郁闷啊,因此一定要用4.4.3版本的gcc

其中,网上有一篇英文写的很好的文章,编译前修改了QT源码目录内两个.conf文件,尤其是后面红字部分特别提到了avoid some illegal instruction,以为可以类似解决:

 

Qt 4.6.2 installation procedure for FriendlyARM mini 2440 Linux

20110321 星期一 18:51

Qt 4.6.2 installation procedure for FriendlyARM mini 2440 Linux

 

Submitted by paolo on Sun, 07/25/2010 - 03:44

This tutorial will provide a simple list of steps necessary to compile and install Qt 4.6.2 on Mini 2440 friendly ARM board. Italian speaking people can read this tutorial on Qt-Italia community website.

 

The board is equipped with the default GNU/Linux operating system (kernel 2.6.29)

 

 

This guide has been tested on following GNU/Linux host distributions:

 

CentOS 5.4

Fedora 12

Ubuntu 9.10

 

Some problems were found on following host distributions:

 

Ubuntu 9.04

OpenSUSE 11.2

 

First of all you have to download the GCC toolchain provided by the supplier:

 

http://www.friendlyarm.net/dl.php?file=arm-linux-gcc-4.3.2.tgz

 

Now untar the tgz file:

 

tar -xzf arm-linux-gcc-4.3.2.tgz

 

and then copy the directory tree under

 

/usr/local/

 

Remember to export this path on your shell

 

export PATH=/usr/local/arm/4.3.2/bin:$PATH

 

Now we can download Qt

 

http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.6.2.tar.gz

 

and untar and unzip the file on a local directory (example:  /home/user)

 

Now, before running the configure tool, you have to modify the qmake.conf file to inform Qt about your toolchain as described here:

 

File: mkspecs/qws/linux-arm-g++/qmake.conf

 

Now change following lines:

 

#QMAKE_CC = arm-linux-gcc

 

#QMAKE_CXX = arm-linux-g++

 

#QMAKE_LINK = arm-linux-g++

 

#QMAKE_LINK_SHLIB = arm-linux-g++

 

with:

 

QMAKE_CC = arm-none-linux-gnueabi-gcc

 

QMAKE_CXX = arm-none-linux-gnueabi-g++

 

QMAKE_LINK = arm-none-linux-gnueabi-g++

 

QMAKE_LINK_SHLIB = arm-none-linux-gnueabi-g++

 

Also change the following lines:

 

#QMAKE_AR = arm-linux-ar cqs

 

#QMAKE_OBJCOPY = arm-linux-objcopy

 

#QMAKE_STRIP = arm-linux-strip

 

with:

 

QMAKE_AR = arm-none-linux-gnueabi-ar cqs

 

QMAKE_OBJCOPY = arm-none-linux-gnueabi-objcopy

 

QMAKE_RANLIB = arm-none-linux-gnueabi–ranlib

 

In order to avoid some illegal instruction on your ARM compiled application binaries, you have to deactivate compiler optimization:

 

File: /mkspecs/common/g++.conf

 

 

Change this line

 

QMAKE_CFLAGS_RELEASE += -O2

 

With:

 

QMAKE_CFLAGS_RELEASE += -O0

 

 

Now we are ready; in the Qt root subdirectory we run this command:

 

./configure -embedded arm -xplatform qws/linux-arm-g++ -prefix \

 

/usr/local/Qt -qt-mouse-tslib -little-endian -no-webkit -no-qt3support \

 

-no-cups -no-largefile -optimized-qmake -no-openssl -nomake tools

 

And then we can run the command

 

make

 

If everything is ok now we can do

 

make install

 

In order to run our ARM compiled applications we have to set following environment variables on the mini2440 board:

 

export TSLIB_TSEVENTTYPE=INPUT

 

export TSLIB_CONSOLEDEVICE=none

 

export TSLIB_FBDEVICE=/dev/fb0

 

export TSLIB_TSDEVICE=/usr/input/ts

 

export TSLIB_CALIBFILE=/usr/etc/pointercal

 

export TSLIB_CONFFILE=/usr/etc/ts.conf

 

export TSLIB_PLUGINDIR=/usr/lib/ts

 

export LD_LIBRARY_PATH=/usr/local/Qt/lib

 

export QTDIR=/usr/local/Qt

 

export QWS_MOUSE_PROTO=tslib:/usr/input/ts

 

export QWS_DISPLAY=LinuxFB:mmWidth=310:mmHeight=190

 

The Qt library binary (and fonts subdir) shall be placed on a user defined directory of the mini 2440m board and then it is necessary to set LD_LIBRARY_PATH to this directory.

 

Qt binary application must be run with –qws command line argument to inform Qt that we are working on a Linux embedded system.

 

Using the described procedure I was able to compile Qt, qwt library and embedded widgets example.

 

YouTube Video demo: Embedded Widgets example

 

YouTube Video demo: Qwt examples

 

If you have questions you can leave a comment to this post or better, you can post to this forum

 

Good Luck!

 

http://www.sereno-labs.com/qt-4-6-2-installation-procedure-for-friendlyarm-mini-2440-board

 

折腾半天,还是没有用,没有解决Illegal instruction错误问题。
PARTNER CONTENT

文章评论0条评论)

登录后参与讨论
EE直播间
更多
我要评论
0
9
关闭 站长推荐上一条 /3 下一条