Diff for "BuildingQuantumGisPoint8FromSource"


Differences between revisions 1 and 27 (spanning 26 versions)
Revision 1 as of 2006-09-27 19:23:37
Size: 9550
Editor: micro76
Comment: Initial refactor of qgis0.8 qt4 based docs from old all in one doc
Revision 27 as of 2017-09-04 21:35:12
Size: 8604
Editor: ckimes
Comment: Tag with Unsupported and Deletion
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Building QGIS Head on Qt4.1 =

As I write this QGIS 0.8 is undergoing major changes and is very unstable. It is being ported to Qt4. Because of this I will describe how to install it alongside your existing QGIS 0.7.4 install (which you can install using the procedure described above. When 0.8 is released the above instructions will be removed.

/!\ '''Note:'''

/!\ '''Note: This part of the document is still under construction. '''

/!\ '''Note:'''

== QGIS Specific Requirements ==


<<Include(Tag/Unsupported)>>
<<Include(Tag/Deletion)>>
## Really old material for unsupported release (Edgy)

<<TableOfContents>>

= Building QGIS 0.8 with Qt4.x =

{{attachment:qgis0.8splash.gif}}

'''Requires:''' Ubuntu Edgy

'''See Also:''' BuildingQuantumGisFromSource

'''Document Maintainer:''' This document is maintained by Tim Sutton (tim _at_ linfiniti.com)

These notes are for if you want to build QGIS from source. One of the major aims here is to show how this can be done using binary packages for '''all''' dependencies - building only the core QGIS stuff from source. Currently the gdal grass raster driver needs to be built from source too - Ill revise these notes when a suitable package is available. I prefer this approach because it means we can leave the business of managing system packages to apt and only concern ourselves with coding QGIS! Note this document is still under construction...and is continually evolving.

As I write this QGIS 0.8 is undergoing major changes and is still considered unstable. QGIS 0.8 is a major revision of the QGIS codebase, including a port to Qt4. I will describe how to install it alongside your existing QGIS 0.7.4 install (which you can install using the procedure described in BuildingQuantumGisPoint7FromSource). This document assumes you have made a fresh install and have a 'clean' system. These instructions should work fine if this is a system that has already been in use for a while, you may need to just skip those steps which are irrelevant to you.

/!\ '''Note:''' This is a 'cut and paste' tutorial - in most cases you can simply copy the commands listed in codeblocks that look like this:

{{{
somecommand to be pasted
}}}

/!\ '''Note: This document is still under construction. '''


= Prepare apt =
Line 21: Line 37:
Also you will need to be running (K)Ubuntu 'dapper' in order for all dependencies to be met. Also you will need to be running (K)Ubuntu 'edgy' in order for all dependencies to be met.
Line 29: Line 45:
=== Install package dependencies. ===

Even if you dont plan to code using kdevelop, its worth installing first because it will make sure you have the dependencies for a useable c++ compilation environment. Not all these packages are strictly needed for QGIS to build, but I find them convenient to have. If you are short on disk space or bandwidth, you may wish to be a little more selective. If you are unsure, just install them all, they cant cause any harm.

{{{
sudo apt-get install kdevelop3 autoconf2.13 autobook autoconf-archive gnu-standards libqt3-mt-dev qt3-doc kdbg libarts1-dev kdelibs4-doc htdig doxygen kdoc sgmltools-lite linuxdoc-tools a2ps gv qt3-designer qt3-dev-tools kbabel graphviz c-cpp-reference g++ libtool flex bison automake1.8 checkinstall ccache libtool proj sqlite3 libsqlite3-dev libsqlite3-0 gsl-bin libgsl0 libgsl0-dev cvs
}}}

/!\ '''Note:''' This will prompt to install a whole heap of additional packages....go ahead its ok.

Now you can install all the packages qgis requires to build:

{{{
sudo apt-get build-dep qgis
}}}

Install Qt4.1 from apt

{{{

sudo apt-get install libqt4-core libqt4-debug libqt4-debug-dev libqt4-dev libqt4-gui libqt4-qt3support libqt4-sql qt4-designer qt4-designer qt4-dev-tools qt4-doc qt4-qtconfig uim-qt
}}}

Qt4 and Qt3 packages are designed to live alongside each other. This means that for example if you have them both installed you will have three qmake exe's:

{{{

= Install Qt4 =

{{{
sudo apt-get install libqt4-core libqt4-debug libqt4-debug-dev libqt4-dev libqt4-gui libqt4-qt3support libqt4-sql lsb-qt4 qt4-designer qt4-dev-tools qt4-doc qt4-qtconfig uim-qt gcc libapt-pkg-perl resolvconf
}}}

/!\ '''A Special Note:''' If you are following this set of instructions on a system where you already have Qt3 development tools installed, there will be a conflict between Qt3 tools and Qt4 tools. For example, qmake will point to the Qt3 version not the Qt4. Ubuntu Qt4 and Qt3 packages are designed to live alongside each other. This means that for example if you have them both installed you will have three qmake exe's:

{{{
Line 59: Line 58:

}}}

The same applies to all other qt binaries. You will notice that the canonical 'qmake' is managed by apt alternatives, so before we start to build QGIS, we need to make Qt4 the default. To return Qt3 to default later you can use this same process:
}}}

The same applies to all other Qt binaries. You will notice above that the canonical 'qmake' is managed by apt alternatives, so before we start to build QGIS, we need to make Qt4 the default. To return Qt3 to default later you can use this same process.

You can use apt alternatives to correct this so that the Qt4 version of applications is used in all cases
:
Line 66: Line 66:

There are 2 alternatives which provide `qmake'.

  Selection Alternative
-----------------------------------------------
*+ 1 /usr/bin/qmake-qt3
      2 /usr/bin/qmake-qt4

Press enter to keep the default[*], or type selection number: 2
Using `/usr/bin/qmake-qt4' to provide `qmake'.
Line 78: Line 67:

There are 2 alternatives which provide `uic'.

  Selection Alternative
-----------------------------------------------
*+ 1 /usr/bin/uic-qt3
      2 /usr/bin/uic-qt4

Press enter to keep the default[*], or type selection number: 2
Using `/usr/bin/uic-qt4' to provide `uic'.
Line 90: Line 68:

There are 2 alternatives which provide `designer'.

  Selection Alternative
-----------------------------------------------
*+ 1 /usr/bin/designer-qt3
      2 /usr/bin/designer-qt4

Press enter to keep the default[*], or type selection number: 2
Using `/usr/bin/designer-qt4' to provide `designer'.
Line 102: Line 69:

There are 2 alternatives which provide `assistant'.

  Selection Alternative
-----------------------------------------------
*+ 1 /usr/bin/assistant-qt3
      2 /usr/bin/assistant-qt4

Line 112: Line 70:

There are 2 alternatives which provide `qtconfig'.

  Selection Alternative
-----------------------------------------------
*+ 1 /usr/bin/qtconfig-qt3
      2 /usr/bin/qtconfig-qt4

Press enter to keep the default[*], or type selection number: 2
Using `/usr/bin/qtconfig-qt4' to provide `qtconfig'.
Line 124: Line 71:

There are 2 alternatives which provide `moc'.

  Selection Alternative
-----------------------------------------------
*+ 1 /usr/bin/moc-qt3
      2 /usr/bin/moc-qt4

Press enter to keep the default[*], or type selection number: 2
Using `/usr/bin/moc-qt4' to provide `moc'.
Line 136: Line 72:

There are 2 alternatives which provide `lupdate'.

  Selection Alternative
-----------------------------------------------
*+ 1 /usr/bin/lupdate-qt3
      2 /usr/bin/lupdate-qt4

Press enter to keep the default[*], or type selection number: 2
Using `/usr/bin/lupdate-qt4' to provide `lupdate'.
Line 148: Line 73:

There are 2 alternatives which provide `lrelease'.

  Selection Alternative
-----------------------------------------------
*+ 1 /usr/bin/lrelease-qt3
      2 /usr/bin/lrelease-qt4

Press enter to keep the default[*], or type selection number: 2
Using `/usr/bin/lrelease-qt4' to provide `lrelease'.
Line 160: Line 74:

}}}

