Archive:Getting Started/Build/Qt: Difference between revisions

From KDE TechBase
m (Reverted edits by KennethMartinez (talk) to last revision by AnneW)
 
(12 intermediate revisions by 5 users not shown)
Line 1: Line 1:
__NOINDEX__
{{warning|This page is yet to be reviewed for changes required by the migration to Git.  Information and commands on this page may no longer be valid and should be used with care. Please see the [[Development/Git|KDE Git hub page]] for more details. }}
{{warning|This page is yet to be reviewed for changes required by the migration to Git.  Information and commands on this page may no longer be valid and should be used with care. Please see the [[Development/Git|KDE Git hub page]] for more details. }}


{{Template:I18n/Language Navigation Bar|Getting_Started/Build/Qt}}


{{TutorialBrowser|
{{TutorialBrowser|
Line 19: Line 19:
This page details the build requirements for Qt and some related packages.  For most of these requirements it is preferable to use your distribution supplied packages, however in some case you will need to build some requirements yourself and this page will also explain how to do so.
This page details the build requirements for Qt and some related packages.  For most of these requirements it is preferable to use your distribution supplied packages, however in some case you will need to build some requirements yourself and this page will also explain how to do so.


The 'Stable' column shows the required version for the current Stable branch while the 'Master' column shows the required version for the current development version (aka 'trunk').  On most distributions you will also need to install the matching -devel packages for some of the software, this is indicated in the Devel column of the table.
=== Required Steps ===
 
You need to have completed the following steps:
* Set up your [[../Environment|Build Environment]]
* Selected your [[../Recipes|Build Recipes]]
* Installed the [[../Requirements|System Requirements]]
* Understand the [[../Requirements#Definitions|Requirements Table format]]


== makeobj ==
== makeobj ==
Requirements as at 2011-03-02, Stable Branch currently KDE Release 4.6, Master currently targeting KDE Release 4.7.


{| border="1" cellpadding="5" cellspacing="0" align="center"
Makeobj is a shell script to assist make.
 
{| border="1" cellpadding="5" cellspacing="0"
|+ '''KDE Build Requirements'''
|-
|-
! Requirement
! width="20%" style="background-color:#EFEFEF;" | Requirement
! Stable
! width="15%" style="background-color:#EFEFEF;" | Stable Requires
! Master
! width="15%" style="background-color:#EFEFEF;" | Unstable Requires
! Devel?
! width="10%" style="background-color:#EFEFEF;" | Devel Pkgs?
! Details
! width="40%" style="background-color:#EFEFEF;" | Details
|-
|-
| [http://websvn.kde.org/trunk/KDE/kdesdk/scripts/makeobj makeobj]
| [http://websvn.kde.org/trunk/KDE/kdesdk/scripts/makeobj makeobj]
| r1215872
| style="background-color:#66FF66" | [http://websvn.kde.org/*checkout*/trunk/KDE/kdesdk/scripts/makeobj r1215872]
| r1215872
| style="background-color:#66FF66" | [http://websvn.kde.org/*checkout*/trunk/KDE/kdesdk/scripts/makeobj r1215872]
| No
| No
|  
| A make helper shell script
|}
|}


Makeobj is a script to assist make.  It is a part of the kdesdk module but is needed to build all KDE modules.  If you have kdesdk installed on your system then this version should be sufficient, but r1215872 is recommended when working with Git.
 
It is a part of the kdesdk module and, while optional, is strongly recommended when building KDE modules.  If you have kdesdk installed on your system then this version should be sufficient, but r1215872 is recommended when working with Git.


To install it [http://websvn.kde.org/*checkout*/trunk/KDE/kdesdk/scripts/makeobj download via WebSVN] and install into your path somewhere, preferably ~/.bin.  Once you have built kdesdk from source you should then remove this copy.
To install it [http://websvn.kde.org/*checkout*/trunk/KDE/kdesdk/scripts/makeobj download via WebSVN] and install into your path somewhere, preferably ~/.bin.  Once you have built kdesdk from source you should then remove this copy.
Line 45: Line 54:
== Qt ==
== Qt ==


Requirements as at 2011-03-02, Stable Branch currently KDE Release 4.6, Master currently targeting KDE Release 4.7.  
Qt is the development freamework that all KDE Software is built upon.


{| border="1" cellpadding="5" cellspacing="0" align="center"
{| border="1" cellpadding="5" cellspacing="0"
|+ '''KDE Build Requirements'''
|-
|-
! Requirement
! width="20%" style="background-color:#EFEFEF;" | Requirement
! Stable
! width="15%" style="background-color:#EFEFEF;" | Stable Requires
! Master
! width="15%" style="background-color:#EFEFEF;" | Unstable Requires
! Devel?
! width="10%" style="background-color:#EFEFEF;" | Devel Pkgs?
! Details
! width="40%" style="background-color:#EFEFEF;" | Details
|-
|-
| [http://qt.nokia.com/ Qt]
| [http://qt.nokia.com/ Qt]
| >= 4.7.0
| style="background-color:#FF6666" | >= 4.7.0
| >= 4.7.0
| style="background-color:#FF6666" | >= 4.7.0
| Yes
| Yes
|  
| The Qt development framework
|}
|}


Qt is the toolkit that all KDE is built upon.  Most distributions package a recent enough Qt to build KDE, although you may need to add an extra repository to do so.  Building Qt can take a long time, so packages are preferred for a quick start.


At some stage, KDE master may switch to relying on a development version of Qt, or may require patches to Qt for bug-fixes that have not yet been released by Qt.  In this case you may need to build your own copy of Qt to build KDE against and it is recommended that you use the KDE clone qt-kde when this happensYou can choose to overwrite your system Qt install when doing so but this is not recommended.  You are advised to set your build environment $QTDIR install directory to a local folder different to $KDEDIR to allow easy switching between Qt versions.
Most distributions package a recent enough Qt to build KDE, although you may need to add an extra repository to do soBuilding Qt can take a long time, so packages are preferred for a quick start.


Please see the [https://projects.kde.org/projects/qt-kde qt-kde project page] for further details.  It is recommended to read [https://projects.kde.org/projects/qt-kde/repository/revisions/master/entry/README.kde-qt README.qt-kde file] for the necessary Qt configure options as well as currently known issues.
At some stage, KDE master may switch to relying on a development version of Qt, or may require patches to Qt for bug-fixes that have not yet been released by Qt.  In this case you may need to build your own copy of Qt to build KDE against.  You can choose use either the main Qt repository on Gitorious or the KDE copy of Qt.  You can choose to overwrite your system Qt install when doing so but this is not recommended.  You are advised to set your build environment $QTDIR install directory to a local folder different to $KDEDIR to allow easy switching between Qt versions.
 
Please see the [https://projects.kde.org/projects/qt KDE Qt project page] for further details.  It is recommended to read [https://projects.kde.org/projects/qt/repository/revisions/master/entry/INSTALL the INSTALL file] for more details.


Note that you need to install Qt and Phonon from Qt and then later to install Phonon KDE from git at the same location. This will ensure you get sound in Qt-based applications as well as in KDE ones.
Note that you need to install Qt and Phonon from Qt and then later to install Phonon KDE from git at the same location. This will ensure you get sound in Qt-based applications as well as in KDE ones.


=== Easy Recipe ===
=== Easy Recipe ===
The Easy Recipe relies on you setting up your environment according to the KDE recommendations.  This will give you many shortcuts to save on typing.  See the [[../Environment|Build Environment]] section to do this.


Ensure you setup your environment $QTDIR to point to somewhere suitable.
Ensure you setup your environment $QTDIR to point to somewhere suitable, e.g. /usr/local.


  cd <your source directory>
  cd <your source directory>
  git clone kde:qt-kde
  git clone kde:qt
  ./configure ''[configure options from README.kde-qt replacing <installdir> with $QTDIR]''
cd qt
  ./configure ''<configure options, use $QTDIR as your 'installdir'>''
  nice make -j2 # for faster compiles use -j(X+1)' where X is your number of processor cores
  nice make -j2 # for faster compiles use -j(X+1)' where X is your number of processor cores
  make install
  make install


=== Full Recipe ===
=== Full Recipe ===
The Full Recipe is provided for those who wish to control their build environment or to see the full steps required and who don't mind lots of typing.


  cd <your source directory>
  cd <your source directory>
  git clone git://anongit.kde.org/qt-kde
  git clone git://anongit.kde.org/qt
  cd qt-kde
  cd qt
  ./configure ''[configure options from README.kde-qt''
  ./configure ''<configure options>''
  nice make -j2 # for faster compiles use -j(X+1)' where X is your number of processor cores
  nice make -j2 # for faster compiles use -j(X+1)' where X is your number of processor cores
  make install
  make install
Line 93: Line 103:
=== Troubleshooting ===
=== Troubleshooting ===


If ./configure produces errors about missing headers, run the following command before trying again: <code>QTDIR=`pwd` bin/syncqt</code>
If ./configure produces errors about missing headers, run the following command before trying again: <syntaxhighlight lang="text">QTDIR=`pwd` bin/syncqt</syntaxhighlight>


Make sure <tt>which qmake</tt> delivers something out of $QTDIR, e.g. /home/kde-devel/qt-kde/bin/qmake
Make sure <tt>which qmake</tt> delivers something out of $QTDIR, e.g. /home/kde-devel/qt-kde/bin/qmake
Line 106: Line 116:


=== Generating local API documentation ===
=== Generating local API documentation ===
It's nice to have the Qt documentation locally for nice integration with [[Getting_Started/Set_up_KDE_4_for_development#KDevelop|KDevelop]], and doing this is really quite easy (also shown in {{path|README.kde-qt}}):
 
  cd $KDE_SRC/qt-kde
It's nice to have the Qt documentation locally for nice integration with [http://kdevelop.org/ KDevelop], and doing this is really quite easy:
  cd $KDE_SRC/qt
  make docs
  make docs
  ./config.status
  ./config.status
Line 114: Line 125:


== DBusMenu-Qt ==
== DBusMenu-Qt ==
Requirements as at 2011-03-02, Stable Branch currently KDE Release 4.6, Master currently targeting KDE Release 4.7.


{| border="1" cellpadding="5" cellspacing="0" align="center"
DBusMenu-Qt is a library providing a Qt implementation of the DBusMenu spec.
 
{| border="1" cellpadding="5" cellspacing="0"
|+ '''KDE Build Requirements'''
|-
|-
! Requirement
! width="20%" style="background-color:#EFEFEF;" | Requirement
! Stable
! width="15%" style="background-color:#EFEFEF;" | Stable Requires
! Master
! width="15%" style="background-color:#EFEFEF;" | Unstable Requires
! Devel?
! width="10%" style="background-color:#EFEFEF;" | Devel Pkgs?
! Details
! width="40%" style="background-color:#EFEFEF;" | Details
|-
|-
| [http://people.canonical.com/~agateau/dbusmenu/index.html DBusMenu-Qt]
| [https://launchpad.net/libdbusmenu-qt DBusMenu-Qt]
|  
|  
|  
|  
| Yes
| Yes
|  
| A Qt implementation of the DBusMenu spec.
|}
|}


DBusMenu-Qt is a library providing a Qt implementation of the DBusMenu spec.  Your distribution packages should be sufficient for this package.


Please see the [http://people.canonical.com/~agateau/dbusmenu/index.html DBusMenu-Qt home page] for more deatils.
Your distribution packages should be sufficient for this requirement.  If you need to build your own copy using the Easy or Full Recipe then either download a tarball form the project home page or use the following bazaar command:
 
bzr branch lp:libdbusmenu-qt


You need json to build the tests.
You need json to build the tests.
=== Easy Recipe ===
This recipe assumes you have set up the recommended KDE scripts, environment variables, and git configuration.
cd <your source root directory>
git clone git://gitorious.org/dbusmenu/dbusmenu-qt.git
cd dbusmenu-qt
cmakekde
=== Full Recipe ===
This recipe assumes you are not using the recommended scripts and have properly set up your own environment.
cd <your source root directory>
git clone git://gitorious.org/dbusmenu/dbusmenu-qt.git
cd <your build root directory, or the module source dir>
mkdir <your module build dir>
cd <your module build dir>
cmake <path to your module source dir>
      \ -DCMAKE_INSTALL_PREFIX=$KDEDIR
      \ -DCMAKE_BUILD_TYPE=debugfull
nice make -j2 # for faster compiles use -j(X+1)' where X is your number of processor cores
make install


== Next Step ==
== Next Step ==
Once all requirements have been installed it is time to install [[../KdeSupport|kdesupport]]
Once Qt has been installed it is time to install [[../KDE_Support|KDE Support]]

Latest revision as of 15:53, 31 July 2012

Warning
This page is yet to be reviewed for changes required by the migration to Git. Information and commands on this page may no longer be valid and should be used with care. Please see the KDE Git hub page for more details.


Building KDE4 From Source/Qt
Tutorial Series   Getting Started
Previous   Getting_Started/Build/Requirements
What's Next   Getting_Started/Build/KdeSupport
Further Reading   n/a

Introduction

This page details the build requirements for Qt and some related packages. For most of these requirements it is preferable to use your distribution supplied packages, however in some case you will need to build some requirements yourself and this page will also explain how to do so.

Required Steps

You need to have completed the following steps:

  • Set up your [[../Environment|Build Environment]]
  • Selected your [[../Recipes|Build Recipes]]
  • Installed the [[../Requirements|System Requirements]]
  • Understand the [[../Requirements#Definitions|Requirements Table format]]

makeobj

Makeobj is a shell script to assist make.

KDE Build Requirements
Requirement Stable Requires Unstable Requires Devel Pkgs? Details
makeobj r1215872 r1215872 No A make helper shell script


It is a part of the kdesdk module and, while optional, is strongly recommended when building KDE modules. If you have kdesdk installed on your system then this version should be sufficient, but r1215872 is recommended when working with Git.

To install it download via WebSVN and install into your path somewhere, preferably ~/.bin. Once you have built kdesdk from source you should then remove this copy.

Qt

Qt is the development freamework that all KDE Software is built upon.

KDE Build Requirements
Requirement Stable Requires Unstable Requires Devel Pkgs? Details
Qt >= 4.7.0 >= 4.7.0 Yes The Qt development framework


Most distributions package a recent enough Qt to build KDE, although you may need to add an extra repository to do so. Building Qt can take a long time, so packages are preferred for a quick start.

At some stage, KDE master may switch to relying on a development version of Qt, or may require patches to Qt for bug-fixes that have not yet been released by Qt. In this case you may need to build your own copy of Qt to build KDE against. You can choose use either the main Qt repository on Gitorious or the KDE copy of Qt. You can choose to overwrite your system Qt install when doing so but this is not recommended. You are advised to set your build environment $QTDIR install directory to a local folder different to $KDEDIR to allow easy switching between Qt versions.

Please see the KDE Qt project page for further details. It is recommended to read the INSTALL file for more details.

Note that you need to install Qt and Phonon from Qt and then later to install Phonon KDE from git at the same location. This will ensure you get sound in Qt-based applications as well as in KDE ones.

Easy Recipe

Ensure you setup your environment $QTDIR to point to somewhere suitable, e.g. /usr/local.

cd <your source directory>
git clone kde:qt
cd qt
./configure <configure options, use $QTDIR as your 'installdir'>
nice make -j2 # for faster compiles use -j(X+1)' where X is your number of processor cores
make install

Full Recipe

cd <your source directory>
git clone git://anongit.kde.org/qt
cd qt
./configure <configure options>
nice make -j2 # for faster compiles use -j(X+1)' where X is your number of processor cores
make install

Troubleshooting

If ./configure produces errors about missing headers, run the following command before trying again:

QTDIR=`pwd` bin/syncqt

Make sure which qmake delivers something out of $QTDIR, e.g. /home/kde-devel/qt-kde/bin/qmake

If you get "error: X11/Xlib.h: No such file or directory", install the devel package of xorg (the actual name may vary between operating systems, for example it is xorg-dev on Ubuntu based systems such as Kubuntu).

If you get an error in the configure step about missing defines, check the value of $QMAKESPEC. Some distributions set this to point directly to the system-installed Qt. If unset QMAKESPEC solves the problem, you probably want to add it to the ~/.bashrc script.

If you get an error ".pch/debug-shared/QtCore", this is because Qt-4.3 enables precompiled headers if your gcc supports it, but for some reason it doesn't work for you. If you use distcc, configure qt with -no-pch. If you use icecream, update to the latest icecream from svn trunk.

Try running any Qt program, like assistant.

Generating local API documentation

It's nice to have the Qt documentation locally for nice integration with KDevelop, and doing this is really quite easy:

cd $KDE_SRC/qt
make docs
./config.status
make install

Note that it is necessary to do this only once, even if you rebuild Qt later.

DBusMenu-Qt

DBusMenu-Qt is a library providing a Qt implementation of the DBusMenu spec.

KDE Build Requirements
Requirement Stable Requires Unstable Requires Devel Pkgs? Details
DBusMenu-Qt Yes A Qt implementation of the DBusMenu spec.


Your distribution packages should be sufficient for this requirement. If you need to build your own copy using the Easy or Full Recipe then either download a tarball form the project home page or use the following bazaar command:

bzr branch lp:libdbusmenu-qt

You need json to build the tests.

Next Step

Once Qt has been installed it is time to install [[../KDE_Support|KDE Support]]