[Solved] Cross compiled application doesn't run on target (Command not found)



  • Hello!

    I am facing weird problem at my end.

    My goal is to cross compile Qt application for the specific processor and run it on the embedded target.

    Here are the steps I did follow:

    Did all the steps one by one as per:
    "Sitara TI SDK":http://processors.wiki.ti.com/index.php/Sitara_Linux_Training:_Hands_on_with_QT

    After building the application, the file property shows:

    @
    root@am335x-evm:~# file helloworld
    helloworld: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.31, not stripped
    @

    And it does match with the pre built application:

    @
    root@am335x-evm:~# file /usr/bin/qmlviewer
    /usr/bin/qmlviewer: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, stripped
    @

    But when I run the application, it shows

    @
    root@am335x-evm:~# ./helloworld -qws
    -sh: ./helloworld: not found
    @

    What does that mean?

    How do I get rid of this problem?

    Thank you,
    Kumar


  • Lifetime Qt Champion

    Hi,

    Did you check that it has executable permissions ?



  • Hi Sam,

    Yes, the application has executable permission.

    @
    root@am335x-evm:~# ls -l
    -rwxrwxrwx 1 root root 8197 Jul 27 10:55 helloworld
    @

    (Sorry for the wrong date, clock has not been set properly)



  • Sounds like the loader can't load it.
    Shell into your board and run

    Ldd ./helloworld

    To see what depends are missing



  • Greg!

    Thank you for the response.

    You might be corect about the loader - loader can't load it.

    Unfortunately, "ldd" binary is not present with the busybox. So, I am not able to see the shared drivers details.

    But, this application has been built in Ubuntu environment and copied to the target.

    Here are the details that is displayed in Ubuntu:

    @
    @ubuntu:~/exercise/lab1$ ldd ./helloworld
    not a dynamic executable
    @

    What does that mean?

    But, when i see the properties of other application which I built for Ubuntu, that shows different information:

    @
    k@ubuntu:~/exercise/translatorDemo/FormData$ ldd ./FormData
    linux-gate.so.1 => (0xb770d000)
    libQtGui.so.4 => /usr/local/Trolltech/Qt-X11-4.7.1/lib/libQtGui.so.4 (0xb6c6a000)
    libQtCore.so.4 => /usr/local/Trolltech/Qt-X11-4.7.1/lib/libQtCore.so.4 (0xb69cc000)
    libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb68d5000)
    libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb68b7000)
    libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb670d000)
    libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb66f2000)
    libglib-2.0.so.0 => /lib/i386-linux-gnu/libglib-2.0.so.0 (0xb65f9000)
    libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb65e2000)
    libfreetype.so.6 => /usr/lib/i386-linux-gnu/libfreetype.so.6 (0xb6548000)
    libSM.so.6 => /usr/lib/i386-linux-gnu/libSM.so.6 (0xb653f000)
    libICE.so.6 => /usr/lib/i386-linux-gnu/libICE.so.6 (0xb6525000)
    libXrender.so.1 => /usr/lib/i386-linux-gnu/libXrender.so.1 (0xb651b000)
    libfontconfig.so.1 => /usr/lib/i386-linux-gnu/libfontconfig.so.1 (0xb64e6000)
    libXext.so.6 => /usr/lib/i386-linux-gnu/libXext.so.6 (0xb64d4000)
    libX11.so.6 => /usr/lib/i386-linux-gnu/libX11.so.6 (0xb63a0000)
    libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb6374000)
    libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb636f000)
    librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb6365000)
    /lib/ld-linux.so.2 (0xb770e000)
    libpcre.so.3 => /lib/i386-linux-gnu/libpcre.so.3 (0xb6329000)
    libuuid.so.1 => /lib/i386-linux-gnu/libuuid.so.1 (0xb6323000)
    libexpat.so.1 => /lib/i386-linux-gnu/libexpat.so.1 (0xb62f9000)
    libxcb.so.1 => /usr/lib/i386-linux-gnu/libxcb.so.1 (0xb62d8000)
    libXau.so.6 => /usr/lib/i386-linux-gnu/libXau.so.6 (0xb62d3000)
    libXdmcp.so.6 => /usr/lib/i386-linux-gnu/libXdmcp.so.6 (0xb62cc000)
    @

    Please let me know your thoughts.

    Thank you,
    Kumar



  • Aah OK! I think,

    @
    not a dynamic executable
    @

    means that, it is not really an executable for the particular platform.

    In this case, I have cross compiled the application for ARM platform and am trying to execute it in Linux environment, which is not really possible!



  • Yes.
    It will have to be run on the target system.
    I found a post online that may help:

    You really don't need a special ldd.
    ldd is just a script. In its most basic usage (ldd <executable>), it just runs:

    LD_TRACE_LOADED_OBJECTS=1 <executable>

    For example on busybox:

    LD_TRACE_LOADED_OBJECTS=1 /bin/busybox

        linux-vdso32.so.1 =>  (0x00100000) 
        libc.so.6 => /lib/libc.so.6 (0x0fe70000) 
        /lib/ld.so.1 (0x48000000 
    

    So for sporadic usage, an ldd script isn't even needed.

    See 'man ld.so' for information on this LD_TRACE_LOADED_OBJECTS
    variable (and several other useful variables that change the behavior
    of the executable.

    See also: http://www.catonmat.net/blog/ldd-arbitrary-code-execution/



  • Hi Greg,

    Thank you for the response and sorry for delayed reply.

    I did find the solution.

    My target was running on 5.05 version of SDK and I was cross compiling for 7.0 version of SDK. Because of mismatch in the version, I was not able to execute the application.

    After loading the right version of SDK, I was able to run the application in embedded device.

    Thank you for the help!

    Regards,
    Kumar


Log in to reply
 

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