"Illegal instruction" when trying to run cross-compiled Qt on Raspberry Pi (Windows)

I found and read the question here , as well as the topics here and here , unfortunately, it still remains unresolved. (although I used all the tips from this thread to give as much information as possible)


What a problem

For several days, I have been trying to find a way to cross-compile Qt , since I recently got it and now I want to learn how to encode some basic embedded applications.

I follow the tutorial here: http://visualgdb.com/tutorials/raspberry/qt/embedded/

  • I used a clean system, the only thing I needed to install was some settings: apt-get install libudev-dev libinput-dev libts-dev libxcb* (starting for the first time, configure talked about missing LIES)
  • Got an image of Raspbian and toolchain from here , respectively 2015-11-21-raspbian-jessie and raspberry-gcc-4.9.2-r2.exe
  • The Qt source also comes from the link in the tutorial above ( qt-everywhere-opensource-src-5.5.0.tar.xz )
  • I used the same file paths, etc., so all commands must be exact, including configure: ../qt-everywhere-opensource-src-5.5.0/configure -platform win32-g++ -xplatform linux-arm-gnueabi-g++ -release -opengl es2 -device linux-rasp-pi2-g++ -sysroot C:/SysGCC/Raspberry/arm-linux-gnueabihf/sysroot -prefix /usr/local/qt5 -device-option CROSS_COMPILE=C:/SysGCC/Raspberry/bin/arm-linux-gnueabihf- -qt-xcb

A few hours later everything was built, apparently without errors. (my result was more the same as in the screenshots in the textbook)

However, trying to run any of the constructed examples, the result is obtained in only one line: Illegal instruction


What else can I provide ...

  • After the thread I mentioned at the beginning , here is the file output:

     root@raspberrypi :/usr/local/qt5/examples/opengl/cube# file cube cube: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.32, BuildID[sha1]=e4c51318d4ca583ace647510c9b4cddd06a34e19, stripped 
  • I tried to run the application with gdb using gdb ./cube and then run . Output:

     (gdb) run Starting program: /usr/local/qt5/examples/opengl/cube/cube [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1". Program received signal SIGILL, Illegal instruction. 0xb6249734 in QMutex::lock() () from /usr/local/qt5/lib/libQt5Core.so.5 (gdb) Quit 
  • The compiler itself works like cross-compilation - I can create C ++ Hello World on windows, compile with C:\SysGCC\Raspberry\bin\arm-linux-gnueabihf-g++.exe , and then run it on raspberries

  • I was even able to configure Qt Creator correctly using arm-linux-gnueabihf-g++.exe as a compiler and C:\SysGCC\Raspberry\arm-linux-gnueabihf\sysroot\usr\local\qt5\bin\qmake.exe as qmake - . The main opengl project builds fine, even the remote deployment of raspi works :) ... sorry for the "illegal instruction"

  • Raspbian: Linux raspberrypi 4.1.19+ #858 Tue Mar 15 15:52:03 GMT 2016 armv6l GNU/Linux

     root@raspberrypi :/# lsb_release -a No LSB modules are available. Distributor ID: Raspbian Description: Raspbian GNU/Linux 8.0 (jessie) Release: 8.0 Codename: jessie 
  • Windows 7 64 bit


Thanks in advance for any help. Of course, I would provide any necessary information, if necessary.

Seriously, I’m trying a week, I have already failed with linux-like material on wiki.qt.io wiki.qt.io However, I really look forward to creating a reliable, cross-compiling, remote deployment of Qt environment for future development on my raspberries from windows :)

+6
source share
1 answer

Well, that turned out to be an embarrassing phenomenon. The tutorial here: http://visualgdb.com/tutorials/raspberry/qt/embedded/ made for Raspberry Pi 2, although it is not mentioned explicitly

Fortunately, you just need to change the configure script from -device linux-rasp-pi2-g++ to -device linux-rasp-pi-g++

I was surprised, but apparently it worked fine for me.

So, now the configure line should look like this:

 ../qt-everywhere-opensource-src-5.5.0/configure -platform win32-g++ -xplatform linux-arm-gnueabi-g++ -release -opengl es2 -device linux-rasp-pi-g++ -sysroot C:/SysGCC/Raspberry/arm-linux-gnueabihf/sysroot -prefix /usr/local/qt5 -device-option CROSS_COMPILE=C:/SysGCC/Raspberry/bin/arm-linux-gnueabihf- -qt-xcb 

Thanks @Bugfinger for the tip :)

PS. If you do not know which version of RPi you have (I was not sure), you can compare specifications and peripherals here or here

+2
source

All Articles