Building Qt 5 from Git: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
(Add "cleanup" tag)
(fixed markup (part 1))
Line 1: Line 1:
{{Cleanup | reason=Auto-imported from ExpressionEngine.}}
[[Category:HowTo]]
[[Category:HowTo]]
[[Category:Developing_with_Qt::Qt 5]]
[[Category:Developing_with_Qt::Qt 5]]
Line 44: Line 42:


Ubuntu/Debian based systems have a convenient way of installing build-depends for any package:
Ubuntu/Debian based systems have a convenient way of installing build-depends for any package:
<code>
<pre>
sudo apt-get build-dep qt5-default
sudo apt-get build-dep qt5-default
</code>
</pre>


RPM-based distros with yum offer a similar tool called yum-builddep.
RPM-based distros with yum offer a similar tool called yum-builddep.


==== Convenience packages (Ubuntu 11.10 12.10 only) ====
==== Convenience packages (Ubuntu 11.10 -- 12.10 only) ====


For Ubuntu/Debian, Gabor Loki has provided a custom PPA with the "sedkit-env-webkit":https://launchpad.net/~u-szeged/+archive/sedkit meta package that installs all required dependencies for building Qt/Qt WebKit. You can add the PPA by calling:
For Ubuntu/Debian, Gabor Loki has provided a custom PPA with the "sedkit-env-webkit":https://launchpad.net/~u-szeged/+archive/sedkit meta package that installs all required dependencies for building Qt/Qt WebKit. You can add the PPA by calling:


<code>
<pre>
sudo apt-add-repository ppa:u-szeged/sedkit &amp;&amp; sudo apt-get update &amp;&amp; sudo apt-get install sedkit-env-qtwebkit
sudo apt-add-repository ppa:u-szeged/sedkit &amp;&amp; sudo apt-get update &amp;&amp; sudo apt-get install sedkit-env-qtwebkit
</code>
</pre>


For other distros, get the separate components below.
For other distros, get the separate components below.
Line 64: Line 62:
===== Ubuntu/Debian: =====
===== Ubuntu/Debian: =====


<code>
<pre>
sudo apt-get install build-essential perl python git
sudo apt-get install build-essential perl python git
</code>
</pre>


===== Fedora:=====
===== Fedora:=====
<code>
<pre>
su - -c "yum install perl-version"
su - -c "yum install perl-version"
</code>
</pre>


===== OpenSUSE: =====
===== OpenSUSE: =====


<code>
<pre>
sudo zypper install git-core gcc-c++ make
sudo zypper install git-core gcc-c++ make
</code>
</pre>


==== Libxcb ====
==== Libxcb ====
Line 85: Line 83:
===== Ubuntu/Debian: =====
===== Ubuntu/Debian: =====


<code>
<pre>
sudo apt-get install "^libxcb.'''" libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev
sudo apt-get install "^libxcb.'''" libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev
</code>
</pre>


=====Fedora up to 16:=====
=====Fedora up to 16:=====
<code>
<pre>
su - -c "yum install libxcb libxcb-devel xcb-util xcb-util-devel"
su - -c "yum install libxcb libxcb-devel xcb-util xcb-util-devel"
</code>
</pre>


=====Fedora 17+ (xcb-util-renderutil is currently available in updates repository until it goes stable):=====
=====Fedora 17+ (xcb-util-renderutil is currently available in updates repository until it goes stable):=====
<code>
<pre>
su- -c "yum —enablerepo=updates install libxcb libxcb-devel xcb-util xcb-util-devel xcb-util-'''-devel libX11-devel libXrender-devel libXi-devel"
su- -c "yum --enablerepo=updates install libxcb libxcb-devel xcb-util xcb-util-devel xcb-util-'''-devel libX11-devel libXrender-devel libXi-devel"
</code>
</pre>


===== OpenSuSE 12.2=====
===== OpenSuSE 12.2=====
<code>
<pre>
sudo zypper in xorg-x11-libxcb-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-renderutil-devel xcb-util-wm-devel xorg-x11-devel libxkbcommon-devel libXi-devel
sudo zypper in xorg-x11-libxcb-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-renderutil-devel xcb-util-wm-devel xorg-x11-devel libxkbcommon-devel libXi-devel
</code>  
</pre>  


===== ArchLinux:=====
===== ArchLinux:=====
<code>
<pre>
sudo pacman -S —needed libxcb xcb-proto xcb-util xcb-util-image xcb-util-wm libxi
sudo pacman -S --needed libxcb xcb-proto xcb-util xcb-util-image xcb-util-wm libxi
</code>  
</pre>  


On Chakra Linux, other than packages mentioned for ArchLinux, you need to install package xcb-util-keysyms separately. It's available from CCR.
On Chakra Linux, other than packages mentioned for ArchLinux, you need to install package xcb-util-keysyms separately. It's available from CCR.


===== Mandriva/ROSA/Unity:=====
===== Mandriva/ROSA/Unity:=====
<code>
<pre>
urpmi 'pkgconfig(xcb)' 'pkgconfig(xcb-icccm)' 'pkgconfig(xcb-image)' 'pkgconfig(xcb-renderutil)' 'pkgconfig(xcb-keysyms)' 'pkgconfig(xrender)'
urpmi 'pkgconfig(xcb)' 'pkgconfig(xcb-icccm)' 'pkgconfig(xcb-image)' 'pkgconfig(xcb-renderutil)' 'pkgconfig(xcb-keysyms)' 'pkgconfig(xrender)'
</code>
</pre>


===== Centos 5/6 =====
===== Centos 5/6 =====


Install missing Qt build dependencies:
Install missing Qt build dependencies:
<code>
<pre>
yum install libxcb libxcb-devel xcb-util xcb-util-devel
yum install libxcb libxcb-devel xcb-util xcb-util-devel
</code>
</pre>


Install Red Hat DevTools 1.1 for CentOS-5/6 x86_64, they are required due to outdated GCC shipped with default CentOS
Install Red Hat DevTools 1.1 for CentOS-5/6 x86_64, they are required due to outdated GCC shipped with default CentOS
<code>
<pre>
wget http://people.centos.org/tru/devtools-1.1/devtools-1.1.repo -O /etc/yum.repos.d/devtools-1.1.repo
wget http://people.centos.org/tru/devtools-1.1/devtools-1.1.repo -O /etc/yum.repos.d/devtools-1.1.repo
yum install devtoolset-1.1
yum install devtoolset-1.1
</code>
</pre>


