Double build of base dependency in Qt Creator 2.2.0



  • Hello everyone,

    I am using Qt Creator 2.2.0 (rev: 8c74bc10d4) on RHEL 5.4 (x86_64) at work

    I am currently experimenting to convert kdevelop/eclipse projects to QtCreator.
    So far everything goes well, everything builds separately.
    I was experimenting with the build dependencies but I came across something weird.

    I have a standard library called StandardLib. It contains many common stuff like string, containers etc.
    I also have two separated libraries, called LibA and LibB which are dependent on StandardLib but not each other.
    If I set the build dependencies for LibA to StandardLib and for LibB to StandardLib, they both build fine.

    The problem is with the following:
    I have a SpecialLib which is dependent on all three libraries. Because LibA and LibB are already dependent on StandardLib I though I would omit that one. So I set the dependencies to just LibA and LibB.
    First I started the build and it worked fine, but I didn't look at the output nor did I run any tests.

    Then I changed a thing or two in the SpecialLib and started the build and looked carefully at the output, to see if the make's and configures ran fine. What I saw is that the output of StandardLib is outputted twice.
    Something like:

    @
    Checking for gcc...yes
    Checking for gcc...yes
    Checking for g++...yes
    Checking for g++...yes
    @

    or.

    @
    g++ [g++ options] file1.cpp -o file1.o
    g++ [g++ options] file1.cpp -o file1.o
    g++ [g++ options] file2.cpp -o file2.o
    g++ [g++ options] file2.cpp -o file2.o
    @
    My guess is, because SpecialLib as two dependencies on StandardLib (one through LibA and one through LibB) the build is started twice.

    I would expect Qt Creator to be smart enough to filter out the second one and just start the build for StandardLib only once.

    Is this a bug? Perhaps I am missing something.
    Hopefully you may be of any help.

    Thanks in advance



  • How did you "convert"? Did you create a .pro file? If so, how does it look like?


  • Moderators

    Note that this is an issue of your build system of choice, not Qt Creator. I guess you are using a qmake (.pro-file) based project?



  • Thanks for your responses.

    At my work I imported several Makefile.am projects, added to build steps manually (make -f Makefile.dist, configure, make). Builds fine and the results runs the same as thouhg I would be using our build script.

    I also saw the problem with qmake projects from scratch at my Windows 7 Ultimate 64bit PC at home. Though that version is a little bit newer then the one in my first post, but it shows the exact same effects (still 2.2.0)

    I did the following to reproduce:

    create an empty project directory on disk (d:test). All projects hereafter use this directory as their base.

    started Qt Creator and created an new empty session called 'qt test'

    I first created a new project, Qt Widget Project - Qt Gui Application, called 'app'

    I created three new projects of type 'Other Project - C++ Library', all static libraries with name in this order: 'stdlib', 'libA', 'libB'. I added QtXml and QtXmlPatterns to libA

    I went to 'Projects' to set the dependencies as follows:

    • app depends on both libA and libB
    • libA depends on stdlib
    • libB depents on stdlib

    Now build

    Problem reproduced. It's stdlib that is shown twice in the buildlog.

    I'll hope it is usefull and you may come up with a solution.
    Thank you in advance.

    First I'll show the first part of the buildlog so you can see what I am talking about. Then the four .pro files.

    @Running build steps for project stdlib...
    Configuration unchanged, skipping qmake step.
    Configuration unchanged, skipping qmake step.
    Starting: "D:QtSDKmingwbinmingw32-make.exe"
    Starting: "D:QtSDKmingwbinmingw32-make.exe"
    D:/QtSDK/mingw/bin/mingw32-make -f Makefile.Debug
    D:/QtSDK/mingw/bin/mingw32-make -f Makefile.Debug
    mingw32-make[1]: Entering directory D:/test/stdlib-build-desktop' mingw32-make[1]: Entering directoryD:/test/stdlib-build-desktop'
    g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"....QtSDKDesktopQt4.7.3mingwincludeQtCore" -I"....QtSDKDesktopQt4.7.3mingwinclude" -I"....QtSDKDesktopQt4.7.3mingwincludeActiveQt" -I"debug" -I"..stdlib" -I"." -I"....QtSDKDesktopQt4.7.3mingwmkspecswin32-g++" -o debugstdlib.o ..stdlibstdlib.cpp
    g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"....QtSDKDesktopQt4.7.3mingwincludeQtCore" -I"....QtSDKDesktopQt4.7.3mingwinclude" -I"....QtSDKDesktopQt4.7.3mingwincludeActiveQt" -I"debug" -I"..stdlib" -I"." -I"....QtSDKDesktopQt4.7.3mingwmkspecswin32-g++" -o debugstdlib.o ..stdlibstdlib.cpp
    ar -ru debuglibstdlib.a debug/stdlib.o
    ar -ru debuglibstdlib.a debug/stdlib.o
    mingw32-make[1]: Leaving directory D:/test/stdlib-build-desktop' mingw32-make[1]: Leaving directoryD:/test/stdlib-build-desktop'
    The process "D:QtSDKmingwbinmingw32-make.exe" exited normally.
    The process "D:QtSDKmingwbinmingw32-make.exe" exited normally.
    Running build steps for project libA...
    Configuration unchanged, skipping qmake step.
    Starting: "D:QtSDKmingwbinmingw32-make.exe"
    D:/QtSDK/mingw/bin/mingw32-make -f Makefile.Debug
    mingw32-make[1]: Entering directory `D:/test/libA-build-desktop'
    g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_XMLPATTERNS_LIB -DQT_XML_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"....QtSDKDesktopQt4.7.3mingwincludeQtCore" -I"....QtSDKDesktopQt4.7.3mingwincludeQtXml" -I"....QtSDKDesktopQt4.7.3mingwincludeQtXmlPatterns" -I"....QtSDKDesktopQt4.7.3mingwinclude" -I"....QtSDKDesktopQt4.7.3mingwincludeActiveQt" -I"debug" -I"..libA" -I"." -I"....QtSDKDesktopQt4.7.3mingwmkspecswin32-g++" -o debugliba.o ..libAliba.cpp
    @

    The four pro files look as follows:
    app.pro
    @
    #-------------------------------------------------

    Project created by QtCreator 2011-07-10T17:11:54

    #-------------------------------------------------

    QT += core gui

    TARGET = app
    TEMPLATE = app

    SOURCES += main.cpp
    mainwindow.cpp

    HEADERS += mainwindow.h

    FORMS += mainwindow.ui

    @

    libA.pro
    @
    #-------------------------------------------------

    Project created by QtCreator 2011-07-10T17:14:02

    #-------------------------------------------------

    QT += xml xmlpatterns

    QT -= gui

    TARGET = libA
    TEMPLATE = lib
    CONFIG += staticlib

    SOURCES += liba.cpp

    HEADERS += liba.h
    unix:!symbian {
    maemo5 {
    target.path = /opt/usr/lib
    } else {
    target.path = /usr/lib
    }
    INSTALLS += target
    }
    @

    libB.pro
    @
    #-------------------------------------------------

    Project created by QtCreator 2011-07-10T17:14:29

    #-------------------------------------------------

    QT -= gui

    TARGET = libB
    TEMPLATE = lib
    CONFIG += staticlib

    SOURCES += libb.cpp

    HEADERS += libb.h
    unix:!symbian {
    maemo5 {
    target.path = /opt/usr/lib
    } else {
    target.path = /usr/lib
    }
    INSTALLS += target
    }

    @

    stdlib.pro
    @
    #-------------------------------------------------

    Project created by QtCreator 2011-07-10T17:13:02

    #-------------------------------------------------

    QT -= gui

    TARGET = stdlib
    TEMPLATE = lib
    CONFIG += staticlib

    SOURCES += stdlib.cpp

    HEADERS += stdlib.h
    unix:!symbian {
    maemo5 {
    target.path = /opt/usr/lib
    } else {
    target.path = /usr/lib
    }
    INSTALLS += target
    }
    @



  • I don't see any libs "usage", i.e. LIBS += ... and the output from the build looks indeed strange as every command seems to run twice.



  • Thanks for your reply Duck.

    The fact you are missing the libs usage is intentional. It doesn't matter whether they are there or not.
    The double run of commands is what I am pointing to.

    While the point is now clear, the question remains: Am I missing something or is this a bug and should I report this?

    Thanks in advance



  • The commands clearly should not run twice. I wonder whether they really do, or whether this is only some kind of display error in the Compile Output pane. There seem to be a few backslashes missing, too.



  • I'll try to look into this, to see if it is just displayed twice or also ran twice. If the latter, I guess it could be a potential for some troubles. If it just display, it is a mere annoyance (a big one though!)


Log in to reply
 

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