=== Setup ccache ===
}}}

Use the simple command line dialog that appears after running each of the above commands to select the Qt4 version of the relevant applications.

= Install additional software dependencies required by QGIS =

{{{
sudo apt-get install gdal-bin libgdal1-dev libgeos-dev proj libtool libgdal-doc libhdf4g-dev libhdf4g-run autoconf2.13 automake1.9 python-dev swig libgsl0-dev g++ libjasper-1.701-dev libtiff4-dev subversion gsl-bin libsqlite3-dev sqlite3 ccache make libpq-dev flex bison firefox
}}}


= GRASS Specific Steps =

/!\ '''Note:''' If you don't need to build with GRASS support, you can skip this section.

Now you can install grass from dapper:

{{{
sudo apt-get install grass libgrass-dev libgdal1-grass
}}}

= Setup ccache (Optional) =
Line 173: Line 105:
=== Make sure the correct version of automake is being used ===

/!\ NOTE: If you installed kdevelop using the step above, ubuntu will have installed automake-1.4. This causes a problem when running the autogen.sh command below as it picks up the wrong copy of aclocal and automake. To circumvent this while still keeping both installed on your system do the following:

{{{
sudo update-alternatives --config automake
}}}

Which will present you with something like:
{{{
There are 4 alternatives which provide `automake'.

  Selection Alternative
-----------------------------------------------
      1 /usr/bin/automake-1.6
      2 /usr/bin/automake-1.8
*+ 3 /usr/bin/automake-1.4
      4 /usr/bin/automake-1.9

Press enter to keep the default[*], or type selection number: 2
Using `/usr/bin/automake-1.8' to provide `automake'.
}}}