You also need to initialise your newly installed dev tools:
You also need to initialise your newly installed dev tools:
<code>
<pre>
scl enable devtoolset-1.1 bash
scl enable devtoolset-1.1 bash


# Test- Expect to see gcc version 4.7.2 ( * not * gcc version 4.4.7 )
# Test- Expect to see gcc version 4.7.2 ( * not * gcc version 4.4.7 )
gcc -v
gcc -v
</code>
</pre>


For more info on preparing the environment on '''CentOS''', see "this thread":https://forum.qt.io/viewthread/30708/.
For more info on preparing the environment on '''CentOS''', see "this thread":https://forum.qt.io/viewthread/30708/.
Line 150: Line 148:


=====Ubuntu/Debian:=====
=====Ubuntu/Debian:=====
<code>
<pre>
sudo apt-get install flex bison gperf libicu-dev libxslt-dev ruby
sudo apt-get install flex bison gperf libicu-dev libxslt-dev ruby
</code>
</pre>


=====Fedora:=====
=====Fedora:=====
<code>
<pre>
su- -c "yum install flex bison gperf libicu-devel libxslt-devel ruby"
su- -c "yum install flex bison gperf libicu-devel libxslt-devel ruby"
</code>
</pre>


=====OpenSUSE:=====
=====OpenSUSE:=====
<code>
<pre>
sudo zypper install flex bison gperf libicu-devel ruby
sudo zypper install flex bison gperf libicu-devel ruby
</code>
</pre>


=====Mandriva/ROSA/Unity:=====
=====Mandriva/ROSA/Unity:=====
<code>
<pre>
urpmi gperf
urpmi gperf
</code>
</pre>


====Qt WebEngine====
====Qt WebEngine====


=====Ubuntu (all):=====
=====Ubuntu (all):=====
<code>
<pre>
sudo apt-get install libssl-dev libxcursor-dev libxcomposite-dev libxdamage-dev libxrandr-dev libfontconfig1-dev </code>
sudo apt-get install libssl-dev libxcursor-dev libxcomposite-dev libxdamage-dev libxrandr-dev libfontconfig1-dev
</pre>


======Additional dependencies on Ubuntu 14.04:======
======Additional dependencies on Ubuntu 14.04:======
<code>
<pre>
sudo apt-get install libcap-dev libbz2-dev libgcrypt11-dev libpci-dev libnss3-dev build-essential libxcursor-dev libxcomposite-dev libxdamage-dev libxrandr-dev libdrm-dev libfontconfig1-dev libxtst-dev libasound2-dev gperf libcups2-dev libpulse-dev libudev-dev libssl-dev flex bison ruby </code>
sudo apt-get install libcap-dev libbz2-dev libgcrypt11-dev libpci-dev libnss3-dev build-essential libxcursor-dev libxcomposite-dev libxdamage-dev libxrandr-dev libdrm-dev libfontconfig1-dev libxtst-dev libasound2-dev gperf libcups2-dev libpulse-dev libudev-dev libssl-dev flex bison ruby
</pre>


=====Fedora:=====
=====Fedora:=====
<code>
<pre>
sudo yum install "qt5-*"
sudo yum install "qt5-*"


sudo yum install libgcrypt-devel libgcrypt pciutils-devel nss-devel libXtst-devel gperf cups-devel pulseaudio-libs-devel libgudev1-devel systemd-devel libcap-devel alsa-lib-devel flex bison ruby
sudo yum install libgcrypt-devel libgcrypt pciutils-devel nss-devel libXtst-devel gperf cups-devel pulseaudio-libs-devel libgudev1-devel systemd-devel libcap-devel alsa-lib-devel flex bison ruby
</code>
</pre>


'''Please note that these libraries need to be installed on other distributions as well, though the package names and the set of libraries that are preinstalled may differ depending on the distribution used.'''
'''Please note that these libraries need to be installed on other distributions as well, though the package names and the set of libraries that are preinstalled may differ depending on the distribution used.'''
Line 193: Line 193:


===== Ubuntu/Debian:
===== Ubuntu/Debian:
<code>
<pre>
sudo apt-get install libasound2-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev
sudo apt-get install libasound2-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev
</code> =====
</pre> =====


=== OS X ===
=== OS X ===


Install the latest Xcode from the App Store. Verify that your Xcode install is properly set up for command line use:
Install the latest Xcode from the App Store. Verify that your Xcode install is properly set up for command line use:
<code>
<pre>
xcodebuild -version &amp;&amp; xcodebuild -showsdks
xcodebuild -version &amp;&amp; xcodebuild -showsdks
</code>
</pre>


This should give you eg:
This should give you eg:
<code>
<pre>
Xcode 4.6.1
Xcode 4.6.1
Build version 4H512
Build version 4H512
Line 218: Line 218:
  Simulator- iOS 5.0 -sdk iphonesimulator5.0
  Simulator- iOS 5.0 -sdk iphonesimulator5.0
  Simulator- iOS 6.1 -sdk iphonesimulator6.1
  Simulator- iOS 6.1 -sdk iphonesimulator6.1
</code>
</pre>


You can verify that the right Xcode is being used by running:
You can verify that the right Xcode is being used by running:
<code>
<pre>
xcode-select —print-path
xcode-select --print-path
</code>
</pre>


If this points to /Developer you're probably using an older Xcode version. Switch to the latest one by running:
If this points to /Developer you're probably using an older Xcode version. Switch to the latest one by running:
<code>
<pre>
sudo xcode-select —switch /Applications/Xcode.app/Contents/Developer
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
</code>
</pre>


=== Windows ===
=== Windows ===
Line 272: Line 272:
Multicore building: To speed up building when using ''nmake'', the compiler can be instructed to use all available CPU cores in one of the following ways:
Multicore building: To speed up building when using ''nmake'', the compiler can be instructed to use all available CPU cores in one of the following ways:
* Pass the option _-MP_ to Qt's ''configure''
* Pass the option _-MP_ to Qt's ''configure''
* Set the environment variable ''CL'' (specifying Visual Studio compiler options) to ''/MP'' (On the command line: <code>set CL=/MP</code>)
* Set the environment variable ''CL'' (specifying Visual Studio compiler options) to ''/MP'' (On the command line: <tt>set CL=/MP</tt>)
* Use the tool [[jom]] instead of nmake.
* Use the tool [[jom]] instead of nmake.


Line 288: Line 288:
First clone the top-level Qt 5 git repository:
First clone the top-level Qt 5 git repository:


