Important: Please read the Qt Code of Conduct -

[Solved] Compiling on Ubuntu Linux target

  • I started developing my application on a Windows 7 system. When the target was ready, I ported it over to the real target system, a Linux Ubuntu box. The app compiles and runs fine in the Windows environment, but when I take the same app and try to compile it in the target, I get the following build issues:

    main.o: Relocations in generic ELF (EM: 3)
    main.o: Relocations in generic ELF (EM: 3)
    could not read symbols: File in wrong format
    collect2: Id returned 1 exit status

    Does anyone have any idea what's going on?

  • Moderators

    What most likely is happening here is that you build the program on windows and then copied the whole thing over to the ubuntu machine. Alternatively you used a network volume to house the sources. Am I correct?

    Please clean out all the object files and then rebuild. You are still having some of the windows files around and the build system is trying to build those into a linux executable.

    I would also suggest using shadow building as that greatly mitigates this problem by not littering the sources directory with files generated during the build.

    PS: Try out a version control system! Then you can copy your sources to a new machine by simply doing a checkout. Version control systems are great, no project with more than 20 lines of code should do without one! They are a real timesaver, document the history of your code and provide a safety net for your development. Qt Creator does support quite a few different ones:-)

Log in to reply