== GRASS Specific Steps ==

=== Install GRASS ===

/!\ If you don't need to build with GRASS support, you can skip this section.

Now you can install grass from breezy:

{{{
sudo apt-get install grass libgrass-dev
}}}

=== Install GRASS raster driver for gdal ===

The apt package for this is currently not in ubuntu repositories. Here is one way to install it :

{{{
cd /tmp
wget http://ftp.uk.debian.org/debian/pool/main/libg/libgdal-grass/libgdal1-grass_1.2.6-1_i386.deb
sudo dpkg -i libgdal1-grass_1.2.6-1_i386.deb
}}}


== Starting the compile ==


The qt files are not in the expected place, so you need to tell configure where to look for them. Or you can {{{export QTDIR=/usr/share/qt3}}}.


Now you can proceed to the initial configure step:

{{{
./autogen.sh --enable-debug --prefix=/usr --with-qtdir=/usr/share/qt3 --with-grass=/usr/lib/grass
}}}

At the end of the autogen / configure process above you should see output like below, indicating that qgis is going to be built with all its bells & whistles...

{{{
= Prepare your development environment =

As a convention I do all my development work in $HOME/dev/<language>, so in this case we will create a work environment for C++ development work like this:

{{{
mkdir -p ${HOME}/dev/cpp
cd ${HOME}/dev/cpp
}}}

This directory path will be assumed for all instructions that follow.


= Check out the QGIS Source Code =

There are two ways the source can be checked out. Use the anonymous method if you do not have edit privaleges for the QGIS source repository, or use the developer checkout if you have permissions to commit source code changes.

1. Anonymous Checkout

{{{
cd ${HOME}/dev/cpp
svn co https://svn.qgis.org/repos/qgis/trunk/qgis qgis
}}}

2. Developer Checkout

{{{
cd ${HOME}/dev/cpp
svn co --username <yourusername> https://svn.qgis.org/repos/qgis/trunk/qgis qgis
}}}

The first time you check out the source you will be prompted to accept the qgis.org certificate. Press 'p' to accept it permanently:

{{{
Error validating server certificate for 'https://svn.qgis.org:443':
 - The certificate is not issued by a trusted authority. Use the
   fingerprint to validate the certificate manually!
Certificate information:
 - Hostname: svn.qgis.org
 - Valid: from Apr 1 00:30:47 2006 GMT until Mar 21 00:30:47 2008 GMT
 - Issuer: Developer Team, Quantum GIS, Anchorage, Alaska, US
 - Fingerprint: 2f:cd:f1:5a:c7:64:da:2b:d1:34:a5:20:c6:15:67:28:33:ea:7a:9b
(R)eject, accept (t)emporarily or accept (p)ermanently?
}}}

= Starting the compile =

I compile my development version of QGIS into my ~/apps directory to avoid conflicts with Ubuntu packages that may be under /usr. This way for example you can use the binary packages of QGIS on your system along side with your development version. I suggest you do something similar:

{{{
mkdir -p ${HOME}/apps
}}}

I have written a script to automate building on debian. Simply go into the qgis checkout dir and run the script to commence building:

{{{
cd ${HOME}/dev/cpp/qgis
./build.sh ${HOME}/apps debug
}}}

The second option above is the destination / install dir, and the xdebug tells the script to build QGIS with debug symbols and verbose debug output. At the end of the autogen / configure process called by the script above you should see output like below, indicating that QGIS is going to be built with all its bells & whistles...

{{{
Line 235: Line 169:
qgis 0.6.0devel22 qgis 0.8.0
Line 238: Line 172:
GEOS : yes (Version 2.0.1)
PostgreSQL : yes (Version 7.4.7)
GRASS : yes <-- may be no if you skipped grass step above!
SPIT : yes
Georeferencer : yes
GPS/GPX : yes
PROJ4 : yes
SQLITE3 : yes

Debug : yes
Plugin dir : ${exec_prefix}/lib/qgis

The binary will be installed in /usr/bin

The build is using Qt in /usr/share/qt3
------------------------------------------
Configure finished, type 'make' to build.
}}}

Now we go on to the compilation step. I like to time the build so I can get an idea of how long it takes in general. THe first time you build will take substantially longer as ccache will not receive many hits. Subsequent builds should be much faster!

{{{
echo `date` > /tmp/qgis_compile.txt ; make ; echo `date` >> /tmp/qgis_compile.txt
}}}





{{{

export QTDIR=/usr/local/Trolltech/Qt-4.0.1/
export PATH=$QTDIR/bin/:$PATH
}}}

{{{
==========================================
qgis 0.7.9devel2
------------------------------------------
GDAL/OGR : yes (Version 1.2.6)
GEOS : yes (Version 2.1.1)
PostgreSQL : yes (Version 8.0.3)
GEOS : yes (Version 2.1.4)
PostgreSQL : yes (Version 8.1.4)
Line 286: Line 180:
Python : no

Debug : yes
Plugin dir : ${exec_prefix}/lib/qgis

The binary will be installed in /home/aps02ts/apps//bin
}}}



{{{
mkdir $HOME/apps
./autogen.sh --enable-debug --prefix=$HOME/apps/ --with-qtdir=/usr/local/Trolltech/Qt-4.0.1/ --with-grass=/usr/lib/grass && make && sudo make install
}}}
Python : yes

CPPFLAGS :
CXXFLAGS : -g -O2

Debug : no
Plugin dir : /home/timlinux/apps/lib/qgis

The binary will be installed in /home/timlinux/apps/bin

The build is using Qt in /usr
Linking with Qt using -lQtCore -lQt3Support -lQtGui -lQtNetwork -lQtSvg -lQtCore -lQt3Support -lQtGui -lQtNetwork -lQtXml -lQtSvg -lQtTest -lQtDesigner
------------------------------------------
Configure finished, type 'make' to build.
}}}