<code>
<pre>
git clone git://gitorious.org/qt/qt5.git qt5
git clone git://gitorious.org/qt/qt5.git qt5
</code>
</pre>


or (if you're behind a firewall and want to use the https protocol):
or (if you're behind a firewall and want to use the https protocol):


<code>
<pre>
git clone https://git.gitorious.org/qt/qt5.git qt5
git clone https://git.gitorious.org/qt/qt5.git qt5
</code>
</pre>


Then check out the target branch (see [[Branch-Guidelines]]):
Then check out the target branch (see [[Branch-Guidelines]]):


<code>
<pre>
cd qt5
cd qt5
git checkout 5.4
git checkout 5.4
</code>
</pre>


Following the "README.git":http://qt.gitorious.org/qt/qt5/blobs/dev/README.git- file we initialize the repository using the script ''init-repository'' which clones the various sub-modules of Qt 5. Relevant options:
Following the "README.git":http://qt.gitorious.org/qt/qt5/blobs/dev/README.git- file we initialize the repository using the script ''init-repository'' which clones the various sub-modules of Qt 5. Relevant options:
* <code>&amp;#45;&amp;#45;no-webkit</code> : Consider skipping qtwebkit by passing this option. This module is quite big, takes a long time to compile and is often a source of compile errors, so it is recommend to only download it if you intend to use it. You can always re-run init-repository later on to add it.
* <tt>&amp;#45;&amp;#45;no-webkit</tt> : Consider skipping qtwebkit by passing this option. This module is quite big, takes a long time to compile and is often a source of compile errors, so it is recommend to only download it if you intend to use it. You can always re-run init-repository later on to add it.
* <code>&amp;#45;&amp;#45;codereview-username <Jira/Gerrit username></code> : If you plan to contribute to Qt, you should specify your [[Gerrit_Introduction | codereview username]] so that the git remotes are properly set up.
* <tt>&amp;#45;&amp;#45;codereview-username <Jira/Gerrit username></tt> : If you plan to contribute to Qt, you should specify your [[Gerrit_Introduction | codereview username]] so that the git remotes are properly set up.


<code>
<pre>
cd qt5
cd qt5
perl init-repository
perl init-repository
</code>
</pre>


== Configuring and building ==
== Configuring and building ==
Line 321: Line 321:


For Linux / OS X:
For Linux / OS X:
<code>
<pre>
./configure -developer-build -opensource -nomake examples -nomake tests
./configure -developer-build -opensource -nomake examples -nomake tests
</code>
</pre>


For Windows:
For Windows:
<code>
<pre>
configure -developer-build -opensource -nomake examples -nomake tests
configure -developer-build -opensource -nomake examples -nomake tests
</code>
</pre>


The <code>-developer-build</code> options export more symbols than in a traditional Qt build in order to allow more classes and functions to be unit tested. It also defaults to a 'debug' build, and installs the binaries in the current directory, avoiding the need for 'make install'. '-opensource' sets the license to be LGPL 2.1. The <code>-nomake examples</code> and <code>-nomake tests</code> parameters make sure examples and tests aren't compiled by default. You can always decide to compile them later by hand.
The <tt>-developer-build</tt> options export more symbols than in a traditional Qt build in order to allow more classes and functions to be unit tested. It also defaults to a 'debug' build, and installs the binaries in the current directory, avoiding the need for 'make install'. '-opensource' sets the license to be LGPL 2.1. The <tt>-nomake examples</tt> and <tt>-nomake tests</tt> parameters make sure examples and tests aren't compiled by default. You can always decide to compile them later by hand.


* Hint1: On Linux, you should also pass <code>-no-gtkstyle</code>. This is because on a number of systems (at least SUSE and Gentoo) <code>pkg-config —cflags gtk+–2.0</code> actually returns paths that include the system Qt 4.x include directories.
* Hint1: On Linux, you should also pass <tt>-no-gtkstyle</tt>. This is because on a number of systems (at least SUSE and Gentoo) <tt>pkg-config --cflags gtk+–2.0</tt> actually returns paths that include the system Qt 4.x include directories.


* Hint2: You can add <code>-confirm-license</code> to get rid of the question whether you agree to the license.
* Hint2: You can add <tt>-confirm-license</tt> to get rid of the question whether you agree to the license.


* Hint3: On Windows, you might not be able to build if <code>sh.exe</code> is in your ''PATH'' (for example due to a ''git'' or ''msys'' installation). Such an error is indicated by <code>qt5-srcqtbasebinqmake.exe: command not found</code> and alike. In this case, make sure that <code>sh.exe</code> is ''not'' in your path. You will have to re-configure if your installation is already configured.
* Hint3: On Windows, you might not be able to build if <tt>sh.exe</tt> is in your ''PATH'' (for example due to a ''git'' or ''msys'' installation). Such an error is indicated by <tt>qt5-srcqtbasebinqmake.exe: command not found</tt> and alike. In this case, make sure that <tt>sh.exe</tt> is ''not'' in your path. You will have to re-configure if your installation is already configured.


Now trigger the build by running:
Now trigger the build by running:


For Linux / OS X:
For Linux / OS X:
<code>
<pre>
make -j4 all
make -j4 all
</code>
</pre>


If you are making an out-of-source developer build and that also includes building the QtWebKit module, the above command will "return an error":https://bugreports.qt.io/browse/QTBUG-35514 about <code>WebCore/RunLoop.h</code> while building QtWebKit. This can be fixed by omitting the ''all'' and simply running:
If you are making an out-of-source developer build and that also includes building the QtWebKit module, the above command will "return an error":https://bugreports.qt.io/browse/QTBUG-35514 about <tt>WebCore/RunLoop.h</tt> while building QtWebKit. This can be fixed by omitting the ''all'' and simply running:
<code>
<pre>
make -j4
make -j4
</code>
</pre>


For Windows (MSVC), choose one of the following, depending on your setup/environment:
For Windows (MSVC), choose one of the following, depending on your setup/environment:
<code>
<pre>
nmake
nmake
jom
jom
mingw32-make
mingw32-make
</code>
</pre>


Or only build a specific module, e.g. declarative, and modules it depends on:
Or only build a specific module, e.g. declarative, and modules it depends on:


<code>
<pre>
make module-qtdeclarative
make module-qtdeclarative
</code>
</pre>


=== Building Qt WebKit ===
=== Building Qt WebKit ===
Line 369: Line 369:
"WebKit.org":http://trac.webkit.org/wiki/BuildingQtOnWindows has instructions for building WebKit on Windows. "ICU":http://site.icu-project.org/ is required for building.
"WebKit.org":http://trac.webkit.org/wiki/BuildingQtOnWindows has instructions for building WebKit on Windows. "ICU":http://site.icu-project.org/ is required for building.


The tools ''bison'', ''flex'' and ''gperf'' which are required for building are provided for convenience in the folder ''gnuwin32\bin''. If you are using shadow builds, you must add this directory to your <code>PATH</code>, else no special actions need to be done manually in order to use them.
The tools ''bison'', ''flex'' and ''gperf'' which are required for building are provided for convenience in the folder ''gnuwin32\bin''. If you are using shadow builds, you must add this directory to your <tt>PATH</tt>, else no special actions need to be done manually in order to use them.


== Installing (Linux / OS X) ==
== Installing (Linux / OS X) ==


* '''Note:''' Installation is only needed if you haven't used the configure options <code>-developer-build</code> or <code>-prefix "%PWD%/qtbase"</code>. Otherwise you can just use Qt from the build directory.
* '''Note:''' Installation is only needed if you haven't used the configure options <tt>-developer-build</tt> or <tt>-prefix "%PWD%/qtbase"</tt>. Otherwise you can just use Qt from the build directory.


To install, run
To install, run


<code>
<pre>
make install
make install
</code>
</pre>


== Cleaning ==
== Cleaning ==
Line 385: Line 385:
To get a '''really''' clean tree use:
To get a '''really''' clean tree use:


<code>
<pre>
git submodule foreach —recursive "git clean -dfx"
git submodule foreach --recursive "git clean -dfx"
</code>
</pre>


since make confclean no longer works from the top-level of the repo.
since make confclean no longer works from the top-level of the repo.
Line 394: Line 394:


To update both the qt5.git repo as well as the submodules to the list of revisions that are known to work, run
To update both the qt5.git repo as well as the submodules to the list of revisions that are known to work, run
<code>
<pre>
git pull
git pull
perl init-repository -f
perl init-repository -f
</code>
</pre>


In addition, you should pass the same parameters to init-repository as you did in "Getting the source code".
In addition, you should pass the same parameters to init-repository as you did in "Getting the source code".
Line 403: Line 403:
Unlike a "normal" git submodule update, this ensures that any changes to the module structure are automatically pulled as well.
Unlike a "normal" git submodule update, this ensures that any changes to the module structure are automatically pulled as well.


If you are planning to do nightly builds, consider using the script ''qt5_tool'' that lives in ''qtrepotools/bin''. It provides options for updating the repository, cleaning and building. For example, <code>qt5_tool -u -c -b</code> can be used to clean, update and build. <code>qt5_tool -p -c- b</code> would be used to pull all modules to the head of their master branches.
If you are planning to do nightly builds, consider using the script ''qt5_tool'' that lives in ''qtrepotools/bin''. It provides options for updating the repository, cleaning and building. For example, <tt>qt5_tool -u -c -b</tt> can be used to clean, update and build. <tt>qt5_tool -p -c- b</tt> would be used to pull all modules to the head of their master branches.


Depending upon what changed in the source since it was last updated you might have to run configure again. To be really sure everything gets built, you can run clean first, then configure and make.
Depending upon what changed in the source since it was last updated you might have to run configure again. To be really sure everything gets built, you can run clean first, then configure and make.


* '''Hint1:''' The submodule update does a checkout in submodules, potentially hiding any local commits you've done. If the latter happened to you (and you haven't been working with branches anyhow), <code>git reflog</code> is your friend.
* '''Hint1:''' The submodule update does a checkout in submodules, potentially hiding any local commits you've done. If the latter happened to you (and you haven't been working with branches anyhow), <tt>git reflog</tt> is your friend.
* '''Hint2:''' When creating scripts for updates on Windows, note that <code>git clean</code> often fails if some process locks a file or folder.
* '''Hint2:''' When creating scripts for updates on Windows, note that <tt>git clean</tt> often fails if some process locks a file or folder.


