Important: Please read the Qt Code of Conduct -

Cross compile fails with 'could not read symbols: File in wrong format'

  • Hi,
    I've seen this asked and answered, but the answer doesn't work for me.
    I'm building on Ubuntu 12.04.5 LTS (GNU/Linux 3.2.0-67-generic-pae i686).
    My target is armv7 Cortex-A9.
    I'm using:
    ./configure -embedded arm -xplatform qws/linux-arm-g++
    -arch arm
    -prefix /usr/local/arm
    -platform linux-g++
    -no-qt3support -opensource -confirm-license

    my qmake.conf from qws/linux-arm-g++:

    qmake configuration for building with arm-linux-gnueabihf-g++


    modifications to g++.conf

    QMAKE_CC = /usr/local/arm/4.7/bin/arm-linux-gnueabihf-gcc -msoft-float -D__GCC_FLOAT_NOT_NEEDED -march=armv7 -mtune=armv7 -O0 -lts
    QMAKE_CXX = /usr/local/arm/4.7/bin/arm-linux-gnueabihf-g++ -msoft-float -D__GCC_FLOAT_NOT_NEEDED -march=armv7 -mtune=armv7 -O0 -lts
    QMAKE_LINK = /usr/local/arm/4.7/bin/arm-linux-gnueabihf-g++ -msoft-float -D__GCC_FLOAT_NOT_NEEDED -march=armv7 -mtune=armv7 -O0 -lts
    QMAKE_LINK_SHLIB = /usr/local/arm/4.7/bin/arm-linux-gnueabihf-g++ -msoft-float -D__GCC_FLOAT_NOT_NEEDED -march=armv7 -mtune=armv7 -O0 -lts

    modifications to linux.conf

    QMAKE_AR = /usr/local/arm/4.7/bin/arm-linux-gnueabihf-ar cqs
    QMAKE_OBJCOPY = /usr/local/arm/4.7/bin/arm-linux-gnueabihf-objcopy
    QMAKE_STRIP = /usr/local/arm/4.7/bin/arm-linux-gnueabihf-strip

    QMAKE_INCDIR += /usr/local/tslib/include
    QMAKE_LIBDIR += /usr/local/tslib/lib

    QMAKE_CFLAGS_RELEASE += -march=armv7 -mtune=armv7
    QMAKE_CFLAGS_DEBUG += -march=armv7 -mtune=armv7
    QMAKE_CFLAGS_MT += -march=armv7 -mtune=armv7
    QMAKE_CFLAGS_MT_DBG += -march=armv7 -mtune=armv7
    QMAKE_CFLAGS_MT_DLL += -march=armv7 -mtune=armv7
    QMAKE_CFLAGS_MT_DLLDBG += -march=armv7 -mtune=armv7
    QMAKE_CFLAGS_SHLIB += -march=armv7 -mtune=armv7
    QMAKE_CFLAGS_THREAD += -march=armv7 -mtune=armv7
    QMAKE_CFLAGS_WARN_OFF += -march=armv7 -mtune=armv7
    QMAKE_CFLAGS_WARN_ON += -march=armv7 -mtune=armv7

    QMAKE_CXXFLAGS_DEBUG += -march=armv7 -mtune=armv7
    QMAKE_CXXFLAGS_MT += -march=armv7 -mtune=armv7
    QMAKE_CXXFLAGS_MT_DBG += -march=armv7 -mtune=armv7
    QMAKE_CXXFLAGS_MT_DLL += -march=armv7 -mtune=armv7
    QMAKE_CXXFLAGS_MT_DLLDBG += -march=armv7 -mtune=armv7
    QMAKE_CXXFLAGS_RELEASE += -march=armv7 -mtune=armv7
    QMAKE_CXXFLAGS_SHLIB += -march=armv7 -mtune=armv7
    QMAKE_CXXFLAGS_THREAD += -march=armv7 -mtune=armv7
    QMAKE_CXXFLAGS_WARN_OFF += -march=armv7 -mtune=armv7
    QMAKE_CXXFLAGS_WARN_ON += -march=armv7 -mtune=armv7


    make fails with the 'could not read symbols: File in wrong format'.
    I did build first plain vanilla to ensure everything worked.
    Nothing I"ve found works....

    Thank you,

  • The problem was the gcc/g++ in /usr/bin were both arm target.
    So LD did not understand.

Log in to reply