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: Difference between revisions
AutoSpider (talk | contribs) (Add "cleanup" tag) |
mNo edit summary |
||
(16 intermediate revisions by 11 users not shown) | |||
Line 1: | Line 1: | ||
:''See also: '''[[Building Qt 5 from Git]]''''' | |||
[[Category: | {{LangSwitch}} | ||
[[Category:Developing_with_Qt]] | |||
__TOC__ | |||
You can develop great Qt code using nothing more than Qt Creator and the final release of SDKs. Polished. Stable. Commercial grade. | You can develop great Qt code using nothing more than Qt Creator and the final release of SDKs. Polished. Stable. Commercial grade. | ||
Line 13: | Line 11: | ||
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'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: https://code.qt.io/ | ||
== Setting up your machine == | == Setting up your machine == | ||
Qt can be built and developed on many different platforms. The operating systems for development are | Qt can be built and developed on many different platforms. The operating systems for development are macOS, 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 | * Qt for Embedded Linux Requirements [http://doc.qt.io/qt-4.8/requirements-embedded-linux.html Qt 4] | ||
* Qt for | * Qt for macOS Requirements: [http://doc.qt.io/qt-4.8/requirements-mac.html Qt 4] [https://doc.qt.io/qt-5/macos.html Qt 5] | ||
* Qt for Windows CE Requirements: | * Qt for Windows CE Requirements: [http://doc.qt.io/qt-4.8/requirements-wince.html Qt 4] [http://doc.qt.io/qt-5/requirements-wince.html Qt 5] | ||
* Qt for Windows Requirements: | * Qt for Windows Requirements: [http://doc.qt.io/qt-4.8/requirements-win.html Qt 4] [http://doc.qt.io/qt-5/windows-requirements.html Qt 5] | ||
* Qt for X11 Requirements | * Qt for X11 Requirements [http://doc.qt.io/qt-4.8/requirements-x11.html Qt 4] [http://doc.qt.io/qt-5/linux-requirements.html Qt 5] | ||
In addition you need to have Perl installed. This is standard on most Linux distributions and | In addition you need to have Perl installed. This is standard on most Linux distributions and macOS. Windows users can download [http://www.activestate.com/activeperl/ 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 [http://www.activestate.com/activepython/ ActivePython] for free. | ||
Qt's source code is developed using | Qt's source code is developed using [http://git-scm.com/ Git], an open source, distributed version control system. You need to have Git >= 1.7.x installed. | ||
For more information please see the separate [[ | 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 | If you want to contribute to the Qt Project, you should read how to [[Setting up Gerrit|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: | 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: | ||
Line 41: | Line 37: | ||
=== Qt 4.x === | === Qt 4.x === | ||
<code> | <code lang="bash"> | ||
git clone git://code.qt.io/qt/qt.git | |||
cd qt | |||
</code> | </code> | ||
=== Qt 5 === | === 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 | :''This section is outdated, more up to date instructions are at: '''[[Building Qt 5 from Git]]''''' | ||
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 === | === Behind a Company Firewall === | ||
If the clone process fails with "< | If the clone process fails with "<tt>unable to connect to socket</tt>" it's likely that you are behind a firewall that blocks the Git protocol. | ||
First try replacing the clone URL with its HTTP equivalent, < | First try replacing the clone URL with its HTTP equivalent, <tt>http://code.qt.io/qt/qt.git</tt> | ||
If that does not help, an alternate solution is to clone using the SSH protocol proxied though a HTTP proxy | If that does not help, an alternate solution is to clone from Gerrit using the SSH protocol proxied though a HTTP proxy. | ||
==== Linux/Mac ==== | ==== Linux/Mac ==== | ||
First install | First install [http://www.mtu.net/~engstrom/ssh-proxy.php Corkscrew] on your machine. | ||
Next, edit your SSH config and add: | Next, edit your SSH config and add: | ||
< | <pre> | ||
Host codereview.qt-project.org | |||
Port 29418 | |||
Ciphers aes256-cbc | |||
ProxyCommand corkscrew yourproxyhost yourproxyport %h %p | |||
</ | </pre> | ||
==== Windows ==== | ==== Windows ==== | ||
If you are using msysgit (full environment), ensure that the <msysgit>/mingw/bin is in your path, so you have access to the < | If you are using msysgit (full environment), ensure that the <msysgit>/mingw/bin is in your path, so you have access to the <tt>connect.exe</tt> application. If not, you can download it from <FIXME>, and place it somewhere in your path. <tt>Connect.exe</tt> is a standalone Windows console application, no MSys/Cygwin binaries required. | ||
Next, edit your SSH config and add: | Next, edit your SSH config and add: | ||
< | <pre> | ||
Host codereview.qt-project.org | |||
Port 29418 | |||
Ciphers aes256-cbc | |||
ProxyCommand connect -H yourproxyhost:yourproxyport %h %p | |||
</ | </pre> | ||
Replacing < | Replacing <tt>yourproxyhost</tt> and <tt>yourproxyport</tt> with the hostname and port of your company's HTTP proxy. | ||
You should now be able to clone and push using the URL < | You should now be able to clone and push using the URL <tt>yourusername@codereview.qt-project.org:qt/qt.git</tt> | ||
==Building Qt== | == Building Qt == | ||
Build Qt the same way you would for an official Qt release. The standard build/installation instructions apply: | Build Qt the same way you would for an official Qt release. The standard build/installation instructions apply: | ||
[http://doc.qt.io/qt-5/supported-platforms.html Supported platforms] | |||
* | * [https://doc.qt.io/qt-5/macos.html Installing Qt on macOS] | ||
* [http://doc.qt.io/qt-5/windows-support.html Installing Qt on Windows] | |||
* [http://doc.qt.io/qt-5/linux.html Installing Qt on X11 Platforms] | |||
Make sure that you have Perl installed and that it is working. If configure complains about not being able to find headers | 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 HTML documentation pages are not | Since the repository is just the source code rather than a complete package, the HTML documentation pages are not included. If you use a repository for a previously released Qt version, you can go to the [http://doc.qt.io/qt online documentation] or [http://download.qt.io/ download a package]. | ||
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> | <code lang="bash"> | ||
make docs | |||
</code> | </code> | ||
after running configure and building the libraries | after running configure and building the libraries. | ||
== What's Next? == | == What's Next? == | ||
To learn how to make changes to Qt and upload them for submission upstream see [[Qt | To learn how to make changes to Qt and upload them for submission upstream see the [[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 git pull in your source code directory to pull in the latest changes. |
Latest revision as of 11:08, 29 August 2020
- See also: Building Qt 5 from Git
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: https://code.qt.io/
Setting up your machine
Qt can be built and developed on many different platforms. The operating systems for development are macOS, 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 Qt 4
- Qt for macOS Requirements: Qt 4 Qt 5
- Qt for Windows CE Requirements: Qt 4 Qt 5
- Qt for Windows Requirements: Qt 4 Qt 5
- Qt for X11 Requirements Qt 4 Qt 5
In addition you need to have Perl installed. This is standard on most Linux distributions and macOS. Windows users can download 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 for free.
Qt's source code is developed using Git, 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://code.qt.io/qt/qt.git
cd qt
Qt 5
- This section is outdated, more up to date instructions are at: Building Qt 5 from Git
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://code.qt.io/qt/qt.git
If that does not help, an alternate solution is to clone from Gerrit using the SSH protocol proxied though a HTTP proxy.
Linux/Mac
First install Corkscrew on your machine.
Next, edit your SSH config and add:
Host codereview.qt-project.org Port 29418 Ciphers aes256-cbc 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 from <FIXME>, 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 codereview.qt-project.org Port 29418 Ciphers aes256-cbc 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 yourusername@codereview.qt-project.org:qt/qt.git
Building Qt
Build Qt the same way you would for an official Qt release. The standard build/installation instructions apply:
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 included. If you use a repository for a previously released Qt version, you can go to the online documentation or download a package.
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.
What's Next?
To learn how to make changes to Qt and upload them for submission upstream see the 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 git pull in your source code directory to pull in the latest changes.