Results 1 to 20 of 35

Thread: Configuring Qmake mkspecs after it's built

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2012
    Posts
    219
    Thanks
    28
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Configuring Qmake mkspecs after it's built

    I don't know if it's really even possible (see related thread on this forum that had no replies), but the 4.8 documentation says that an environment variable "QMAKESPEC" can be set to specify mkspecs:

    The QMAKESPEC environment variable can contain any of the following:
    A complete path to a directory containing a qmake.conf file. In this case qmake will open the qmake.conf file from within that directory. If the file does not exist, qmake will exit with an error.
    However, while qmake does not exist with an error, setting the QMAKESPEC environment doesn't seem to have any effect:


    Qt Code:
    1. davethomaspilot@ubuntu:/usr/share/qt4/mkspecs/linux-arm-g++$ echo $QMAKESPEC
    2. /usr/share/qt4/mkspecs/linux-arm-g++
    3. davethomaspilot@ubuntu:/usr/share/qt4/mkspecs/linux-arm-g++$ ls $QMAKESPEC
    4. qmake.conf qplatformdefs.h
    5. davethomaspilot@ubuntu:/usr/share/qt4/mkspecs/linux-arm-g++$ qmake -query
    6. QT_INSTALL_PREFIX:/usr
    7. QT_INSTALL_DATA:/usr/share/qt4
    8. QT_INSTALL_DOCS:/usr/share/qt4/doc
    9. QT_INSTALL_HEADERS:/usr/include/qt4
    10. QT_INSTALL_LIBS:/usr/lib/x86_64-linux-gnu
    11. QT_INSTALL_BINS:/usr/bin
    12. QT_INSTALL_PLUGINS:/usr/lib/x86_64-linux-gnu/qt4/plugins
    13. QT_INSTALL_IMPORTS:/usr/lib/qt4/imports
    14. QT_INSTALL_TRANSLATIONS:/usr/share/qt4/translations
    15. QT_INSTALL_CONFIGURATION:/etc/xdg
    16. QT_INSTALL_EXAMPLES:/usr/lib/qt4/examples
    17. QT_INSTALL_DEMOS:/usr/lib/qt4/demos
    18. QMAKE_MKSPECS:/usr/share/qt4/mkspecs
    19. QMAKE_VERSION:2.01a
    20. QT_VERSION:4.8.1
    To copy to clipboard, switch view to plain text mode 

    Here's what's in the qmake.conf in the directory specified by the QMAKESPEC env variable:

    #
    # qmake configuration for linux-g++
    #

    MAKEFILE_GENERATOR = UNIX
    TARGET_PLATFORM = unix
    TEMPLATE = app
    CONFIG += qt warn_on release incremental link_prl gdb_dwarf_index
    QT += core gui
    QMAKE_INCREMENTAL_STYLE = sublib

    include(../common/linux.conf)
    include(../common/gcc-base-unix.conf)
    include(../common/g++-unix.conf)
    QMAKE_CC = $CROSS_COMPILE-gcc
    QMAKE_CXX = $CROSS_COMPILE-g++
    QMAKE_LINK = $CROSS_COMPILE-g++
    QMAKE_LINK_SHLIB = $CROSS_COMPILE-g++
    QMAKE_AR = $CROSS_COMPILE-ar cr
    QMAKE_OBJCOPY = $CROSS_COMPILE-objcopy
    QMAKE_STRIP = $CROSS_COMPILE-strip
    QMAKE_LFLAGS_RELEASE = -Wl,-O1,-rpath $ROOTFS/usr/lib
    QMAKE_INCDIR = $ROOTFS/usr/include
    QMAKE_LIBDIR = $ROOTFS/usr/lib
    QMAKE_INCDIR_X11 = $ROOTFS/usr/include
    QMAKE_LIBDIR_X11 = $ROOTFS/usr/lib
    QMAKE_INCDIR_OPENGL = $ROOTFS/usr/include
    QMAKE_LIBDIR_OPENGL = $ROOTFS/usr/lib

    load(qt_config)
    davethomaspilot@ubuntu:/usr/share/qt4/mkspecs/linux-arm-g++$
    Can qmake be configured to use different mkspecs after being built?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Configuring Qmake mkspecs after it's built

    Why do you say it didn't work?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jun 2012
    Posts
    219
    Thanks
    28
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Configuring Qmake mkspecs after it's built

    Why do you say it didn't work?
    1) Note the value of the qmake variable QMAKE_MKSPECS
    QMAKE_MKSPECS:/usr/share/qt4/mkspecs
    2) Changing the value of the $QMAKESPEC env variable to a non-existant location doesn't cause any error when running qmake.
    3) I get invalid qt version message in QtCreator when using qmake and trying to set a cross compile tool chain, regardless of whether $QMAKESPEC is set. It configures ok for local build which uses the qmake's qmakespec as configured for build

    Is it possible to do what I'm trying to do and I'm just missing something?

    Thanks,

    Dave Thomas

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Configuring Qmake mkspecs after it's built

    Quote Originally Posted by davethomaspilot View Post
    1) Note the value of the qmake variable QMAKE_MKSPECS
    QMAKE_MKSPECS:/usr/share/qt4/mkspecs
    2) Changing the value of the $QMAKESPEC env variable to a non-existant location doesn't cause any error when running qmake.
    3) I get invalid qt version message in QtCreator when using qmake and trying to set a cross compile tool chain, regardless of whether $QMAKESPEC is set. It configures ok for local build which uses the qmake's qmakespec as configured for build

    Is it possible to do what I'm trying to do and I'm just missing something?
    For me it works:
    qmake Code:
    1. !build_pass {
    2. linux-*:message(LINUX)
    3. win32-*:message(WINDOWS)
    4. }
    To copy to clipboard, switch view to plain text mode 

    QMAKESPEC=/home/wysota/Qt/5.3/gcc_64/mkspecs/win32-g++ qmake

    yields:
    Project MESSAGE: WINDOWS

    Changing the specs will not modify the value of qmake variables, why would it? You are still within the same qmake installation.

    Also remember you can always pass a different specs to qmake using the -spec parameter:

    qmake -spec windows-g++
    Last edited by wysota; 10th December 2014 at 12:59.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. The following user says thank you to wysota for this useful post:

    davethomaspilot (10th December 2014)

  6. #5
    Join Date
    Jun 2012
    Posts
    219
    Thanks
    28
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Configuring Qmake mkspecs after it's built

    Thanks for the reply. It helps a lot to know it SHOULD work.

    Maybe it's just QtCreator configuration issues. When I went back to native build on Raspberry Pi using QtCreator I kept getting messages about invalid Qt version when I tried going back to the native qmake. Turns out the real problem was that the build output directory was still pointing to the directory I was going to use on the ubuntu compiling machine--which doesn't exist from the RPI's point of view.

    So, given this bad error message, I suspect several errors cause the same "invalid qt version" error. I think what's really happening is that the qmake selection doesn't change when other errors occur, so if it was invalid, it stays invalid until the other issues are fixed.

    At least that's the path I'm going down next. I'll try get qmake working (creating makefiles with cross-compile toolchain) outside QtCreator, then use QtCreator using the -spec parameter if needed (I think I saw a thread indicating that may be required for cross-compiling).

    Does remote debugging work from QtCreator 4.8 on Ubuntu with rpi as target? Haven't tried yet, but if it doesn't I'm less enthused about going to cross-compilation development.

    I suspected the QMAKE_MKSPECS only indicated what was configured at build time, but there's nothing in the documentation (that I could find) that clarifies this.

    Thanks!

  7. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Configuring Qmake mkspecs after it's built

    Quote Originally Posted by davethomaspilot View Post
    Does remote debugging work from QtCreator 4.8 on Ubuntu with rpi as target?
    Qt Creator's current version is 3.3 so I can't say whether it will work in 4.8

    Haven't tried yet, but if it doesn't I'm less enthused about going to cross-compilation development.
    I don't see why it shouldn't if you have gdbserver for Pi available.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #7
    Join Date
    Jun 2012
    Posts
    219
    Thanks
    28
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Configuring Qmake mkspecs after it's built

    So, I got it working using the -spec option like Wysota suggested.

    Thanks!


    Added after 1 27 minutes:


    I don't see why it shouldn't if you have gdbserver for Pi available.
    Yes, it works fine using the RPI gdbserver if I manuall start the gdbserver on the RPI and specify the debuggee (target) executable name.

    It would be nice if QtCreator would launch gdbserver on the remote machine, but I don't see how to do that in the docs. I tried using Debug->Start Debugging->Start and Debug Remote Application, but that didn't work. Does QtCreator support this -- automatic launching gdbserver and the target app on the remote machine?
    Last edited by davethomaspilot; 13th December 2014 at 18:26.

  9. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Configuring Qmake mkspecs after it's built

    Quote Originally Posted by davethomaspilot View Post
    It would be nice if QtCreator would launch gdbserver on the remote machine, but I don't see how to do that in the docs.
    Debug -> Start Debugging -> Start Remote Debug Server Attached to Process...
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  10. #9
    Join Date
    Jun 2012
    Posts
    219
    Thanks
    28
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Configuring Qmake mkspecs after it's built

    Debug -> Start Debugging -> Start Remote Debug Server Attached to Process..
    That action isn't there in QtCreator 2.4.1. Under Debugging->Start Debugging, the remote debugging actions are:



    • Start Remote Debug Server
    • Attach to Remote Debug Server
    • Start and Debug Remote application



    "Start Debug Server" seems to be presenting a list of running processes on the target. That seems more like something that should be labelled "attach to process on remote machine", but I haven't tried this action.

    "Attach to Remote Debug server" works, but only if I first launch the application under gdbserver first on the target platform. That's what I'm doing now.

    "Start and Debug Remote application" sounds like the action I want, but when I try it, I get the message "Debugging has finished" in the application output window. The remote application never started.

    Do I need to set up a start script on the host that gets executed on the target to launch gdbserver?

    I'm just trying to get as tight a compile-test-debug-edit-compile cycle as possible. Now it's really quick compared to native RPI development. so while having to switch context to ssh, vnc, or target console to launch gdbserver is not a big deal, if support for automatic launch of a remote target process (and gdbserver) is in QtCreator there I want to use it.

  11. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Configuring Qmake mkspecs after it's built

    Quote Originally Posted by davethomaspilot View Post
    That action isn't there in QtCreator 2.4.1.
    That's a really ancient version. Why don't you upgrade to 3.x?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  12. #11
    Join Date
    Jun 2012
    Posts
    219
    Thanks
    28
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Configuring Qmake mkspecs after it's built

    I'm using Ubuntu 12. 2.4.1 is the latest qtcreator available for it, according to apt-get.

    I started with a new version of Ubuntu, but the ia32-lib that's required for cross-compiling to a raspberry pi target isn't available for the newer Ubuntu releases. I spent a lot of time trying work-arounds with no success and got nothing but silence when I asked on various forums if anyone had a solution that didn't require a 12.x Ubuntu host.

    Will qtcreator 3.x work on Ubuntu 12? Can I get binaries using apt-get from somewhere, or would I have to build it? If I have to build it, can I use the qt4.8 binaries on that system? if I have to move up to qt5.x, then I have another pile o stuff to do to get qt5 up and going on the rpi.

    Thanks,

    Dave Thomas

Similar Threads

  1. Replies: 1
    Last Post: 13th December 2014, 17:08
  2. Configuring qmake to put files inside proper folder
    By Momergil in forum Qt Programming
    Replies: 3
    Last Post: 11th May 2014, 12:02
  3. Replies: 6
    Last Post: 3rd December 2010, 20:51
  4. Replies: 5
    Last Post: 25th September 2007, 10:43
  5. 4.1.4 built from source, qmake fails with Hello World
    By Mookie in forum Installation and Deployment
    Replies: 6
    Last Post: 27th June 2006, 23:13

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.