Results 1 to 3 of 3

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

  1. #1
    Join Date
    Jul 2012
    Posts
    13
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default 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 ( https://launchpad.net/linaro-toolchain-binaries/trunk/ ) 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 --> http://c2143.blogspot.com/?view=classic. 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++
    #
    include(../common/unix.conf)
    include(../common/gcc-base-unix.conf)
    include(../common/g++-unix.conf)
    include(../common/qws.conf)

    MAKEFILE_GENERATOR = MINGW
    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_INCDIR_QT = $$[QT_INSTALL_HEADERS]
    QMAKE_LIBDIR_QT = $$[QT_INSTALL_LIBS]
    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_CFLAGS += $$CODESOURCERY_ARM_CFLAGS
    QMAKE_CXXFLAGS += $$CODESOURCERY_ARM_CFLAGS
    QMAKE_LIBS += -lrt -lpthread -ldl
    QMAKE_LFLAGS += $${QMAKE_LFLAGS_RPATH}$$[QT_INSTALL_LIBS]
    !isEmpty(TARGET_QTDIR) {
    QMAKE_LFLAGS += $${QMAKE_LFLAGS_RPATH}$${TARGET_QTDIR}/lib
    }
    !isEmpty(TARGET_SYSROOT) {
    QMAKE_LFLAGS += $${QMAKE_LFLAGS_RPATH}$${TARGET_SYSROOT}/lib:$${TARGET_SYSROOT}/usr/lib
    QMAKE_LFLAGS += -Wl,--dynamic-linker=$${TARGET_SYSROOT}/lib/ld-linux.so.3
    }
    load(qt_config)

    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\libQtCore.so] 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 life:

    *.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
    -mfloat-abi=soft
    -mfloat-abi=hard

    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.

  2. #2
    Join Date
    Jul 2012
    Posts
    13
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

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

    UPDATE:

    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?

  3. The following user says thank you to phil999 for this useful post:

    andre_teprom (26th July 2013)

  4. #3
    Join Date
    Jul 2012
    Posts
    5
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

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

    phil999,
    I have been unsuccessful in rebuilding the configure.exe file as per mentioned in that post.
    And did you used the same parameters for configure.exe as mentioned in that link?

    Could you upload your configure.exe file somewhere so that I could use it without generating it...?

    Have a nice day.

    Regards,
    blueshift

Similar Threads

  1. Replies: 0
    Last Post: 10th July 2012, 21:16
  2. Replies: 5
    Last Post: 28th February 2011, 22:37
  3. Cant cross compile onto Windows CE 5
    By Willybood in forum Qt for Embedded and Mobile
    Replies: 4
    Last Post: 26th October 2010, 23:38
  4. How do experts compile Qt applications for Qt Embedded Linux on ARM?
    By likelaplace in forum Qt for Embedded and Mobile
    Replies: 2
    Last Post: 17th December 2009, 13:15
  5. QT 4.5 embedded Cross-compile for non-gui device
    By dsl in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 13th June 2009, 08:01

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.