[Original problem solved] Using different tool chains in creator


  • Moderators

    I have several application with a couple of libraries. These application I like to compile with different tool chains for different platforms. Since all source files are identical I have setup the pro file to have compilations with the different tool chains. The temporary files are on different directories and everything seems fine.
    Now I thought that I am able to set up different sessions to allow compilation with the different tool chains. Unfortunately, that does not work. I have cloned my session and adapted under project all settings to have another tool chain. However, it changes also the settings from the original session.
    Is there a way to change the tool chain without doing it each project individually?
    Thanks for any hints in advance.


  • Moderators

    Which version of Qt Creator are you using?

    So what exactly are you trying to do? Compile using different tool chains for different platforms -- so on windows you would use MSVC, on mac clang and on linux gcc?

    Why do you want to use sessions for that? A session is some set of open files, projects, breakpoints and bookmarks. If you are working on the same issue in a cross-platform environment then I would suggest using different build configurations in the same project instead. You can then switch between tool chains using the Project switcher (the icon right above the build/debug/run buttons). Just toggle the build configuration (Ctrl-T is the shortcut IIRC).

    Unfortunately that will not get you around the "setup for each project individually", but at least you do not have to keep doing it per session.


  • Moderators

    Thanks for answer.
    I am working with creator 2.2.0. The platform is Ubuntu. I want compile for debugging on the host and also do cross-compilation.
    I have switched the build configuration under Projects->Build settings , but does not seem to different from Ctrl-T.
    Under MSVC you can simply change from debug to release and press build. So I hoped that it may be similar with the creator.


  • Moderators

    Hmmm... Ctrl-T, Tab, arrow up/down, to switch the build configuration, ESC to close the dialog and Ctrl-B to trigger the build. Seems acceptable to me:-)


  • Moderators

    well, if you have to do this for let's 4 to 5 libs and the application, you may end up with a mess/mix if you are not careful.


  • Moderators

    Oh, your application consists of several distinct parts?

    Why don't you write a pro-file to bind them all together? The subdirs template works fine for that:-)


  • Moderators

    ok?
    First, yes, the application has several distinct parts. Respectively, I have a couple of applications sharing the same libs. The pressing problem is at the time for one application only. But certainly, it is good to a more general solution.
    Can you give me a hint on specific doc with an example?


  • Moderators

    [quote author="koahnig" date="1306826849"]
    Can you give me a hint on specific doc with an example? [/quote]
    I should have googled first. :-) I am coming back if I struggle with what I have found. Thanks anyway.



  • [quote author="Tobias Hunger" date="1306785408"]Hmmm... Ctrl-T, Tab, arrow up/down, to switch the build configuration, ESC to close the dialog and Ctrl-B to trigger the build. Seems acceptable to me:-)[/quote]
    Very good... from now it will be my building procedure too. :-D

    koahnig,
    if I undertood what you need you should do this in your .pro:
    @
    ...
    ...
    linux-g++ {
    #queste 4 righe seguenti servono per qextserialport:
    INCLUDEPATH += ../qextserialport_x86
    QMAKE_LIBDIR += ../qextserialport_x86/build
    LIBS += -lqextserialport
    DEFINES = TTY_POSIX
    }

    linux-arm-gnueabi-g++ {
    #queste 4 righe seguenti servono per qextserialport:
    INCLUDEPATH += ../qextserialport_beagle
    QMAKE_LIBDIR += ../qextserialport_beagle/build
    LIBS += -lqextserialport
    DEFINES = TTY_POSIX
    }
    @

    I use this to compile for my linux pc and to cross-compile for my beagleboard using qextserialport library.

    Remember that before this you need to compile the library for both platform and put it in different directories .


  • Moderators

    Luca, thanks for info.

    I will try it. With a little trial and error I ended with something like:

    @
    ...
    ...
    Host: INCLUDEPATH += ../qextserialport_x86
    Arm: INCLUDEPATH += ../qextserialport_beagle
    Host: QMAKE_LIBDIR += ../qextserialport_x86/build
    Arm: QMAKE_LIBDIR += ../qextserialport_beagle/build
    Host: LIBS += -lqextserialport
    Arm: LIBS += -lqextserialport
    DEFINES = TTY_POSIX
    @
    which could be rewritten as:
    @
    ...
    ...
    Host {
    INCLUDEPATH += ../qextserialport_x86
    QMAKE_LIBDIR += ../qextserialport_x86/build
    LIBS += -lqextserialport
    }
    Arm {
    INCLUDEPATH += ../qextserialport_beagle
    QMAKE_LIBDIR += ../qextserialport_beagle/build
    LIBS += -lqextserialport
    }
    DEFINES = TTY_POSIX
    @

    Arm or Host is set through the parameter list with "CONFIG+=Arm" for instance. I knew that it is a little wooden, but it worked and elegance was not my major target.

    Now following your example, I may simplify also other steps, but I am not clear how to know the parameter "linux-arm-gnueabi-g++" or the slightly different version I probably need.
    Is it one of the commands in *.conf?
    Or is it the directory name where the conf is stored?

    BTW I have generated a Qt version for cross compilation and that part is working. I have copied and adjusted for compiler path names a directory in "mkspecs/qws".



  • [quote author="koahnig" date="1306839404"] I am not clear how to know the parameter "linux-arm-gnueabi-g++" or the slightly different version I probably need.

    [/quote]

    To know it you must enter your Qt source (mine is in /opt/qt4-4.7.1 and /opt/qt4-4.7.1-beagle) and type:
    @
    ls -l /opt/qt4-4.7.1/mkspecs/default
    @
    it's a symbolic link. I get this:
    @
    lrwxrwxrwx 1 root root 9 Dec 16 21:03 /opt/qt4-4.7.1/mkspecs/default -> linux-g++
    @
    so I must use linux-g++ when compiling for my linux PC.

    While for my beagleboard (arm) :
    @
    ls -l /opt/qt4-4.7.1-beagle/mkspecs/default
    @
    I get:
    @
    /opt/qt4-4.7.1-beagle/mkspecs/default -> qws/linux-arm-gnueabi-g++/
    @

    So I must use "linux-arm-gnueabi-g++" .

    That's all .

    Let me know...


  • Moderators

    Yes, this does work.
    The names you are determining through the symbolic link are the same as used for the -spec parameter used by creator for qmake.

    Currently, I am struggling with the CONFIG parameter. I assumed that it contains either "debug" or "release". In creator you have the choices between "Debug", "Release" and "Debug and release".

    I have added following statement to the .pro file:
    @
    message ("CONFIG = " $$CONFIG)
    @

    For debug the output is:
    @
    Project MESSAGE: CONFIG = lex yacc warn_on debug uic resources qt warn_on release incremental link_prl def_files_disabled no_mocdepend release stl qt_no_framework debug Arm staticlib
    @

    For release the output is:
    @
    Project MESSAGE: CONFIG = lex yacc warn_on debug uic resources qt warn_on release incremental link_prl def_files_disabled no_mocdepend release stl qt_no_framework Arm staticlib
    @

    For "Debug and release" the output is:
    @
    Project MESSAGE: CONFIG = lex yacc warn_on debug uic resources debug DebugBuild Debug build_pass qt warn_on release incremental link_prl def_files_disabled no_mocdepend release stl qt_no_framework debug_and_release Arm debug DebugBuild Debug build_pass staticlib
    @

    in qmake doc for "CONFIG":http://doc.qt.nokia.com/4.7/qmake-variable-reference.html#config
    you can read that "relase" is ignored when "debug" is present. But the release and debug settings are containing both.

    Am I compiling the whole time in debug mode even when switched to release?

    I understand where the last (two/three) parameters in each CONFIG are coming from, but not the majority in the beginning.



  • I can't help you but a fast check to a debug or release building consist in checking executable file size.
    Debug building generate a bigger file...

    I think someone in the DevNet can help you better... :-)


  • Moderators

    @Luca
    Thanks for your input. It is appreciated.

    Let us see, if someone is able to open the Gordean knot with CONFIG :-)


  • Moderators

    The original problem is solved through the subdirs template of qmake.

    Here is the example of my case
    @
    TEMPLATE = subdirs
    CONFIG += ordered
    SUBDIRS =
    ALib
    BLib
    CLib
    DLib
    Applications/Appl1
    @

    Each directory needs a .pro-file with the same name as the directory name is.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.