Get the source: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
'''English''' | [[Get-The-Source-Japanese|日本語]] | [[Get-The-Source-Bulgarian|Български]]
[[Category:Developing_Qt::Instructions]]


=Get the source code=
[toc align_right="yes" depth="3"]


You can develop great Qt code using nothing more than Qt Creator and the final release of <span class="caps">SDK</span>s. Polished. Stable. Commercial grade.
'''English''' | [[Get The Source Japanese|日本語]] | [[Get The Source Bulgarian|Български]]


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.
= Get the source code =


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.
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:
If you just want to browse source code online, use this link:
Line 13: Line 17:
* https://qt.gitorious.org/qt
* https://qt.gitorious.org/qt


==Setting up your machine==
== 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:
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:


* Qt for Embedded Linux Requirements [http://doc.qt.io/qt-4.8/requirements-embedded-linux.html Qt 4] ''[qt.io]''
* Qt for Embedded Linux Requirements &quot;Qt 4&amp;quot;:http://doc.qt.io/qt-4.8/requirements-embedded-linux.html
* Qt for Mac OS X Requirements: [http://doc.qt.io/qt-4.8/requirements-mac.html Qt 4] ''[qt.io]'' [http://doc.qt.io/qt-5/macosx-requirements.html Qt 5] ''[qt.io]''
* Qt for Mac OS X Requirements: &quot;Qt 4&amp;quot;:http://doc.qt.io/qt-4.8/requirements-mac.html &quot;Qt 5&amp;quot;:http://doc.qt.io/qt-5/macosx-requirements.html
* Qt for Windows CE Requirements: [http://doc.qt.io/qt-4.8/requirements-wince.html Qt 4] ''[qt.io]'' [http://doc.qt.io/qt-5/requirements-wince.html Qt 5] ''[qt.io]''
* Qt for Windows CE Requirements: &quot;Qt 4&amp;quot;:http://doc.qt.io/qt-4.8/requirements-wince.html &quot;Qt 5&amp;quot;:http://doc.qt.io/qt-5/requirements-wince.html
* Qt for Windows Requirements: [http://doc.qt.io/qt-4.8/requirements-win.html Qt 4] ''[qt.io]'' [http://doc.qt.io/qt-5/windows-requirements.html Qt 5] ''[qt.io]''
* Qt for Windows Requirements: &quot;Qt 4&amp;quot;:http://doc.qt.io/qt-4.8/requirements-win.html &quot;Qt 5&amp;quot;:http://doc.qt.io/qt-5/windows-requirements.html
* Qt for X11 Requirements [http://doc.qt.io/qt-4.8/requirements-x11.html Qt 4] ''[qt.io]'' [http://doc.qt.io/qt-5/linux-requirements.html Qt 5] ''[qt.io]''
* Qt for X11 Requirements &quot;Qt 4&amp;quot;:http://doc.qt.io/qt-4.8/requirements-x11.html &quot;Qt 5&amp;quot;:http://doc.qt.io/qt-5/linux-requirements.html


In addition you need to have Perl installed. This is standard on most Linux distributions and Mac OS X. Windows users can download [http://www.activestate.com/activeperl/ ActivePerl] ''[activestate.com]'' for free. If you also want to build Qt/WebKit from sources, you will need to install Python as well. Windows users can download [http://www.activestate.com/activepython/ ActivePython] ''[activestate.com]'' for free.
In addition you need to have Perl installed. This is standard on most Linux distributions and Mac OS X. Windows users can download &quot;ActivePerl&amp;quot;: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 &quot;ActivePython&amp;quot;:http://www.activestate.com/activepython/ for free.


Qt’s source code is developed using [http://git-scm.com/ Git] ''[git-scm.com]'', an open source, distributed version control system. You need to have Git &gt;= 1.7.x installed.
Qt's source code is developed using &quot;Git&amp;quot;:http://git-scm.com/, an open source, distributed version control system. You need to have Git &gt;= 1.7.x installed.


For more information please see the separate [[Git Installation|Git_Installation]] wiki page.
For more information please see the separate [[Git_Installation]] wiki page.


==Cloning Qt==
== Cloning Qt ==


If you want to contribute to the Qt Project, you should read how to [[Setting-up-Gerrit|set up Git for Gerrit use]] instead.
If you want to contribute to the Qt Project, you should read how to [[Setting-up-Gerrit|set up Git for Gerrit use]] instead.
Line 35: Line 39:
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:
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===
=== Qt 4.x ===
 
===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|Building Qt 5 from Git]] has the details on how to get the Qt 5 sources.


===Behind a Company Firewall===
<code><br /> git clone git://gitorious.org/qt/qt.git<br /> cd qt<br /></code>


If the clone process fails with “<code>unable to connect to socket</code>” it’s likely that you are behind a firewall that blocks the Git protocol.
=== Qt 5 ===


First try replacing the clone <span class="caps">URL</span> with its <span class="caps">HTTP</span> equivalent, <code>http://git.gitorious.org/qt/qt.git</code>
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.


If that does not help, an alternate solution is to clone using the <span class="caps">SSH</span> protocol proxied though a <span class="caps">HTTP</span> proxy. This will also work for pushing changes.
=== Behind a Company Firewall ===


====Linux/Mac====
If the clone process fails with &quot;&lt;code&amp;gt;unable to connect to socket&amp;lt;/code&amp;gt;&quot; it's likely that you are behind a firewall that blocks the Git protocol.


First install [http://www.mtu.net/~engstrom/ssh-proxy.php Corkscrew] ''[mtu.net]'' on your machine.
First try replacing the clone URL with its HTTP equivalent, &lt;code&amp;gt;http://git.gitorious.org/qt/qt.git&amp;lt;/code&amp;gt;


Next, edit your <span class="caps">SSH</span> config and add:
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.


====Windows====
==== Linux/Mac ====


If you are using msysgit (full environment), ensure that the &lt;msysgit&gt;/mingw/bin is in your path, so you have access to the <code>connect.exe</code> application. If not, you can download it [http://chaos.troll.no/~marius/connect.exe here] ''[chaos.troll.no]'', and place it somewhere in your path. <code>Connect.exe</code> is a standalone Windows console application, no MSys/Cygwin binaries required.
First install &quot;Corkscrew&amp;quot;:http://www.mtu.net/~engstrom/ssh-proxy.php on your machine.


Next, edit your <span class="caps">SSH</span> config and add:
Next, edit your SSH config and add:


Replacing <code>yourproxyhost</code> and <code>yourproxyport</code> with the hostname and port of your company’s <span class="caps">HTTP</span> proxy.
<code><br /> Host *gitorious.org<br /> Hostname ssh.gitorious.org<br /> Port 443<br /> ProxyCommand corkscrew yourproxyhost yourproxyport %h %p<br /></code>


You should now be able to clone and push using the <span class="caps">URL</span> <code>git@gitorious.org:qt/qt.git</code>
==== Windows ====


==Building Qt==
If you are using msysgit (full environment), ensure that the &lt;msysgit&amp;gt;/mingw/bin is in your path, so you have access to the &lt;code&amp;gt;connect.exe&amp;lt;/code&amp;gt; application. If not, you can download it &quot;here&amp;quot;:http://chaos.troll.no/~marius/connect.exe, and place it somewhere in your path. &lt;code&amp;gt;Connect.exe&amp;lt;/code&amp;gt; is a standalone Windows console application, no MSys/Cygwin binaries required.


Build Qt the same way you would for an official Qt release. The standard build/installation instructions apply:
Next, edit your SSH config and add:


[http://doc.qt.io/qt-5/supported-platforms.html Supported platforms] ''[qt.io]''
<code><br /> Host '''gitorious.org<br /> Hostname ssh.gitorious.org<br /> Port 443<br /> ProxyCommand connect -H yourproxyhost:yourproxyport %h %p<br /></code>


* [http://doc.qt.io/qt-5/macosx.html Installing Qt on Mac OS X] ''[qt.io]''
<br />Replacing &lt;code&amp;gt;yourproxyhost&amp;lt;/code&amp;gt; and &lt;code&amp;gt;yourproxyport&amp;lt;/code&amp;gt; with the hostname and port of your company's HTTP proxy.
* [http://doc.qt.io/qt-5/windows-support.html Installing Qt on Windows] ''[qt.io]''
<br />You should now be able to clone and push using the URL &lt;code&amp;gt;git<code>gitorious.org:qt/qt.git&amp;lt;/code&amp;gt;
* [http://doc.qt.io/qt-5/wince-with-qt-introduction.html Installing Qt on Windows CE] ''[qt.io]''
<br />h2. Building Qt
* [http://doc.qt.io/qt-5/linux.html Installing Qt on X11 Platforms] ''[qt.io]''
<br />Build Qt the same way you would for an official Qt release. The standard build/installation instructions apply:
<br />&quot;Supported platforms&amp;quot;:http://doc.qt.io/qt-5/supported-platforms.html
<br />''' &quot;Installing Qt on Mac OS X&amp;quot;:http://doc.qt.io/qt-5/macosx.html<br />* &quot;Installing Qt on Windows&amp;quot;:http://doc.qt.io/qt-5/windows-support.html<br />* &quot;Installing Qt on Windows CE&amp;quot;:http://doc.qt.io/qt-5/wince-with-qt-introduction.html<br />* &quot;Installing Qt on X11 Platforms&amp;quot;:http://doc.qt.io/qt-5/linux.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.
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==
== Generate the Documentation ==


Since the repository is just the source code rather than a complete package the <span class="caps">HTML</span> documentation pages are not include. If you use a repository for a previously released Qt version, then you can go to the [http://doc.qt.io/qt online documentation] ''[qt.io]'' or [http://www.qt.nokia.com/downloads download a package] ''[qt.nokia.com]''.
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 &quot;online documentation&amp;quot;:http://doc.qt.io/qt or &quot;download a package&amp;quot;: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
For documentation that is not yet available online or through a package you have to generate the documentation yourself. To do that, run
</code><br /> make docs<br /><code>


after running configure and building the libraries else.
after running configure and building the libraries else.


==What’s Next?==
== What's Next? ==
 
To learn how to make changes to Qt and upload them for submission upstream see [[Qt-Contribution-Guidelines|Qt Contribution Guidelines]]. If you would like to simply stay up-to-date with your sources and silently follow the development of Qt simply run <code>git pull</code> in your source code directory to pull in the latest changes.
 
===Categories:===
 
* [[:Category:Developing Qt|Developing_Qt]]
** [[:Category:Developing Qt::Instructions|Instructions]]

Revision as of 07:06, 24 February 2015


[toc align_right="yes&quot; depth="3&quot;]

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&quot;: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&quot;:http://www.activestate.com/activepython/ for free.

Qt's source code is developed using "Git&quot;: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

<br /> git clone git://gitorious.org/qt/qt.git<br /> cd qt<br />

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 "<code&gt;unable to connect to socket&lt;/code&gt;" it's likely that you are behind a firewall that blocks the Git protocol.

First try replacing the clone URL with its HTTP equivalent, <code&gt;http://git.gitorious.org/qt/qt.git&lt;/code&gt;

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&quot;:http://www.mtu.net/~engstrom/ssh-proxy.php on your machine.

Next, edit your SSH config and add:

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

Windows

If you are using msysgit (full environment), ensure that the <msysgit&gt;/mingw/bin is in your path, so you have access to the <code&gt;connect.exe&lt;/code&gt; application. If not, you can download it "here&quot;:http://chaos.troll.no/~marius/connect.exe, and place it somewhere in your path. <code&gt;Connect.exe&lt;/code&gt; is a standalone Windows console application, no MSys/Cygwin binaries required.

Next, edit your SSH config and add:

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


Replacing <code&gt;yourproxyhost&lt;/code&gt; and <code&gt;yourproxyport&lt;/code&gt; with the hostname and port of your company's HTTP proxy.


You should now be able to clone and push using the URL <code&gt;git

gitorious.org:qt/qt.git&amp;lt;/code&amp;gt;
<br />h2. Building Qt
<br />Build Qt the same way you would for an official Qt release. The standard build/installation instructions apply:
<br />&quot;Supported platforms&amp;quot;:http://doc.qt.io/qt-5/supported-platforms.html
<br />''' &quot;Installing Qt on Mac OS X&amp;quot;:http://doc.qt.io/qt-5/macosx.html<br />* &quot;Installing Qt on Windows&amp;quot;:http://doc.qt.io/qt-5/windows-support.html<br />* &quot;Installing Qt on Windows CE&amp;quot;:http://doc.qt.io/qt-5/wince-with-qt-introduction.html<br />* &quot;Installing Qt on X11 Platforms&amp;quot;:http://doc.qt.io/qt-5/linux.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 &quot;online documentation&amp;quot;:http://doc.qt.io/qt or &quot;download a package&amp;quot;: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?