Important: Please read the Qt Code of Conduct -

Cross-compile Qt build problem (host : linux x86_64, target : arm)

  • Hi,

    I would like to build Qt libs for an arm architecture but I encounter strange problem.

    I first adapted my mkspecs/qws/linux-arm-g++/qmake.conf file so that my arm-gcc cross-compiler is correclty used.

    Here is a copy of my qmake.conf file :

    modifications to g++.conf

    #QMAKE_CC = arm-linux-gcc
    #QMAKE_CXX = arm-linux-g++
    #QMAKE_LINK = arm-linux-g++
    #QMAKE_LINK_SHLIB = arm-linux-g++

    QMAKE_CC = arm-none-linux-gnueabi-gcc
    QMAKE_CXX = arm-none-linux-gnueabi-g++
    QMAKE_LINK = arm-none-linux-gnueabi-g++
    QMAKE_LINK_SHLIB = arm-none-linux-gnueabi-g++

    modifications to linux.conf

    #QMAKE_AR = arm-linux-ar cqs
    #QMAKE_OBJCOPY = arm-linux-objcopy
    #QMAKE_STRIP = arm-linux-strip

    QMAKE_AR = arm-none-linux-gnueabi-ar cqs
    QMAKE_OBJCOPY = arm-none-linux-gnueabi-objcopy
    QMAKE_RANLIB = arm-none-linux-gnueabi-ranlib

    Here are the binaries of my cross-compiler :
    arm-none-linux-gnueabi-addr2line arm-none-linux-gnueabi-g++ arm-none-linux-gnueabi-gprof arm-none-linux-gnueabi-readelf
    arm-none-linux-gnueabi-ar arm-none-linux-gnueabi-gcc arm-none-linux-gnueabi-ld arm-none-linux-gnueabi-size
    arm-none-linux-gnueabi-as arm-none-linux-gnueabi-gcc-4.3.2 arm-none-linux-gnueabi-nm arm-none-linux-gnueabi-sprite
    arm-none-linux-gnueabi-c++ arm-none-linux-gnueabi-gcov arm-none-linux-gnueabi-objcopy arm-none-linux-gnueabi-strings
    arm-none-linux-gnueabi-c++filt arm-none-linux-gnueabi-gdb arm-none-linux-gnueabi-objdump arm-none-linux-gnueabi-strip
    arm-none-linux-gnueabi-cpp arm-none-linux-gnueabi-gdbtui arm-none-linux-gnueabi-ranlib

    Then I typed this command to configure :
    ./configure --prefix=/home/azmodai/devel/friendlyarm/mini2440-bootstrap/arm-2008q3 -opensource -embedded arm -xplatform qws/linux-arm-g++ -no-cups -no-webkit -qt-libtiff -qt-libmng -qt-mouse-pc -no-mouse-linuxtp

    Everything is Ok up to now, but when I launch the building by typing make, I get this error about 10 or 15 mins later :

    g++ -fno-exceptions -Wl,-O1 -Wl,-rpath,/home/azmodai/devel/friendlyarm/mini2440-bootstrap/arm-2008q3/lib -Wl,-rpath,/home/azmodai/devel/friendlyarm/mini2440-bootstrap/arm-2008q3/lib -o ../../../bin/moc release-shared/moc.o release-shared/preprocessor.o release-shared/generator.o release-shared/parser.o release-shared/token.o release-shared/main.o -L/home/azmodai/devel/digicode/friendlyarm/qt/arm-qte-4.6.3/qt-everywhere-opensource-src-4.6.3/src/tools/bootstrap -lbootstrap
    /usr/bin/ld: /home/azmodai/devel/digicode/friendlyarm/qt/arm-qte-4.6.3/qt-everywhere-opensource-src-4.6.3/src/tools/bootstrap/libbootstrap.a(compress.o): Relocations in generic ELF (EM: 40)
    /home/azmodai/devel/digicode/friendlyarm/qt/arm-qte-4.6.3/qt-everywhere-opensource-src-4.6.3/src/tools/bootstrap/libbootstrap.a: could not read symbols: File in wrong format
    collect2: ld a retourné 1 code d'état d'exécution
    make[1]: *** [../../../bin/moc] Erreur 1
    make[1] : on quitte le répertoire « /home/azmodai/devel/digicode/friendlyarm/qt/arm-qte-4.6.3/qt-everywhere-opensource-src-4.6.3/src/tools/moc »
    make: *** [sub-moc-make_default-ordered] Erreur 2

    It looks to be a link problem. about a wrong format of binary ...

    Last thing : I decide to remove the "-m64" flags of the linux-x68_64-g++ specs, and I did not replace -m64 by the non-updated equivalent, because I did not the equivalent.

    Have you ever experienced such a problem ? And have you any idea ?

    Thanks a lot !

  • When I build for ARM, I add these flags:

    QMAKE_CFLAGS_RELEASE = -O2 -march=armv5te (your arch may be different)
    QMAKE_CXXFLAGS_RELEASE = -O3 -march=armv5te

    I also add the include paths to QMAKE_CFLAGS_RELEASE, QMAKE_CXXFLAGS_RELEASE. Check your QMAKE_LIBDIR, QMAKE_INCDIR, and QMAKE_LFLAGS variables too.

  • It seems the libbootstrap.a has incorrect format. Can you verify what options it was built with?

  • Hi,

    Actually, What is the target, that you are working/going to get the Qt for.

    Are you working on any significant OMAP or what else.
    Because there are particular spec files for particular OMAPs.

    Try to check them...

  • Hi,
    this page definitely solve your problem, there is also a instruction to config the file qmake.conf

Log in to reply