Cross-compiled YOCTO qt5 app only runs via QTCreator, not when run from command-line



  • I'm cross-compiling QT5.6 to a Variscite VAR-SOM-SOLO board running the freescale/variscite Yocto. I'm not using X11, the app draws directly to linuxfb or eglfs.

    I can compile and run the app from QTCreator (running on Ubuntu, cross-compiling and pushing to target via SSH). It runs and debugs perfectly.

    However! If I try to execute the compiled app on the target directly (via terminal), I get:-

    "Cannot execute binary file: Exec format error"

    IF I run the app via QTCreator & ssh... terminate the app... THEN run it on the target directly at the console... Then it runs fine!

    This is a problem because clearly I need to be able to run the app on the target without relying on the development computer.

    Any ideas? The behavior changing before and after executing via QTCreator/ssh makes me think some environment variables must need set.

    I have tried running the app with "./APPNAME -platform linuxfb" and setting QT_QPA_PLATFORM, no change

    Kris


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Can you run file your_app_name on your device with a normal and a failing application ?



  • Sure...

    root@var-som-mx6:~/rt# file HC5_QT_APP
    HC5_QT_APP: data

    THEN, I execute the app (successfully) via QTCreator over ssh/sftp, then:-

    root@var-som-mx6:~/rt# file HC5_QT_APP
    HC5_QT_APP: 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, ..................

    (I copied the last line manually so there may be v minor typos).

    If I reboot the board then run file again, it has returned to:-

    root@var-som-mx6:~/rt# file HC5_QT_APP
    HC5_QT_APP: data


  • Lifetime Qt Champion

    How do you copy it over your device when not using Qt Creator ?



  • You must be using the SDK generated by Yocto.
    You have put in to import the poky-sdk environment variables into qtcreator.sh like:

    /opt/poky-sdk/2.1/environment-setup-cortexXXX-poky-linux-gnueabi

    And you're using QMake?



  • @SGaist it is only ever copied by QTCreator. It is never copied by hand.

    So for example,

    • Yocto board boots for first time, app isn't present.
    • QTCreator on separate computer cross-compiles app and pushes to Yocto board via ssh
    • QTCreator commands that app to start on the target. It runs successfully.
    • On the target board, typing 'file [appname]' at the terminal results in "ELF 32-bit LSB executable"....
    • If I terminate the app, and run the app directly from the terminal on the Yocto board, it runs fine
    • THEN if REBOOT the yocto board, navigate to the app folder and run it... I get the ""Cannot execute binary file: Exec format error"" and "file [appname]" gives me "HC5_QT_APP: data"

    p.s., Everything is via the console or ssh, there is no X11 or window manager on the yocto board.



  • @Cleiton-Bueno Correct, I'm using the SDK generated by yocto, and I'm running QtCreator via the qtcreator.sh which starts with...

    source /opt/fsl-imx-fb/4.1.15-2.0.1/environment-setup-cortexa9hf-neon-poky-linux-gnueabi 
    
    #! /bin/sh
    

    I'm not doing anything manually with qmake. It is all done via QtCreator.


  • Lifetime Qt Champion

    How are you rebooting it ?



  • @epicedium Have you created a kit to compile for Target using the G ++, GDB and QMake of this Yocto SDK?



  • @SGaist "reboot" or power cycle, both behave the same in that the app doesn't execute afterwards.





  • @epicedium Why is using GDB Host System and not the Yocto SDK?



  • @Cleiton-Bueno Unchanged default... I just changed it to the gdb in the Yocto SDK, everything continues to build and run correctly via QtCreator.

    I rebooted the yocto target board, and the app now runs correctly(!)

    I'll do some more testing, but it appears this might have been the cause of the issue. Many thanks!



  • @epicedium Yeah! It has influence for the running.
    I hope you have solved it;)


Log in to reply
 

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