The script will carry on to build QGIS - it may take a little while to go and have a cup of your favourite beverage while you wait...

= Running QGIS =

Once the compile is complete it should pop up a page in firefox with unit test results. At the time of writing the unit tests are just stubs - we still need to create the test implementations - so dont worry to much about their output at the moment.

Now you can try to run QGIS:

{{{
$HOME/apps/bin/qgis
}}}

If all has worked properly the QGIS application should start up and appear on your screen.

Please visit http://qgis.org for information on joining our mailing lists and getting involved in the project further.
Line 301: Line 213:
CategoryDocumentation

Tag/tag.png

Unsupported Version
This article applies to an unsupported version of Ubuntu. More info...

Tag/tag.png

Candidate for Deletion
This article may not be appropriate for this wiki, and may be deleted. More info...

Building QGIS 0.8 with Qt4.x

qgis0.8splash.gif

Requires: Ubuntu Edgy

See Also: BuildingQuantumGisFromSource

Document Maintainer: This document is maintained by Tim Sutton (tim _at_ linfiniti.com)

These notes are for if you want to build QGIS from source. One of the major aims here is to show how this can be done using binary packages for all dependencies - building only the core QGIS stuff from source. Currently the gdal grass raster driver needs to be built from source too - Ill revise these notes when a suitable package is available. I prefer this approach because it means we can leave the business of managing system packages to apt and only concern ourselves with coding QGIS! Note this document is still under construction...and is continually evolving.

As I write this QGIS 0.8 is undergoing major changes and is still considered unstable. QGIS 0.8 is a major revision of the QGIS codebase, including a port to Qt4. I will describe how to install it alongside your existing QGIS 0.7.4 install (which you can install using the procedure described in BuildingQuantumGisPoint7FromSource). This document assumes you have made a fresh install and have a 'clean' system. These instructions should work fine if this is a system that has already been in use for a while, you may need to just skip those steps which are irrelevant to you.

Warning /!\ Note: This is a 'cut and paste' tutorial - in most cases you can simply copy the commands listed in codeblocks that look like this:

somecommand to be pasted

Warning /!\ Note: This document is still under construction.

Prepare apt

The packages qgis depends on to build are available in the "universe" component of Ubuntu. This is not activated by default, so you need to activate it:

  1. Edit your /etc/apt/sources.list file.
  2. Uncomment the all the lines starting with "deb"

Also you will need to be running (K)Ubuntu 'edgy' in order for all dependencies to be met.

Now update your local sources database:

sudo apt-get update

Install Qt4

sudo apt-get install libqt4-core libqt4-debug libqt4-debug-dev libqt4-dev libqt4-gui libqt4-qt3support libqt4-sql lsb-qt4 qt4-designer qt4-dev-tools qt4-doc qt4-qtconfig uim-qt gcc libapt-pkg-perl resolvconf

Warning /!\ A Special Note: If you are following this set of instructions on a system where you already have Qt3 development tools installed, there will be a conflict between Qt3 tools and Qt4 tools. For example, qmake will point to the Qt3 version not the Qt4. Ubuntu Qt4 and Qt3 packages are designed to live alongside each other. This means that for example if you have them both installed you will have three qmake exe's:

/usr/bin/qmake -> /etc/alternatives/qmake
/usr/bin/qmake-qt3
/usr/bin/qmake-qt4

The same applies to all other Qt binaries. You will notice above that the canonical 'qmake' is managed by apt alternatives, so before we start to build QGIS, we need to make Qt4 the default. To return Qt3 to default later you can use this same process.

You can use apt alternatives to correct this so that the Qt4 version of applications is used in all cases:

sudo update-alternatives --config qmake
sudo update-alternatives --config uic
sudo update-alternatives --config designer
sudo update-alternatives --config assistant
sudo update-alternatives --config qtconfig
sudo update-alternatives --config moc
sudo update-alternatives --config lupdate
sudo update-alternatives --config lrelease
sudo update-alternatives --config linguist

Use the simple command line dialog that appears after running each of the above commands to select the Qt4 version of the relevant applications.

Install additional software dependencies required by QGIS

sudo apt-get install gdal-bin libgdal1-dev libgeos-dev proj libtool libgdal-doc libhdf4g-dev libhdf4g-run autoconf2.13 automake1.9 python-dev swig libgsl0-dev g++ libjasper-1.701-dev libtiff4-dev  subversion gsl-bin libsqlite3-dev sqlite3 ccache make libpq-dev flex bison firefox

GRASS Specific Steps

Warning /!\ Note: If you don't need to build with GRASS support, you can skip this section.

