File not recognized: File format not recognized error



  • I am currently using qt version 5.4 (ubuntu os)

    The following error occurs during the build.
    Upload related settings.
    I would be grateful if you could find out what I'm missing.

    < Error >
    File not recognized: File format not recognized
    /lib/x86_64-linux-gnu/libgcc_s.so.1
    Collect2: error: ld returned 1 exit status

    < compilers >
    /root/crosscompile-tools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++

    <debuggers>
    /root/crosscompile-tools/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-gdb



  • @this It's trying to load a 64-bit libgcc for your arm build which is 32-bit and a different architecture.



  • @ambershark
    Do you want to run the compiler and debugger in 64bit?
    I did that.
    I've also run 32bit, and I've run 64bit.
    But the same error occurs.

    I do not understand well.
    Could you explain more?


  • Moderators

    @this You are cross compiling, right? In this case you need a cross compiled Qt (built with the same cross compiler).
    lib/x86_64-linux-gnu/libgcc_s.so.1 - this is for x86_64 architecture
    /root/crosscompile-tools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ - this is for ARM
    ARM != x86_64



  • @jsulm Yes, cross-compile right.
    So the compiler
    / root / crosscompile-tools / tools / arm-bcm2708 / gcc-linaro-arm-linux-gnueabihf-raspbian-x64 / bin / arm-linux-gnueabihf-g ++
    .
    What do you need to do more?


  • Moderators

    @this As I said: you need to cross compile Qt. The Qt you have on your Ubuntu machine is for x86_64 not ARM.



  • @jsulm said in File not recognized: File format not recognized error:

    cross compile Qt

    sorry but,
    I do not understand well.
    I have installed everything related to cross compile
    What do I need to do to set up arm cross compilation in qt?


  • Moderators

    @this If you want to write Qt applications for your target device then you need Qt built for that device.
    "I have installed everything related to cross compile" - what about Qt? Does your cross compilation set-up contain Qt for your target device? You cannot use your Ubuntu Qt packages for your target device as those are compiled for x86_64 not ARM.
    What exactly did you install?
    There is a description how to cross compile Qt for RaspberryPi: http://wiki.qt.io/Raspberry_Pi_Beginners_Guide



  • @jsulm I have completed installation related to crosscompile.
    I created a new project and proceeded with the build.
    I also confirmed that an executable file is created in raspberry pi. I also confirmed that debugging is going well.

    So the crosscompile completed successfully.

    By the way,
    I have a problem when I crosscompile qt that I have already worked on (ubuntu qt)
    Can not I crosscompile the qt I've been working on?


  • Moderators

    @this Sorry, now I'm completely lost! Can you please clearly explain what you are really doing? You were talking about Qt from Ubuntu which you installed, now you say you're building on RaspberryPi. Are you building on RaspberryPi for RaspberryPi (which isn't cross compilation), or do you want to build on RaspberryPi for your Ubuntu PC?
    If you're crsoss compiling from RaspberryPi to Ubuntu then why do you use ARM cross compiler?

    "I have completed installation related to crosscompile" - what did you install and where?

    "I have a problem when I crosscompile qt that I have already worked on (ubuntu qt)
    Can not I crosscompile the qt I've been working on?" - I don't know what you mean.



  • @jsulm I do not speak English well.
    So I use a translator.
    So it seems that there is a problem in communication.

    I'm proceeding with 'ubuntu-> raspberrypi'.

    The following homepage is an item installed to crosscompile.
    Https://medium.com/@amirmann/how-to-cross-compile-qt-for-raspberry-pi-3-on-linux-ubuntu-for-beginners-75acf2a078c

    A new project was created and cross-compiled successfully.
    Executable file created in rasspberry pi.
    Debugging went well.

    By the way,
    I tried to crosscompile a project that was working with qt on ubuntu pc in the past.

    So I want to crosscompile with raspberry pi the project I worked on in the past.
    However, the above error occurs.

    I want to build the qt that I worked on in the past with cross-compiled qt.

    I'm sorry I'm not good at English.
    I do not know if it was delivered properly. Sorry.


  • Moderators

    @this said in File not recognized: File format not recognized error:

    Executable file created in rasspberry pi.

    You probably mean FOR RaspberryPi not IN.

    In the first post you wrote:
    "< Error >
    File not recognized: File format not recognized
    /lib/x86_64-linux-gnu/libgcc_s.so.1
    Collect2: error: ld returned 1 exit status"
    This looks to me like you're trying to use your Ubuntu x86_64 Qt to cross compile for RaspberryPi. This cannot work. You need to use your cross compiled Qt.



  • @jsulm Thank you.
    I solved the problem.
    I typed LIBS + = -L / lib / x86_64-linux-gnu / -lz in my .pro file
    I modified it for arm, and it builds well.
    Thank you for your help.


Log in to reply
 

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