== Using latest branches in the submodules ==
== Using latest branches in the submodules ==
Line 414: Line 414:
By default the checkout will not contain the latest stable/dev branches of each individual submodule repository, but a combination of versions that are known to work together. If you want to get the absolute latest stuff you can do so on a per-module basis, e.g.
By default the checkout will not contain the latest stable/dev branches of each individual submodule repository, but a combination of versions that are known to work together. If you want to get the absolute latest stuff you can do so on a per-module basis, e.g.


<code>
<pre>
cd qtdeclarative
cd qtdeclarative
git fetch
git fetch
git checkout 5.4 origin/5.4
git checkout 5.4 origin/5.4
</code>
</pre>


or use qt5_tool to update all repositories:
or use qt5_tool to update all repositories:


<code>
<pre>
./qtrepotools/bin/qt5_tool -p
./qtrepotools/bin/qt5_tool -p
</code>
</pre>


However, there's a good chance that compilation will fail due to incompatible versions of submodules. You might want to ask other persons actively working on a module how to resolve these incompatibilities.
However, there's a good chance that compilation will fail due to incompatible versions of submodules. You might want to ask other persons actively working on a module how to resolve these incompatibilities.
Line 446: Line 446:
Try installing the libx11-xcb-dev package:
Try installing the libx11-xcb-dev package:


<code>
<pre>
sudo apt-get install libx11-xcb-dev
sudo apt-get install libx11-xcb-dev
</code>
</pre>


afterwards you have to re-run configure and force qtbase/src/plugins/platforms/xcb to recompile.
afterwards you have to re-run configure and force qtbase/src/plugins/platforms/xcb to recompile.
Line 458: Line 458:
====on Ubuntu/Debian:====
====on Ubuntu/Debian:====


<code>
<pre>
sudo apt-get install libicu-dev
sudo apt-get install libicu-dev
</code>
</pre>


====on Fedora:====
====on Fedora:====


<code>
<pre>
su- -c "yum install libicu-devel"
su- -c "yum install libicu-devel"
</code>
</pre>


* You can also compile Qt without Qt WebKit by deleting / renaming the qtwebkit, qtwebkit-examples-and-demos directories.
* You can also compile Qt without Qt WebKit by deleting / renaming the qtwebkit, qtwebkit-examples-and-demos directories.
* The —no-webkit option of configure added, see "QTBUG-20577":https://bugreports.qt.io/browse/QTBUG-20577 issue.
* The --no-webkit option of configure added, see "QTBUG-20577":https://bugreports.qt.io/browse/QTBUG-20577 issue.