Now you can install grass from dapper:

sudo apt-get install grass libgrass-dev libgdal1-grass

Setup ccache (Optional)

You should also setup ccache to speed up compile times:

cd /usr/local/bin
sudo ln -s /usr/bin/ccache gcc
sudo ln -s /usr/bin/ccache g++

Prepare your development environment

As a convention I do all my development work in $HOME/dev/<language>, so in this case we will create a work environment for C++ development work like this:

mkdir -p ${HOME}/dev/cpp
cd ${HOME}/dev/cpp

This directory path will be assumed for all instructions that follow.

Check out the QGIS Source Code

There are two ways the source can be checked out. Use the anonymous method if you do not have edit privaleges for the QGIS source repository, or use the developer checkout if you have permissions to commit source code changes.

1. Anonymous Checkout

cd ${HOME}/dev/cpp
svn co https://svn.qgis.org/repos/qgis/trunk/qgis qgis

2. Developer Checkout

cd ${HOME}/dev/cpp
svn co --username <yourusername> https://svn.qgis.org/repos/qgis/trunk/qgis qgis

The first time you check out the source you will be prompted to accept the qgis.org certificate. Press 'p' to accept it permanently:

Error validating server certificate for 'https://svn.qgis.org:443':
 - The certificate is not issued by a trusted authority. Use the
   fingerprint to validate the certificate manually!
Certificate information:
 - Hostname: svn.qgis.org
 - Valid: from Apr  1 00:30:47 2006 GMT until Mar 21 00:30:47 2008 GMT
 - Issuer: Developer Team, Quantum GIS, Anchorage, Alaska, US
 - Fingerprint: 2f:cd:f1:5a:c7:64:da:2b:d1:34:a5:20:c6:15:67:28:33:ea:7a:9b
(R)eject, accept (t)emporarily or accept (p)ermanently?

Starting the compile

I compile my development version of QGIS into my ~/apps directory to avoid conflicts with Ubuntu packages that may be under /usr. This way for example you can use the binary packages of QGIS on your system along side with your development version. I suggest you do something similar:

mkdir -p ${HOME}/apps

I have written a script to automate building on debian. Simply go into the qgis checkout dir and run the script to commence building:

cd ${HOME}/dev/cpp/qgis
./build.sh ${HOME}/apps debug

The second option above is the destination / install dir, and the xdebug tells the script to build QGIS with debug symbols and verbose debug output. At the end of the autogen / configure process called by the script above you should see output like below, indicating that QGIS is going to be built with all its bells & whistles...

==========================================
qgis 0.8.0
------------------------------------------
GDAL/OGR      : yes (Version 1.2.6)
GEOS          : yes (Version 2.1.4)
PostgreSQL    : yes (Version 8.1.4)
GRASS         : yes
SPIT          : yes
Georeferencer : yes
GPS/GPX       : yes
PROJ4         : yes
SQLITE3       : yes
Python        : yes

CPPFLAGS      :
CXXFLAGS      : -g -O2

Debug         : no
Plugin dir    : /home/timlinux/apps/lib/qgis

The binary will be installed in /home/timlinux/apps/bin

The build is using Qt in /usr
Linking with Qt using -lQtCore -lQt3Support -lQtGui -lQtNetwork -lQtSvg -lQtCore -lQt3Support -lQtGui -lQtNetwork -lQtXml -lQtSvg -lQtTest -lQtDesigner
------------------------------------------
Configure finished, type 'make' to build.

The script will carry on to build QGIS - it may take a little while to go and have a cup of your favourite beverage while you wait...

Running QGIS

Once the compile is complete it should pop up a page in firefox with unit test results. At the time of writing the unit tests are just stubs - we still need to create the test implementations - so dont worry to much about their output at the moment.

Now you can try to run QGIS:

$HOME/apps/bin/qgis

If all has worked properly the QGIS application should start up and appear on your screen.

Please visit http://qgis.org for information on joining our mailing lists and getting involved in the project further.


BuildingQuantumGisPoint8FromSource (last edited 2017-09-04 21:35:12 by ckimes)