Cross compiled qt-app gives illegal instruction in target



  • I used the qt for user interface development for our application. I used buildroot for developed embedded linux for our application. I are planning to run the Qt-UI in target application. We cross compiled all gcc/g++, linkers and others carefully . With the crosscompiler toolchain We able to develop the executable. When I transfer the executable to target through scp (not through Qt kits SFTP) and run on target I am getting "Illegal Instruction". Before running qt-app i did LD_TRACE_LOADED_OBJECTS=1 ./test (test is qt-app)

    I am getting the following

    LD_TRACE_LOADED_OBJECTS=1 ./test

    linux-gate.so.1 (0xb7799000)
    libQt5Widgets.so.5 => /usr/lib/libQt5Widgets.so.5 (0xb6ff4000)
    libQt5Gui.so.5 => /usr/lib/libQt5Gui.so.5 (0xb696f000)
    libQt5Core.so.5 => /usr/lib/libQt5Core.so.5 (0xb6495000)
    librt.so.1 => /lib/librt.so.1 (0xb648c000)
    libdl.so.2 => /lib/libdl.so.2 (0xb6487000)
    libGL.so.1 => /usr/lib/libGL.so.1 (0xb642c000)
    libpthread.so.0 => /lib/libpthread.so.0 (0xb640f000)
    libatomic.so.1 => /lib/libatomic.so.1 (0xb6408000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb6348000)
    libm.so.6 => /lib/libm.so.6 (0xb62f1000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb62db000)
    libc.so.6 => /lib/libc.so.6 (0xb6155000)
    libpng16.so.16 => /usr/lib/libpng16.so.16 (0xb612b000)
    libz.so.1 => /usr/lib/libz.so.1 (0xb6119000)
    libicui18n.so.57 => /usr/lib/libicui18n.so.57 (0xb5f0a000)
    libicuuc.so.57 => /usr/lib/libicuuc.so.57 (0xb5db0000)
    libicudata.so.57 => /usr/lib/libicudata.so.57 (0xb4532000)
    libpcre16.so.0 => /usr/lib/libpcre16.so.0 (0xb44fc000)
    libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0xb44fa000)
    libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0xb4413000)
    /lib/ld-linux.so.2 (0xb779a000)
    libexpat.so.1 => /usr/lib/libexpat.so.1 (0xb43f5000)
    libglapi.so.0 => /usr/lib/libglapi.so.0 (0xb43cf000)
    libXdamage.so.1 => /usr/lib/libXdamage.so.1 (0xb43cc000)
    libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0xb43c7000)
    libX11-xcb.so.1 => /usr/lib/libX11-xcb.so.1 (0xb43c5000)
    libX11.so.6 => /usr/lib/libX11.so.6 (0xb42b2000)
    libxcb-glx.so.0 => /usr/lib/libxcb-glx.so.0 (0xb429a000)
    libxcb-dri2.so.0 => /usr/lib/libxcb-dri2.so.0 (0xb4296000)
    libxcb.so.1 => /usr/lib/libxcb.so.1 (0xb4272000)
    libXxf86vm.so.1 => /usr/lib/libXxf86vm.so.1 (0xb426d000)
    libXext.so.6 => /usr/lib/libXext.so.6 (0xb425d000)
    libXau.so.6 => /usr/lib/libXau.so.6 (0xb425a000)
    libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb4255000)
    libdrm.so.2 => /usr/lib/libdrm.so.2 (0xb4248000)
    libpcre.so.1 => /usr/lib/libpcre.so.1 (0xb420b000)
    

    after executing the LD_TRACE_LOADED_OBJECTS, If I run the

    ./test

    I am getting
    Illegal Instruction.

    How to fix it.

    My target system : ICOP VDX6354RD with 512MB RAM, 800MHz Processor

    Linux Kernel : 3.8.13

    GCC Version : 4.9.4

    Qt : 5.6.1

    Host System : 64bit, Fedora 24

    thanks & regards,
    servo gmrt


  • Lifetime Qt Champion

    Hi,

    Which version of Qt are you using to build your application ?



  • Hi,

    I am using qt5base-5.6.1-1cross compiled binaries in target board.

    For building qt-application cross compiled qmake I am using.

    My Qt creator version installed in Host System is 4.0.3 .

    But I configured the Kit in Qt creator with the cross compiled binaries.


  • Moderators

    @gmrt What does "file YOUR_EXECUTABLE" say?


  • Lifetime Qt Champion

    You should check the processor type as well as the linux distribution you have running to ensure that you are building for the correct ARM processor type as well as ABI.



  • Hi,

    My file output as follows,

    test is my qt-app

    test: ELF 32-bit LSB executable, Intel 80386, version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=41e3e6d6fa1db29b9747d7334ee029f375829195, not stripped

    My target is i586 architecture CPU. Same I enabled in Linux kernel configuration.

    My Kit configuration variables are pointing to the cross compiled path.


  • Moderators

    @gmrt Is any of the libs built for >i586?



  • @jsulm
    I checked in my build all the libraries build using i586.
    I found another interesting thing when I run the cross compiled qt executable in virtual machine. It is running without any error.
    When I try to run it in hardware i am getting "illegal instruction" error.
    Problem found is while running in actual hardware is shared libraries are not getting loaded.
    I tried with exporting LD_LIBRARY_PATH before running the qt application. but no change, same error is appearing.


  • Lifetime Qt Champion

    Did you deploy all dependencies ?

    What distribution are you running on your target ?



  • @SGaist
    Yes, I cross checked all my shared object files in /lib and /usr/lib.

    I am using the cross compiled iso images. Which is built using buildroot.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.