==== Qt D-Bus fails to build due to "inconsistent user-defined literal suffixes" ====
==== Qt D-Bus fails to build due to "inconsistent user-defined literal suffixes" ====
Line 475: Line 475:
This occours when you attempt to build Qt 5 with GCC 4.7 while D-Bus < 1.4.20 is present on your system. (For example, the default Fedora 17 installation is prone to this error.) The error message is this:
This occours when you attempt to build Qt 5 with GCC 4.7 while D-Bus < 1.4.20 is present on your system. (For example, the default Fedora 17 installation is prone to this error.) The error message is this:


<code>
<pre>
qdbusinternalfilters.cpp:124:36: error: inconsistent user-defined literal suffixes ‘DBUS_INTROSPECT_1_0_XML_PUBLIC_IDENTIFIER’ and ‘DBUS_INTROSPECT_1_0_XML_SYSTEM_IDENTIFIER’ in string literal
qdbusinternalfilters.cpp:124:36: error: inconsistent user-defined literal suffixes ‘DBUS_INTROSPECT_1_0_XML_PUBLIC_IDENTIFIER’ and ‘DBUS_INTROSPECT_1_0_XML_SYSTEM_IDENTIFIER’ in string literal
</code>
</pre>


Note: The error is in the header files of D-Bus itself, and it has been fixed upstream, see https://bugs.freedesktop.org/show_bug.cgi?id=46147
Note: The error is in the header files of D-Bus itself, and it has been fixed upstream, see https://bugs.freedesktop.org/show_bug.cgi?id=46147
Line 486: Line 486:
C+''11 support is detected while your GCC doesn't properly support it
C+''11 support is detected while your GCC doesn't properly support it
Fixed by passing
Fixed by passing
<code>-no-c11<code>
<tt>-no-c11<tt>
to the configure options
to the configure options


Line 493: Line 493:
Currently unresolved bug with the build of assembly files, see discussion at http://comments.gmane.org/gmane.comp.lib.qt.devel/5933
Currently unresolved bug with the build of assembly files, see discussion at http://comments.gmane.org/gmane.comp.lib.qt.devel/5933
Fixed by passing
Fixed by passing
</code>-no-pch</code>
</tt>-no-pch</tt>
to the configure options
to the configure options


Line 500: Line 500:
Bug with GCC versions < 4.4.x, see bug report at https://bugzilla.redhat.com/show_bug.cgi?id=493929
Bug with GCC versions < 4.4.x, see bug report at https://bugzilla.redhat.com/show_bug.cgi?id=493929
Fixed by adding
Fixed by adding
<code>QMAKE_CXXFLAGS_RELEASE''= -fno-inline</code>
<tt>QMAKE_CXXFLAGS_RELEASE''= -fno-inline</tt>
in '''qtdeclarative/src/qml/qml.pro'''
in '''qtdeclarative/src/qml/qml.pro'''


Line 511: Line 511:
and try your Qt application again. At startup, Qt will enumerate the input devices available, like this
and try your Qt application again. At startup, Qt will enumerate the input devices available, like this


<code>
<pre>
XInput version 2.2 is available and Qt supports 2.2 or greater
XInput version 2.2 is available and Qt supports 2.2 or greater
input device … (keyboard, mouse etc.) …
input device … (keyboard, mouse etc.) …
Line 519: Line 519:
  has touch class with mode 1
  has touch class with mode 1
  it's a touchscreen with type 0 capabilities 0x21 max touch points 10
  it's a touchscreen with type 0 capabilities 0x21 max touch points 10
</code>
</pre>


If it does not say Qt supports 2.2 or greater, it means the headers weren't available when Qt was built, so the support for touch was not included. If you do have 2.2 or greater but it doesn't say it's a touchscreen at the end, there may be some other problem such that the touchscreen is not recognized, and you may want to write up a bug, after verifying that touch works in other X11 applications.
If it does not say Qt supports 2.2 or greater, it means the headers weren't available when Qt was built, so the support for touch was not included. If you do have 2.2 or greater but it doesn't say it's a touchscreen at the end, there may be some other problem such that the touchscreen is not recognized, and you may want to write up a bug, after verifying that touch works in other X11 applications.
Line 527: Line 527:
==== Debugging OpenGL issues (Windows) ====
==== Debugging OpenGL issues (Windows) ====


Set the environment variable <code>QT_QPA_VERBOSE=gl:1</code> and run the application with "DebugView":http://technet.microsoft.com/en-us/sysinternals/bb896647 installed. The log will show the requested vs obtained OpenGL version. If the log tells you that it only has OpenGL 1.1, QML2 will not work. Note that ''qmlscene'' will not report errors about unsupported OpenGL versions.
Set the environment variable <tt>QT_QPA_VERBOSE=gl:1</tt> and run the application with "DebugView":http://technet.microsoft.com/en-us/sysinternals/bb896647 installed. The log will show the requested vs obtained OpenGL version. If the log tells you that it only has OpenGL 1.1, QML2 will not work. Note that ''qmlscene'' will not report errors about unsupported OpenGL versions.


== Questions &amp; Comments ==
== Questions &amp; Comments ==


Please raise questions & comments about this article in the forum: http://qt-project.org/forums/viewthread/7018
Please raise questions & comments about this article in the forum: http://qt-project.org/forums/viewthread/7018

Revision as of 21:20, 3 March 2015


English 简体中文 Български Français Русский

Building Qt 5 from Git

Introduction

This article provides hints for checking out and building the modularized Qt 5 from Git, on desktop platforms. Please feel free to update this article as things change during development. Raise issues related to the article via: http://forum.qt.io/viewthread/7018

If you also want to compile Qt Creator, see "Building Qt Creator from Git":http://wiki.qt.io/Building-Qt-Creator-from-Git.

System Requirements

All desktop platforms

  • Git (>= 1.6.x)
  • Perl (>=5.14)
  • Python (>=2.6.x)
  • A working compiler

For more detailed information, see "Building Qt Sources":http://doc.qt.io/qt-5/build-sources.html

SSL (optional)

See "Enabling and Disabling SSL Support":http://doc.qt.io/qt-5.1/qtnetwork/ssl.html#enabling-and-disabling-ssl-support

WebKit (optional)

For Windows, bison, flex and gperf are provided with the source code at <qt>32\bin. Get Ruby from http://rubyinstaller.org/. You can download the precompiled ICU packages from icu-project.org (MSVC 2010 only), or "compile your own":http://wiki.qt.io/Compiling-ICU

Linux/X11

