Queries regarding the running the init-repository after downloading the Qt source code
I have downloaded Qt source code and ran ./init-repository,
but i observed in https://wiki.qt.io/Building_Qt_5_from_Git documentation , under the topic Getting the source code about cloning the Qt source code . Again why do we need to provide following commands.
- $ cd qt5
$ perl init-repository
In order to build a specific release of Qt, you can checkout the desired tag (but only after init-repository has been run):
$ cd qt5
$ git checkout v5.7.0
Should the above method fail, an alternative way to build a specific release or branch of Qt5 (although without linking of the gerrit account for code reviewing) is to use git submodule update --init in place of the init-repository script. That translates to:
$ git clone https://code.qt.io/qt/qt5.git # cloning the repo
$ cd qt5
$ git checkout v5.7.0 # checking out the specific release or branch
$ git submodule update --init # updating each submodule to match the supermodule
Question is : already we have qt5 folder the above stated commands will create one more qt5 folder and to run again init-repository for cloning sub modules. then to checkout branch. is it necessary to have a clone of clone again, please suggest me . The answer will help me out to configure and build the source code.
- $ cd qt5
No there no need to re-clone. Call
git pullto update your tree and
git submodule updateto update the submodules.
thank you for the reply , i will run the following commands. and proceed to build the source code
it is updated, thanks for the reply.
Now i need to configure http://doc.qt.io/qt-5/configure-options.html
is the steps mandatory to configure.
Yes, the first time you build Qt you have to call configure.
i am using the command
- configure -developer-build -opensource -nomake examples -nomake tests -confirm-license
for configuring in Qt path and it specified that
Qt is configured.
after configuration it specified to use * make * command.
is the steps correct.
- After configure is completed should i have to use make command or can i use Qt creator to build the source code. both the ways can it be done.
Unless you plan to add features/fix bugs in Qt, drop the -developer-build option.
Since you will build all of Qt, just use the make -jX command where X is
num_of_core * 2 + 1. That will keep your machine busy.
I want to contribute to Qt so asking the questions, will you guide me. I have configured, now i am trying to build it. was my analysis correct about building using make .
second question is how to clean the Qt source code , so that i can configure in another build directory and use make.
What analysis ?
The best way is to do out of source builds so you don't have any artifacts in the sources and if there's a problem you can just nuke the folder and start again or have several parallel builds.
i used git submodule foreach --recursive "git clean -dfx" command to clean the clone , so my previous second question is solved.
and as you specified i used another build folder and made it separate it separate from source folder.
coming to previous first question i used configure command to configure.
then i used simply make instead of make -jx , so is their any problem ?.
make files got created in build directory.
No problem with calling only
make. The downside is that the compilation will take way longer than if you put all the available power of your machine on it.
i have few questions
- I didnt run ./init-repository for QtWebkit,QWebkit-examples,QtWebEngine, is this required for building source code through Qt Creator.
- And can we run Qt source code from Qt Creator as Desktop kit configured for linux.
3)I am facing issues using Qt creator, i am getting connection terminated, but using make command through terminal, i didnt get connection terminated.
please guide me , require your assisstance in building source code through Qt Creator.
No, they are optional modules. If you don't use them, just don't build them as they are pretty big and expensive to build.
Don't open the whole Qt project in Qt Creator. Only the part you'll be working on. The qtbase module itself is composed of more than 18000 files.
Personally, I always build Qt on the console.
thanks you for your answer,
- But still if i do the changes and want to compile and see the changes what do i do.
What do you mean by that ?
You'll need to run a unit test or a small application that validates your changes.
i have taken sub modules in Qt, having a query.
- do we need to have desktop kit configured for compiling source code.
or do we need to configure using the qmake , generated by qt source code. ( i am using linux machine).
- do we need to have desktop kit configured for compiling source code.
If you want to build one of the modules through Qt Creator, you have to make a kit with your custom built Qt.
yes i have configured the kit with custom built of Qt, i have compiled few modules , thanks for the answer.
i found that qtbase submodule is not compiling, because qconfig.h and qconfig.cpp is not found, but when i used make command to build the Qt source code through terminal, i found those classes in build folder, but not in Qt source code.
do i have to copy from build folder to Qt source code, or do i have to run , update and ./init-repository once again for getting those classes for qtbase.?.
the answer will be valuable for compiling the qtbase submodule.
For the qtbase module, do the initial build on the command line. Once it's done you can start hacking on it.
i have two folders qt5 (which is the source folder) and qt-build(which is the build folder)
i am using qt-build folder to use make command for compilation.
after moving into directory qt-build.
after moving to qt-build folder , i used the following command to compile in terminal.
qt-build : make module-qtbase ,
and opened qtbase submodule from qt5(source folder) in Qt creator for compilation, again its showing qconfig.cpp and qconfig.h is not present connection terminated.
so what do i need to do for getting qconfig.h and qconfig.cpp files to qtbase of qt5(source folder) , i observed qconfig.h and qconfig.cpp files are present in qtbase of qt-build folder.
even though compiling in terminal , not able to view in Qt as files are not present.
please guide me o compile this submodule in Qt creator, rest of the sub modules compiled in Qt creator without any errors.
i am getting this error
/root/qt5/qtbase/src/corelib/global/qlibraryinfo.cpp:60:23: fatal error: qconfig.cpp: No such file or directory
make: *** [.obj/qlibraryinfo.o] Error 1
make: Leaving directory
/root/b/src/corelib' make: *** [sub-corelib-make_first] Error 2 make: Leaving directory/root/b/src'
make: *** [sub-src-make_first] Error 2
i searched for qconfig.h and qconfig.cpp in qtbase submodule of Qt source folder, i didnt find.
but in build directory , i found in the respective qtbase submodule,
please provide necessary help.
should i copy from build folder to source folder?.
No, don't copy anything around, these are generated files.
Use the Import build option when configuring the project.
In any case, what part of qtbase do you plan to hack on ?
i posted the previous question because i was compiling the sub modules using the configured kit of custom built Qt,
more than 25 sub modules was compiled, so was eager to know why qtbase was not compiling , because of qconfig files, any other configuration has to be done for the qtbase submodule?. for compiling using Qt creator.
qtbase is a special case. Like the name implies it contains all the code which the other modules are built upon.
Again, what part of qtbase do you plan to work on ?
Yes qtbase is a special module which is the base.
And i was able to compile with the kit configured from the customized built of Qt source code,of the qmake used.
Thanks friends for your solutions provided which helped me to compile the qt5 Source code.
Then please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)
Thank you so much for your guidance which helped me to build Qt source code.
It is good to learn about using custom built Qt.
As again coming back to Qt source code after a long time,
i was following the same steps as i followed earlier on how to configure the qt.
Earlier it was working.
Again i cloned qt5.9
while configuring i got the error as
user@user-Inspiron-3558:~/Documents/qtsourcecode_contibution/qt-build$ ../qt5/configure -developer-build -opensource -nomake examples -nomake tests
- cd qtbase
- /home/user/Documents/qtsourcecode_contibution/qt5/qtbase/configure -top-level -developer-build -opensource -nomake examples -nomake tests
Please make sure to unset the QMAKESPEC, XQMAKESPEC, QMAKEPATH,
and QMAKEFEATURES environment variables prior to building Qt.
Why i am getting this error?. do i need to do any other configuration?.
Do you have any of these environment variables defined ?
how do i check how these variables defined, and where it has to be defined?.
@Pradeep-Kumar In the same terminal: call "env" and see whether any of those variables is in the output.
Or just do: