Important: Please read the Qt Code of Conduct -

Qt 4.8 Cross Compile for Embedded Linux using Linaro Toolchain from Windows

  • I am trying to use the 2012.06 version of the Linaro Toolchain Windows Binary ( ) to cross-compile the Qt 4.8 source to target an embedded Linux ARM Cortex-8 board. I was able to do this with the CodeSourcery toolchain mentioned in this post --> But the target board software was built with the Linaro toolchain and so I am working towards that end.

    I have patched the mkspec mentioned in the post above to look like this:

    @ #
    # qmake configuration for building with arm-none-linux-gnueabi-g++

    CONFIG                 += no_import_libs no_generated_target_info
    # modifications to g++.conf
    QMAKE_CC                = arm-linux-gnueabihf-gcc
    QMAKE_CXX               = arm-linux-gnueabihf-g++
    QMAKE_LINK              = arm-linux-gnueabihf-g++
    QMAKE_LINK_SHLIB        = arm-linux-gnueabihf-g++
    QMAKE_LIB               = arm-linux-gnueabihf-ar
    QMAKE_AR                = arm-linux-gnueabihf-ar cqs
    QMAKE_OBJCOPY           = arm-linux-gnueabihf-objcopy
    QMAKE_STRIP             = arm-linux-gnueabihf-strip
    QMAKE_RUN_CC            = $(CC) -c $(CFLAGS) $(INCPATH) -o $obj $src
    QMAKE_RUN_CC_IMP        = $(CC) -c $(CFLAGS) $(INCPATH) -o $ $<
    QMAKE_RUN_CXX           = $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $obj $src
    QMAKE_RUN_CXX_IMP       = $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $ $<
    QMAKE_INCDIR            =
    QMAKE_MOC               = $$[QT_INSTALL_BINS]\\moc.exe
    QMAKE_UIC               = $$[QT_INSTALL_BINS]\\uic.exe
    QMAKE_IDC               = $$[QT_INSTALL_BINS]\\idc.exe
    QMAKE_COPY              = copy /y
    QMAKE_COPY_DIR          = xcopy /s /q /y /i
    QMAKE_MOVE              = move
    QMAKE_DEL_FILE          = del
    QMAKE_MKDIR             = mkdir
    QMAKE_DEL_DIR           = rmdir
    QMAKE_CHK_DIR_EXISTS    = if not exist
    QMAKE_IDL               = midl
    QMAKE_ZIP               = zip -r -9
    CODESOURCERY_ARM_CFLAGS = -march=armv7-a -mtune=cortex-a8 -mthumb -mfpu=vfp -mfloat-abi=softfp -Wa,-mimplicit-it=thumb -marm -mthumb-interwork
    #modifications to gcc-base.conf
    QMAKE_LIBS             += -lrt -lpthread -ldl
    !isEmpty(TARGET_QTDIR) {
    !isEmpty(TARGET_SYSROOT) {
        QMAKE_LFLAGS       += -Wl,--dynamic-linker=$${TARGET_SYSROOT}/lib/

    When I run mingw32-make on the top level Makefile in order to produce the Qt libraries for the ARM board it compiles for a while but inevitably errors with:

    @ collect2.exe: error: ld returned 1 exit status
    mingw32-make[1]: *** [....\lib\] Error 1
    mingw32-make[1]: Leaving directory `C:/Users/user/Desktop/qt_creator_toolchain...
    mingw32-make: *** [sub-corelib-make_default-ordered] Error 2@

    This error happens after many complaints like:
    *.so uses VFP register arguments, *obj does not@

    I've researched that error and have tried to pass each of the following options to my mkespec and rebuild with the same error:

    @ -mfloat-abi=softfp
    I am clearly not understanding why the '-mfloat-abi=softfp' option works fine with the CodeSourcery Windows toolchain but not Linaro. The rest of the compiler flags are shown in the mkspec above.

    Does anybody have any insight or thoughts on how to make this work? Thanks in advance.


    It turns out if I modify my C_FLAGS in the mkspec from this:

    @-march=armv7-a -mtune=cortex-a8 -mthumb -mfpu=vfp -mfloat-abi=softfp -Wa,-mimplicit-it=thumb -marm -mthumb-interwork@

    to this:

    @-march=armv7-a -mtune=cortex-a8 -mthumb -mfpu=neon -mfloat-abi=hard -Wa,-mimplicit-it=thumb -marm -mthumb-interwork@

    Then I can finally successfully compile Qt. How will this affect my performance / or ability to run a Qt App on the Board? Why can't I do softfp with Linaro but I can with CodeSourcery?

  • Hi,
    I am also building a qt applicaion for linaro ubuntu.
    I am able to build the apps bur while executing i m nt able to fire up the GUI.

  • Hi All,

    We are trying to run a Qt application on Xilinx ZC-702 board(running linaro ubuntu desktop).

    We have followed below mentioned steps, but GUI is not firing..

    1. qt-everywhere-opensource-src-4.7.3.tar.gz(Extract It)

    2. qmake.conf: either replace the qmake.conf in /home/user/qt-everywhere-opensource-src-4.7.3/mkspecs/qws/linux-arm-gnueabi-g++/qmake.onf Replace: arm-none-linux-gnueabi-gcc by arm-linux-gnueabihf-gcc

    3. Set the path: export CROSS_COMPILE=arm-linux-gnueabihf- export PATH=/usr/bin:$PATH export ZYNQ_QT_BUILD=/home/user/qt-everywhere-opensource-src-4.7.3 export ZYNQ_QT_INSTALL=/usr/local/Trolltech export PATH=$ZYNQ_QT_INSTALL/bin:$PATH

    4. ./configure -embedded armv7l -xplatform qws/linux-arm-gnueabi-g++ -little-endian -opensource -host-little-endian -confirm-license -prefix $ZYNQ_QT_INSTALL -qt-zlib -qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg -no-openssl -no-nis -no-cups -iconv -no-pch -no-dbus -qt-freetype -no-opengl -qt-gfx-linuxfb -qt-gfx-vnc -qt-gfx-qvfb

    5. make make -install copied the libraries to the target board.

    6. ./appname -qws -display QVFb:0 error: driver cannot connect Aborted
      ./appname -qws LinuxFb:mmwidth=1024:mmheight=768 this dsnt give any error but, its not launching the GUI but printing the log messages in terminal.

    can you tell What steps are missing here?

  • Lifetime Qt Champion


    qfvb is used on your host computer for when you want to test your application's GUI without a board (using i.e. an x86 QtEmbbeded)

    What does it print on your terminal ?

  • Hi,

    On x86 its working fine. We are getting the issues when we are trying to run the same application on target Board, for which i am using LinuxFb only.

    So could you suggest what step we are missing in order to compile the QT for target.

    When we are runnign the application on target I am getting the printf messages or qDebug messages in terminal but not able to fireup the GUI.

Log in to reply