apt-get build-dep

Ubuntu/Debian based systems have a convenient way of installing build-depends for any package:

sudo apt-get build-dep qt5-default

RPM-based distros with yum offer a similar tool called yum-builddep.

Convenience packages (Ubuntu 11.10 -- 12.10 only)

For Ubuntu/Debian, Gabor Loki has provided a custom PPA with the "sedkit-env-webkit":https://launchpad.net/~u-szeged/+archive/sedkit meta package that installs all required dependencies for building Qt/Qt WebKit. You can add the PPA by calling:

sudo apt-add-repository ppa:u-szeged/sedkit && sudo apt-get update && sudo apt-get install sedkit-env-qtwebkit

For other distros, get the separate components below.

Build essentials

Ubuntu/Debian:
sudo apt-get install build-essential perl python git
Fedora:
su - -c "yum install perl-version"
OpenSUSE:
sudo zypper install git-core gcc-c++ make

Libxcb

"Libxcb":http://xcb.freedesktop.org/ is now the default window-system backend for platforms based on X11/Xorg, and you should therefore install libxcb and its accompanying packages. Qt5 should build with whatever libxcb version is available in your distro's packages (but you may optionally wish to use v1.8 or higher to have threaded rendering support). "src/plugins/platforms/xcb/README":http://qt.gitorious.org/qt/qtbase/blobs/stable/src/plugins/platforms/xcb/README lists the required packages.

Ubuntu/Debian:
sudo apt-get install "^libxcb.'''" libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev
Fedora up to 16:
su - -c "yum install libxcb libxcb-devel xcb-util xcb-util-devel"
Fedora 17+ (xcb-util-renderutil is currently available in updates repository until it goes stable):
su- -c "yum --enablerepo=updates install libxcb libxcb-devel xcb-util xcb-util-devel xcb-util-'''-devel libX11-devel libXrender-devel libXi-devel"
OpenSuSE 12.2
sudo zypper in xorg-x11-libxcb-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-renderutil-devel xcb-util-wm-devel xorg-x11-devel libxkbcommon-devel libXi-devel
ArchLinux:
sudo pacman -S --needed libxcb xcb-proto xcb-util xcb-util-image xcb-util-wm libxi

On Chakra Linux, other than packages mentioned for ArchLinux, you need to install package xcb-util-keysyms separately. It's available from CCR.

Mandriva/ROSA/Unity:
urpmi 'pkgconfig(xcb)' 'pkgconfig(xcb-icccm)' 'pkgconfig(xcb-image)' 'pkgconfig(xcb-renderutil)' 'pkgconfig(xcb-keysyms)' 'pkgconfig(xrender)'
Centos 5/6

Install missing Qt build dependencies:

yum install libxcb libxcb-devel xcb-util xcb-util-devel

Install Red Hat DevTools 1.1 for CentOS-5/6 x86_64, they are required due to outdated GCC shipped with default CentOS

wget http://people.centos.org/tru/devtools-1.1/devtools-1.1.repo -O /etc/yum.repos.d/devtools-1.1.repo
yum install devtoolset-1.1

You also need to initialise your newly installed dev tools:

scl enable devtoolset-1.1 bash

# Test- Expect to see gcc version 4.7.2 ( * not * gcc version 4.4.7 )
gcc -v

For more info on preparing the environment on CentOS, see "this thread":https://forum.qt.io/viewthread/30708/.

OpenGL support

For Qt Quick 2 a graphics driver with native OpenGL 2.0 support is highly recommended.

Accessibility

It is recommended to build with accessibility enabled, install libatspi 2 and libdbus-1 development packages.

Qt WebKit

Ubuntu/Debian:
sudo apt-get install flex bison gperf libicu-dev libxslt-dev ruby
Fedora:
su- -c "yum install flex bison gperf libicu-devel libxslt-devel ruby"
OpenSUSE:
sudo zypper install flex bison gperf libicu-devel ruby
Mandriva/ROSA/Unity:
urpmi gperf

Qt WebEngine

Ubuntu (all):
sudo apt-get install libssl-dev libxcursor-dev libxcomposite-dev libxdamage-dev libxrandr-dev libfontconfig1-dev
Additional dependencies on Ubuntu 14.04:
sudo apt-get install libcap-dev libbz2-dev libgcrypt11-dev libpci-dev libnss3-dev build-essential libxcursor-dev libxcomposite-dev libxdamage-dev libxrandr-dev libdrm-dev libfontconfig1-dev libxtst-dev libasound2-dev gperf libcups2-dev libpulse-dev libudev-dev libssl-dev flex bison ruby
Fedora:
sudo yum install "qt5-*"

sudo yum install libgcrypt-devel libgcrypt pciutils-devel nss-devel libXtst-devel gperf cups-devel pulseaudio-libs-devel libgudev1-devel systemd-devel libcap-devel alsa-lib-devel flex bison ruby

Please note that these libraries need to be installed on other distributions as well, though the package names and the set of libraries that are preinstalled may differ depending on the distribution used.

Qt Multimedia

You'll need at least alsa-lib (>= 1.0.15) and gstreamer (>=0.10.24, "but <1.0 for now":http://lists.qt.io/pipermail/development/2012-November/007916.html) with the base-plugins package.

===== Ubuntu/Debian:

sudo apt-get install libasound2-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev

=====

OS X

Install the latest Xcode from the App Store. Verify that your Xcode install is properly set up for command line use:

xcodebuild -version && xcodebuild -showsdks

This should give you eg:

Xcode 4.6.1
Build version 4H512
OS X SDKs:
 Mac OS X 10.7 -sdk macosx10.7
 OS X 10.8 -sdk macosx10.8

iOS SDKs:
 iOS 6.1 -sdk iphoneos6.1

iOS Simulator SDKs:
 Simulator- iOS 5.0 -sdk iphonesimulator5.0
 Simulator- iOS 6.1 -sdk iphonesimulator6.1

You can verify that the right Xcode is being used by running:

xcode-select --print-path

If this points to /Developer you're probably using an older Xcode version. Switch to the latest one by running:

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

Windows

Windows Graphics Drivers

QML2 requires OpenGL 2.1 or higher or Open GL ES 2.0 to work.

In Windows, two options are available:

  1. Use the "ANGLE-library":http://code.google.com/p/angleproject/ to translate OpenGL calls into DirectX (default)
  2. Use the native OpenGL driver for your graphics card

