Qt wiki will be updated on October 12th 2023 starting at 11:30 AM (EEST) and the maintenance will last around 2-3 hours. During the maintenance the site will be unavailable.

Get the Source

From Qt Wiki
Revision as of 08:33, 25 February 2015 by Maintenance script (talk | contribs)
Jump to navigation Jump to search


[toc align_right="yes" depth="3"]

English | 日本語 | Български

Get the source code

You can develop great Qt code using nothing more than Qt Creator and the final release of SDKs. Polished. Stable. Commercial grade.

On the other hand, if you want to be among the first developers to work with the latest Qt features, you can work with Qt's source code. Features don't get much fresher than that.

If you're ready to drink from the source, this article describes how to set up your local development environment, how to use Git to get Qt's source code, and how to build the libraries on your machine.

If you just want to browse source code online, use this link:

Setting up your machine

Qt can be built and developed on many different platforms. The operating systems for development are Mac OS X, Windows and Linux, with different requirements on compilers and third-party libraries. Developing Qt requires building it from source, therefore the standard requirements apply:

In addition you need to have Perl installed. This is standard on most Linux distributions and Mac OS X. Windows users can download "ActivePerl":http://www.activestate.com/activeperl/ for free. If you also want to build Qt/WebKit from sources, you will need to install Python as well. Windows users can download "ActivePython":http://www.activestate.com/activepython/ for free.

Qt's source code is developed using "Git":http://git-scm.com/, an open source, distributed version control system. You need to have Git >= 1.7.x installed.

For more information please see the separate Git_Installation wiki page.

Cloning Qt

If you want to contribute to the Qt Project, you should read how to set up Git for Gerrit use instead.

After setting up your machine by installing the required tools and libraries for building Qt download the source code by cloning the Qt Git repository, using the following commands:

Qt 4.x

 git clone git://gitorious.org/qt/qt.git
 cd qt

Qt 5

Getting the Qt 5 sources is a bit more complicated than Qt 4.x, due to the various Qt libraries being split into several repositories. Building-Qt-5-from-Git has the details on how to get the Qt 5 sources.

Behind a Company Firewall

If the clone process fails with "

unable to connect to socket

" it's likely that you are behind a firewall that blocks the Git protocol. First try replacing the clone URL with its HTTP equivalent,

http://git.gitorious.org/qt/qt.git

If that does not help, an alternate solution is to clone using the SSH protocol proxied though a HTTP proxy. This will also work for pushing changes.

Linux/Mac

First install "Corkscrew":http://www.mtu.net/~engstrom/ssh-proxy.php on your machine.

Next, edit your SSH config and add:

 Host *gitorious.org
 Hostname ssh.gitorious.org
 Port 443
 ProxyCommand corkscrew yourproxyhost yourproxyport %h %p

Windows

If you are using msysgit (full environment), ensure that the <msysgit>/mingw/bin is in your path, so you have access to the

connect.exe

application. If not, you can download it "here":http://chaos.troll.no/~marius/connect.exe, and place it somewhere in your path.

Connect.exe

is a standalone Windows console application, no MSys/Cygwin binaries required.

Next, edit your SSH config and add:

 Host '''gitorious.org
 Hostname ssh.gitorious.org
 Port 443
 ProxyCommand connect -H yourproxyhost:yourproxyport %h %p


Replacing

yourproxyhost

and

yourproxyport

with the hostname and port of your company's HTTP proxy. You should now be able to clone and push using the URL

git@gitorious.org:qt/qt.git

h2. Building Qt

Build Qt the same way you would for an official Qt release. The standard build/installation instructions apply:

"Supported platforms":http://doc.qt.io/qt-5/supported-platforms.html

"Installing Qt on Mac OS X":http://doc.qt.io/qt-5/macosx.html

Make sure that you have Perl installed and that it is working. If configure complains about not being able to find headers. It means that syncqt, a program run by configure could not find your Perl installation.

Generate the Documentation

Since the repository is just the source code rather than a complete package the HTML documentation pages are not include. If you use a repository for a previously released Qt version, then you can go to the "online documentation":http://doc.qt.io/qt or "download a package":http://www.qt.nokia.com/downloads.

For documentation that is not yet available online or through a package you have to generate the documentation yourself. To do that, run

 make docs

after running configure and building the libraries else.

What's Next?