Qt World Summit: Register Today!

Compilation error when cross compiling Qt 4.8.3 in Scratchbox2 for arm

  • Hi
    I have been trying to setup some kind of cross compiling environment with Qt for a while now and my latest attempt is with Scratchbox.

    When I try to build Qt I get the following error and I just can't get my head around figuring out what the problem is (I get this fairly quickly when calling make):
    @sb2 g++ -c -include .pch/release-shared/QtCore -pipe -O2 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -D_REENTRANT -fPIC -DQT_SHARED -DQT_BUILD_CORE_LIB -DQT_NO_USING_NAMESPACE -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DELF_INTERPRETER="/lib/ld-linux.so.2" -DQLIBRARYINFO_EPOCROOT -DHB_EXPORT=Q_CORE_EXPORT -DQT_NO_DEBUG -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I../../mkspecs/linux-sb2-g++ -I. -I../../include -I../../include/QtCore -I.rcc/release-shared -Iglobal -I../../tools/shared -I../3rdparty/zlib -I../3rdparty/harfbuzz/src -I../3rdparty/md5 -I../3rdparty/md4 -I.moc/release-shared -o .obj/release-shared/qlibraryinfo.o global/qlibraryinfo.cpp
    global/qlibraryinfo.cpp:517:7: error: expected primary-expression before '/' token
    global/qlibraryinfo.cpp:517:7: error: 'lib' was not declared in this scope
    global/qlibraryinfo.cpp:517:7: error: 'ld' was not declared in this scope
    global/qlibraryinfo.cpp:517:7: error: request for member 'so' in '1', which is of non-class type 'int'
    global/qlibraryinfo.cpp:517:7: error: expected ',' or ';' before numeric constant
    make[1]: *** [.obj/release-shared/qlibraryinfo.o] Error 1

    I seems like the ELF_INTERPRETER define which is used in qlibraryinfo.cpp somehow gets screwed up so the compiler can't make anything out of it. As if it isn't encased in quotation marks.
    I am hoping someone might have any idea what is going on because I am starting to get stuck here.
    I am thankful for any suggestions or ideas that might help me solve this.

    My setup:
    I do everything from within a virtual machine running Ubuntu 12.04.
    I have setup a cross compiler for arm with crosstools-ng and I know that one is working because I have been using it to compile Qt and applications that use Qt successfully before, but not from within ScratchBox.
    I have compiled ScratchBox2 from source using version 2.2.4.
    I have prepared a rootfs like so(My final target will be a Raspberry Pi):
    @sudo debootstrap --no-check-gpg --verbose --arch armhf --foreign wheezy $HOME/sbox2/rootfs/raspbian/ http://mirrordirector.raspbian.org/raspbian@
    I have initialized my rootfs like so:
    @sb2-init raspbian $home/programming/cross/x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-gcc@

    And finally I try to compile a minimal version of Qt like this:
    @./configure -v -arch arm -prefix $HOME/programming/sysroots/test/usr/local/Trolltech/Qt-4.8.3 -xplatform linux-sb2-g++ -release -opensource -shared -fast -no-accessibility -no-qt3support -no-xmlpatterns -no-multimedia -no-audio-backend -no-phonon -no-phonon-backend -no-svg -no-webkit -no-javascript-jit -no-script -no-scripttools -no-declarative -no-declarative-debug -qt-zlib -no-gif -no-libtiff -no-libpng -no-libmng -no-libjpeg -no-nis -no-cups -no-iconv -no-dbus -nomake demos -nomake examples -no

    I use a mkspec that is just like the normal linux-g++ except that it overrides the compiler calls like so:
    QMAKE_CC = sb2 gcc
    QMAKE_CXX = sb2 g++
    QMAKE_LINK = sb2 g++
    QMAKE_LINK_SHLIB = sb2 g++
    QMAKE_AR = sb2 ar cqs
    QMAKE_OBJCOPY = sb2 objcopy
    QMAKE_STRIP = sb2 strip

Log in to reply