A copy of ANGLE is bundled in Qt 5. To use Option 1, you need to install the "DirectX SDK":http://msdn.microsoft.com/en-us/directx/default.aspx (Note: Starting from Windows Kit 8, this is included in the Windows SDK).

To use Option 2, you need to ensure that your graphics card driver supports OpenGL 2.1 or higher (Note: The stock Windows driver only supports OpenGL 1.1, which is insufficient), and pass `-opengl desktop' to configure.exe.

Supported Compilers on Windows

  • Visual Studio 2013
  • Visual Studio 2012
  • Visual Studio 2010 or Windows SDK v7.0A (upgradable to Windows SDK v7.1)
  • Visual Studio 2008 or Windows SDK v6.0A (upgradable to Windows SDK v6.1)
  • MinGW-w64 based compiler with _g+_ version 4.7 or higher (e.g. "MinGW-builds":http://sourceforge.net/projects/mingwbuilds/, see also MinGW-64-bit).

Notes:

  • Windows SDK v6.0A/v7.0A contains the same compiler as Visual Studio 2008/2010.
  • Windows SDK 8.0 and later do not include a compiler.
  • As of 16.3.2012, if you wish to install both Visual Studio 2010 and the standalone SDK, you need to follow this order (see readme.html provided with the service pack):
    1. Install Visual Studio 2010
    2. Install Windows SDK 7.1. See also Cannot_Install_Windows_SDK page.
    3. Install Visual Studio 2010 SP1
    4. Install Visual C+ 2010 SP1 Compiler Update for the Windows SDK 7.1

Windows Build environment

We recommend creating a command prompt that provides the build environment (see the "Qt Creator README":http://qt.gitorious.org/qt-creator/qt-creator/blobs/master/README ). In this environment, Python (e.g. Active Python 2.7 later) and Perl (e.g. Active State Perl 5.12 or later) should be in the PATH. Get Perl from: "http://www.activestate.com/activeperl/downloads":http://www.activestate.com/activeperl/downloads Get Python from: "http://www.python.org/download/releases/":http://www.python.org/download/releases/ Get Ruby from: "http://www.rubyinstaller.org/downloads/":http://www.rubyinstaller.org/

Hint: Make sure that Perl is added to the path in front of git since that ships an outdated version (Perl 5.8), which will cause the scripts to fail.

Multicore building: To speed up building when using nmake, the compiler can be instructed to use all available CPU cores in one of the following ways:

  • Pass the option _-MP_ to Qt's configure
  • Set the environment variable CL (specifying Visual Studio compiler options) to /MP (On the command line: set CL=/MP)
  • Use the tool jom instead of nmake.

ICU on Windows

Qt 5 can make use of the "ICU":http://site.icu-project.org/ library for UNICODE and Globalization support. This is required for building Qt WebKit. You can use precompiled versions of ICU with a Visual Studio 2010 dependency from the website, or "compile ICU on your own":Compiling-ICU .

At compile time, the absolute paths of include and lib folders of the ICU installation must be appended to INCLUDE and LIB environment variables after calling the setup script of the Windows SDK.

At run-time, the ICU DLLs need to be found. This can be achieved by copying the DLLs to the application folder or adding the bin folder of the ICU installation to the PATH environment variable.


Getting the source code

First clone the top-level Qt 5 git repository:

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

or (if you're behind a firewall and want to use the https protocol):

git clone https://git.gitorious.org/qt/qt5.git qt5

Then check out the target branch (see Branch-Guidelines):

cd qt5
git checkout 5.4

Following the "README.git":http://qt.gitorious.org/qt/qt5/blobs/dev/README.git- file we initialize the repository using the script init-repository which clones the various sub-modules of Qt 5. Relevant options:

  • &#45;&#45;no-webkit : Consider skipping qtwebkit by passing this option. This module is quite big, takes a long time to compile and is often a source of compile errors, so it is recommend to only download it if you intend to use it. You can always re-run init-repository later on to add it.
  • &#45;&#45;codereview-username <Jira/Gerrit username> : If you plan to contribute to Qt, you should specify your codereview username so that the git remotes are properly set up.
cd qt5
perl init-repository

Configuring and building

The Qt5 build system should be fairly resilient against any "outside distractions" - it shouldn't matter whether you have other Qt versions in PATH, and QTDIR is entirely ignored. However, make sure that you have no qmake-specific environment variables like QMAKEPATH or QMAKEFEATURES set, and the qmake -query output does not refer to any other Qt versions ($HOME/.config/Trolltech/QMake.conf should be empty).

Configure the build (from top level dir). Disabling tests and examples will greatly speed up compilation:

For Linux / OS X:

./configure -developer-build -opensource -nomake examples -nomake tests

For Windows:

configure -developer-build -opensource -nomake examples -nomake tests

The -developer-build options export more symbols than in a traditional Qt build in order to allow more classes and functions to be unit tested. It also defaults to a 'debug' build, and installs the binaries in the current directory, avoiding the need for 'make install'. '-opensource' sets the license to be LGPL 2.1. The -nomake examples and -nomake tests parameters make sure examples and tests aren't compiled by default. You can always decide to compile them later by hand.

  • Hint1: On Linux, you should also pass -no-gtkstyle. This is because on a number of systems (at least SUSE and Gentoo) pkg-config --cflags gtk+–2.0 actually returns paths that include the system Qt 4.x include directories.
  • Hint2: You can add -confirm-license to get rid of the question whether you agree to the license.
  • Hint3: On Windows, you might not be able to build if sh.exe is in your PATH (for example due to a git or msys installation). Such an error is indicated by qt5-srcqtbasebinqmake.exe: command not found and alike. In this case, make sure that sh.exe is not in your path. You will have to re-configure if your installation is already configured.

Now trigger the build by running:

For Linux / OS X:

make -j4 all

If you are making an out-of-source developer build and that also includes building the QtWebKit module, the above command will "return an error":https://bugreports.qt.io/browse/QTBUG-35514 about WebCore/RunLoop.h while building QtWebKit. This can be fixed by omitting the all and simply running:

make -j4

For Windows (MSVC), choose one of the following, depending on your setup/environment:

nmake
jom
mingw32-make

Or only build a specific module, e.g. declarative, and modules it depends on:

make module-qtdeclarative

Building Qt WebKit

Windows

"WebKit.org":http://trac.webkit.org/wiki/BuildingQtOnWindows has instructions for building WebKit on Windows. "ICU":http://site.icu-project.org/ is required for building.

The tools bison, flex and gperf which are required for building are provided for convenience in the folder gnuwin32\bin. If you are using shadow builds, you must add this directory to your PATH, else no special actions need to be done manually in order to use them.

Installing (Linux / OS X)

  • Note: Installation is only needed if you haven't used the configure options -developer-build or -prefix "%PWD%/qtbase". Otherwise you can just use Qt from the build directory.

To install, run

make install

Cleaning

To get a really clean tree use:

git submodule foreach --recursive "git clean -dfx"

since make confclean no longer works from the top-level of the repo.

Getting updates

To update both the qt5.git repo as well as the submodules to the list of revisions that are known to work, run

git pull
perl init-repository -f

In addition, you should pass the same parameters to init-repository as you did in "Getting the source code".

Unlike a "normal" git submodule update, this ensures that any changes to the module structure are automatically pulled as well.

If you are planning to do nightly builds, consider using the script qt5_tool that lives in qtrepotools/bin. It provides options for updating the repository, cleaning and building. For example, qt5_tool -u -c -b can be used to clean, update and build. qt5_tool -p -c- b would be used to pull all modules to the head of their master branches.

Depending upon what changed in the source since it was last updated you might have to run configure again. To be really sure everything gets built, you can run clean first, then configure and make.

  • Hint1: The submodule update does a checkout in submodules, potentially hiding any local commits you've done. If the latter happened to you (and you haven't been working with branches anyhow), git reflog is your friend.
  • Hint2: When creating scripts for updates on Windows, note that git clean often fails if some process locks a file or folder.

Using latest branches in the submodules

By default the checkout will not contain the latest stable/dev branches of each individual submodule repository, but a combination of versions that are known to work together. If you want to get the absolute latest stuff you can do so on a per-module basis, e.g.

cd qtdeclarative
git fetch
git checkout 5.4 origin/5.4

or use qt5_tool to update all repositories:

./qtrepotools/bin/qt5_tool -p

However, there's a good chance that compilation will fail due to incompatible versions of submodules. You might want to ask other persons actively working on a module how to resolve these incompatibilities.

Some advanced shell tricks can be useful when you are making or reviewing changes in multiple modules.

Issues

Linux

configure fails with "No QPA platform plugin enabled!" (Linux)

You should install the libxcb and it's accompanying packages, see 'System Requirements'.

configure fails with errors like "cannot stat file …"

Your perl version is too old, Qt 5 beta1 needs at least 5.14.

qmlscene segfaults "Cannot create platform GL context, none of GLX, EGL, DRI2 is enabled" (Linux)

Try installing the libx11-xcb-dev package:

sudo apt-get install libx11-xcb-dev

afterwards you have to re-run configure and force qtbase/src/plugins/platforms/xcb to recompile.

WebKit doesn't compile, missing ICU

Currently there is no configure time check for ICU, so install it through the package manager through

on Ubuntu/Debian:

sudo apt-get install libicu-dev

on Fedora:

su- -c "yum install libicu-devel"
  • You can also compile Qt without Qt WebKit by deleting / renaming the qtwebkit, qtwebkit-examples-and-demos directories.
  • The --no-webkit option of configure added, see "QTBUG-20577":https://bugreports.qt.io/browse/QTBUG-20577 issue.

Qt D-Bus fails to build due to "inconsistent user-defined literal suffixes"

This occours when you attempt to build Qt 5 with GCC 4.7 while D-Bus < 1.4.20 is present on your system. (For example, the default Fedora 17 installation is prone to this error.) The error message is this:

qdbusinternalfilters.cpp:124:36: error: inconsistent user-defined literal suffixes ‘DBUS_INTROSPECT_1_0_XML_PUBLIC_IDENTIFIER’ and ‘DBUS_INTROSPECT_1_0_XML_SYSTEM_IDENTIFIER’ in string literal

Note: The error is in the header files of D-Bus itself, and it has been fixed upstream, see https://bugs.freedesktop.org/show_bug.cgi?id=46147 Solution: either upgrade to a newer version of D-Bus or edit that one line of the header file manually.

[…]::isNull is not defined (from qvariant_p.h)

C+11 support is detected while your GCC doesn't properly support it Fixed by passing -no-c11 to the configure options

cc1: fatal error: .pch/release-shared/QtGui: No such file or directory

Currently unresolved bug with the build of assembly files, see discussion at http://comments.gmane.org/gmane.comp.lib.qt.devel/5933 Fixed by passing -no-pch to the configure options

ld: hidden symbol `void QQmlThread::postMethodToThread<QQmlDataBlob*, QQmlDataBlob*, QQmlDataLoaderThread>(void (QQmlDataLoaderThread::)(QQmlDataBlob), QQmlDataBlob* const&amp;)' isn't defined

