Important: Please read the Qt Code of Conduct -

Building Qt from Git

  • Hello All.
    I am tryed to build Qt5 from Git
    git clone git:// qt5
    cd qt5
    perl init-repository
    unset QTDIR
    export PATH="$PWD/qtbase/bin:$PWD/qtrepotools/bin:$PATH"
    ./configure -developer-build -opensource -confirm-license -no-gtkstyle

    And got error.

    @/home/user/qt5/qtbase/qmake/library/qmakebuiltins.cpp: In member function ‘QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(int, const ProKey&, const ProStringList&)’:
    /home/user/qt5/qtbase/qmake/library/qmakebuiltins.cpp:1490:98: error: ‘system’ was not declared in this scope
    + QLatin1String(" && ") + == 0);
    make: *** [qmakebuiltins.o] Error 1

    Tell me please, what is wrong in my actions?

  • Moderators

    Please follow "the guide":

    Maybe you have checked out the dev branch, where things may fail occasionally.

  • I followed that guide last time.
    There was stable branch.

    Thank you for attention.

  • Moderators

    Are you sure you have installed all dependencies?

    What OS are you using (I know it's Linux or Mac, please be specific)?

  • I use Ubuntu 3.10.
    Yes, I installed dependencies listed in guide.

  • Moderators

    That should be working, then. You may have encountered a bug.

  • I will try to repeat all sequence and report about result. Thanks a lot.

  • I tryed, but error is still here

  • Moderators


    Did you clean your build tree before you tried to start a new build?

  • Hi,
    I cleared build dirrectory before new build.
    I tryed to build Qt on other PC with the same version of Ubuntu and it builded successfully. Obviosly, problem is in concrete enviroment.

  • After build I tryed to install Qt and got many errors like:
    make[3]: Entering directory /home/user/qt5/qtbase/src/tools/bootstrap' install -m 644 -p "../../../lib/libQt5Bootstrap.a" "/home/user/qt5/qtbase/lib/libQt5Bootstrap.a" install:../../../lib/libQt5Bootstrap.a' and `/home/user/qt5/qtbase/lib/libQt5Bootstrap.a' are the same file
    make[3]: [install_target] Error 1 (ignored)

    please, help me

  • Moderators

    Developer builds should not be installed, configure explicitly warns against doing that!

  • Why build is "development" if I took stable branch?
    And what i shoud do to use builded Qt?

  • I did all like in guide. And guide say
    To install, run
    make install

  • Moderators

    You use -developer-build flag. That implies building with a prefix set to $PWD/qtbase, which does not require installation (once it is build it is also installed).

    If the guide advises to install it after doing a developer build, then the guide is wrong. But just to be sure, please run the configure and see what it prints. If installation is not necessary, it will explicitly say so.

  • You are right. I do not delete " -developer-build" flag. Thank you.
    What should I do to use it now with Qt Creator? Qt Creator uses Qt 4.8 now.

  • Moderators

    Go to Tools->Preferences->Build & Run->Qt Versions and click "Add", then browse to your qmake binary (it's in <Qt dir>/qtbase/bin). That will add Qt to Qt Creator, but in order to use it, you need to create or modify an existing Kit.

    So, go to Kits tab and add a new one: you need to specify the compiler (the one you have used to compile Qt. If you use g++ and clang, they are binary compatible, so you can choose any of them) and your newly added Qt version.

    After that, Qt Creator will be fully configured. You can start using that Kit in your projects (open your project, go to Projects pane and add the new Kit).

  • when I add qmake, message "The default mkspec symlink is broken" appeared in status bar of "Qt Versions" tab. Is it critical?

  • Moderators

    I have never encountered that. Try if it works.

    You have not cleared your Qt directory after erroneously running "make install"? It might have broken some paths. But if it works, you are fine. If it does not, you can try overriding MKSPECS in Qt Creator's Kit settings.

  • No, it is not works - I can not chose Qt5 build configuration for new project.
    There is not "Kits" tab, but there is "Tool chains" tab. And there is "auto-detected" group, which contain GCC 64 and 32 bit.
    What is MKSPECS?

  • may be it will explain something :
    output of "qmake -query"

  • Moderators

    Oh, you are probably using an old version of Qt Creator, that is unfortunate. I advise an update.

    mkspecs is a thing Qt uses as a guide on how to create Makefiles for different platforms and compilers. You can take a look at how it looks like in <Qt dir>/qtbase/mkspecs.

    In your case, you probably need to specify linux-g++.

  • and this is putput of
    " /home/user/qt5/qtbase/bin/qmake -query"

    Please, tell, why new qmake is not used as default, if build == install in developer build?

  • isn't Qt Creator in Qt git repository? should I download it separately?

  • Moderators

    Qt does not add itself to PATH, especially developer builds. This allows you to use multiple versions of Qt in parallel, which is extremely useful.

    You can add it to PATH by hand, of course. Qt Creator does not need that, though: it automatically modifies the environment of binaries it executes.

  • Moderators

    [quote author="Mechatronic" date="1397127790"]isn't Qt Creator in Qt git repository? should I download it separately?[/quote]

    No, Qt Creator is a completely separate project. You can use the precompiled one, it will save you much time and effort, and work just as well.

  • sierdzio, you a really master. I installed qtcreator and built empty project - all works fine. Thank you very much.

    Now I try to build Marble project. It uses cmake and find Qt4 only. Should I add Qt5/qtbase/bin to PATH for it?

    @cmake -DCMAKE_BUILD_TYPE=Debug -DQTONLY=TRUE -DCMAKE_INSTALL_PREFIX=/usr ~/marble/sources
    -- Could NOT find Phonon (missing: PHONON_INCLUDE_DIR PHONON_LIBRARY)
    -- Could NOT find Phonon (missing: PHONON_INCLUDE_DIR PHONON_LIBRARY)
    -- Could NOT find quazip (missing: QUAZIP_INCLUDE_DIR QUAZIP_LIBRARIES)
    -- Could NOT find libshp (missing: LIBSHP_INCLUDE_DIR LIBSHP_LIBRARIES)
    -- Could NOT find libgps (missing: LIBGPS_INCLUDE_DIR LIBGPS_LIBRARIES)
    -- checking for module 'liblocation>=0.102'
    -- package 'liblocation>=0.102' not found
    -- checking for module 'QtLocation>=1.0.1'
    -- package 'QtLocation>=1.0.1' not found
    -- Could NOT find QtMobility (missing: QTMOBILITY_INCLUDE_DIR)
    -- Could NOT find libwlocate (missing: LIBWLOCATE_INCLUDE_DIR LIBWLOCATE_LIBRARIES)

    -- The following features have been enabled:

    • Unit tests , Build unit tests. Toggle with BUILD_MARBLE_TESTS=YES/NO. 'make test' will run all.
    • Qt Designer plugins , Marble widget support in Qt Designer. Toggle with WITH_DESIGNER_PLUGIN=YES/NO
    • Marble Desktop/Mobile applications , Build Marble Desktop/Mobile applications. Toggle with BUILD_MARBLE_APPS=YES/NO.

    -- The following REQUIRED packages have been found:

    -- The following features have been disabled:

    • Marble tools , Build various Marble tools for e.g. file format conversion. Toggle with BUILD_MARBLE_TOOLS=YES/NO.
    • Marble library C++ examples , Build C++ examples showing how to use the Marble library. Toggle with BUILD_MARBLE_EXAMPLES=YES/NO.

    -- The following OPTIONAL packages have not been found:

    • Phonon , cross-platform multimedia framework that enables the use of audio and video content ,
      Support for playback of soundcue elements
      Voice navigation (sound or human speakers)
    • QextSerialPort , access to serial ports ,
      Reading from serial port in APRS plugin
    • quazip , reading and writing of ZIP archives ,
      reading and displaying .kmz files
    • libshp , reading and writing of ESRI Shapefiles (.shp) ,
      reading and displaying .shp files
    • libgps , communicating with the GPS daemon ,
      position information via gpsd
    • liblocation , position information on Maemo 5 devices ,
      position information via GPS/WLAN for the Nokia N900 smartphone
    • QtMobility , a collection of APIs and frameworks ,
      Required for QtLocation to work
    • QtLocation , geographical support for position and map use ,
      position information via QtMobility QtLocation
    • libwlocate , WLAN-based geolocation ,
      Position information based on neighboring WLAN networks

    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/user/marble/build

  • Moderators

    Thank you, that is nice to hear :-)

    If it is based on Qt4, you need to use Qt4 for Marble. Using it with Qt5 would require porting. Porting from Qt4 to Qt5 in itself is not hard (usually can be done within an hour even for big projects), but I would not recommend doing that if you are not experienced in Qt.

    "Porting guide link":

  • No, this branch of Marble supports Qt5, but it is automatically define latest Qt version. I tryed with Ubuntu SDK, but it is contained Qt 5.0. I tryed official installer of Qt 5.2.1, but it is not work with Marble build system. Administrator of Marble forum sayed "It appears something is wrong with the installation of Qt 5 on your system - instead of using the official installer, could you try using your distribution packages instead?" and I tryed to build Qt5 from git.
    I should to do that, but I can not =(.

  • Moderators

    KDE projects use CMAKE build system, which is supported by Qt 5. But I have never used it myself so sadly I cannot help here. You can open a new thread about using/ compiling Qt 5 with cmake, maybe other forum users will be able to provide some information.

  • sierdzio, ok, thank you very much. I will open new topic. May be someone will help me.
    Thank you!

Log in to reply