Results 1 to 2 of 2

Thread: Configuring QtCreator (and/or qmake) for Ubuntu->Raspbian cross compile

  1. #1
    Join Date
    Jun 2012
    Posts
    193
    Thanks
    20
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Configuring QtCreator (and/or qmake) for Ubuntu->Raspbian cross compile

    I've been building Qt applications (Qt4.8) natively on raspberry pi (Raspbian) for some time now, with no issues ( The project has grown -- so now it takes a really long time to compile.

    I followed a nice tutorial (Hertaville) to set up cross-compilation on Ubuntu 12 for a Raspbian target. It works, and the performance improvement is huge (10 minutes down to about 30 seconds). However, the resulting flow doesn't use QtCreator, which I now really like and don't want to give up.

    So, the cross-compile toolchain is setup and working. The target file system is mounted, which I'd think would eliminate the need to rebuild any Qt binaries, but maybe not?

    I tried setting up a Qt version and tool chain in Qt Creator on the Ubuntu machine, but so far, without success. I've seen some issues with how toolchains and Qt versions are set up in QtCreator, and I'm beginning to think those might prevent me from doing what I want to do.

    Should I be able to do this somehow, maybe with QMAKESPECS or with qmake variables?

    Or, is it necessary to build a qmake from source if I want to use QtCreator to cross-compile (and debug) raspian applications from Ubuntu?
    Last edited by davethomaspilot; 7th December 2014 at 18:42.

  2. #2
    Join Date
    Jun 2012
    Posts
    193
    Thanks
    20
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Configuring QtCreator (and/or qmake) for Ubuntu->Raspbian cross compile

    Answering my own question, but I followed this tutorial to get cross-compilation of qt4 applicatins working outside qtcreator:

    hertaville.com/2014/04/12/cross-compiling-qt4-app/

    Then, instead of using the Makefile in that tutorial, I copied a mkspecs directory and edited its qmake.conf for the same configuration options:

    Qt Code:
    1. #
    2. # qmake configuration for linux-arm-g++
    3. #
    4.  
    5. CROSS_COMPILE = arm-linux-gnueabihf
    6. ROOTFS = /home/davethomaspilot/rpi/mntrpi
    7. MAKEFILE_GENERATOR = UNIX
    8. TARGET_PLATFORM = unix
    9. TEMPLATE = app
    10. CONFIG += qt warn_on release incremental link_prl gdb_dwarf_$
    11. QT += core gui
    12. QMAKE_INCREMENTAL_STYLE = sublib
    13.  
    14. include(../common/linux.conf)
    15. include(../common/gcc-base-unix.conf)
    16. include(../common/g++-unix.conf)
    17. QMAKE_CXX = $$CROSS_COMPILE-g++
    18. QMAKE_LINK = $$CROSS_COMPILE-g++
    19. QMAKE_LINK_SHLIB = $$CROSS_COMPILE-g++
    20. QMAKE_AR = $$CROSS_COMPILE-ar cr
    21. QMAKE_OBJCOPY = $$CROSS_COMPILE-objcopy
    22. QMAKE_STRIP = $$CROSS_COMPILE-strip
    23. QMAKE_LFLAGS_RELEASE = -Wl,-O1
    24. QMAKE_RPATHDIR += $$ROOTFS/lib/arm-linux-gnueabihf
    25. QMAKE_RPATHDIR += $$ROOTFS/usr/lib/arm-linux-gnueabihf
    26. QMAKE_INCDIR = $$ROOTFS/usr/include
    27. QMAKE_INCDIR_QT = $$ROOTFS/usr/include/qt4
    28. QMAKE_RPATHDIR = $$ROOTFS/lib/arm-linux-gnueabihf
    29. QMAKE_RPATHDIR += $$ROOTFS/usr/lib/arm-linux-gnueabihf
    30. QMAKE_LIBDIR = $$ROOTFS/usr/lib
    31. QMAKE_LIBDIR_QT = $$ROOTFS/usr/lib/arm-linux-gnueabihf
    32. QMAKE_LIBDIR_QT += $$ROOTFS/lib/arm-linux-gnueabihf
    33. QMAKE_INCDIR_X11 = $$ROOTFS/usr/include
    34. QMAKE_LIBDIR_X11 = $$ROOTFS/usr/lib/arm-linux-gnueabihf
    35. QMAKE_LIBDIR_X11 += $$ROOTFS/lib/arm-linux-gnueabihf
    36. QMAKE_INCDIR_OPENGL = $$ROOTFS/usr/include
    37. QMAKE_LIBDIR_OPENGL = $$ROOTFS/usr/lib
    38.  
    39. load(qt_config)
    To copy to clipboard, switch view to plain text mode 

    Then, as Wysota suggested in another thread, I used the -spec qmake option to specify the new "linux-arm-g++" mkspec.

    Works great and now I get fast compile times, less than a minute on my W520 laptop versus over 10 minutes using native compile on the rpi.

Similar Threads

  1. Configuring qmake to put files inside proper folder
    By Momergil in forum Qt Programming
    Replies: 3
    Last Post: 11th May 2014, 13:02
  2. Configuring Qt5 to compile mysql for android
    By KShots in forum Qt for Embedded and Mobile
    Replies: 2
    Last Post: 19th November 2013, 18:39
  3. Replies: 0
    Last Post: 10th July 2012, 22:16
  4. installing and configuring Qt on a laptop running Ubuntu 12.04
    By modoMojo in forum Installation and Deployment
    Replies: 5
    Last Post: 20th June 2012, 10:29
  5. Replies: 6
    Last Post: 3rd December 2010, 21:51

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.