Bug with GCC versions < 4.4.x, see bug report at https://bugzilla.redhat.com/show_bug.cgi?id=493929 Fixed by adding QMAKE_CXXFLAGS_RELEASE= -fno-inline in qtdeclarative/src/qml/qml.pro

Touchscreen (or Wacom tablet) doesn't work

Qt depends on having libxi (including development headers), supporting XInput protocol 2.2 or higher, available at build time in order to have multi-touch support. Otherwise configure will fall back to XInput 2.0 which does not support touchscreens. To prove that is the problem, try this:

export QT_XCB_DEBUG_XINPUT_DEVICES=1

and try your Qt application again. At startup, Qt will enumerate the input devices available, like this

XInput version 2.2 is available and Qt supports 2.2 or greater
input device … (keyboard, mouse etc.) …
input device Advanced Silicon S.A CoolTouch™ System
 has valuator "Abs MT Position X" recognized? true
 has valuator "Abs MT Position Y" recognized? true
 has touch class with mode 1
 it's a touchscreen with type 0 capabilities 0x21 max touch points 10

If it does not say Qt supports 2.2 or greater, it means the headers weren't available when Qt was built, so the support for touch was not included. If you do have 2.2 or greater but it doesn't say it's a touchscreen at the end, there may be some other problem such that the touchscreen is not recognized, and you may want to write up a bug, after verifying that touch works in other X11 applications.

Windows

Debugging OpenGL issues (Windows)

Set the environment variable QT_QPA_VERBOSE=gl:1 and run the application with "DebugView":http://technet.microsoft.com/en-us/sysinternals/bb896647 installed. The log will show the requested vs obtained OpenGL version. If the log tells you that it only has OpenGL 1.1, QML2 will not work. Note that qmlscene will not report errors about unsupported OpenGL versions.

Questions & Comments

Please raise questions & comments about this article in the forum: http://qt-project.org/forums/viewthread/7018