Qgis is an open source desktop GIS tool written with QT framework. It is a good tool for learning GIS and QT. This article describes how to compile the source code of qgis In ubuntu.
Reference link:
Http://gvision.info/using-qtcreator-with-qgis/
Http://hub.qgis.org/projects/quantum-gis/repository/revisions/master/entry/INSTALL
Environment: Ubuntu 11.10
1. Dependent tool set:
-Cmake> = 2.6.2
-Flex
-Bison >=2.4
Ii. Dependent libraries:
-QT> = 4.4.0
-Proj> = 4.4.x
-Geos >=3.0
-Sqlite3> = 3.0.0
-Gdal/org> = 1.4.x
-Qwt >=5.0
Optional dependent libraries:
-For grass Plugin-grass> = 6.0.0 (Libraries compiled with exceptions support on Linux 32bit)
-For georeferencer-GSL> = 1.8
-For postgis support and spit Plugin-PostgreSQL> = 8.0.x
-For GPS Plugin-expat> = 1.95 and gpsbabel
-For mapserver export and pyqgis-Python> = 2.3 (2.5 + preferred)
-For Python support-Sip >=4.8, pyqt >=must match QT version
-For qgis mapserver-FastCGI
3. Compile the qgis dependency library in the Ubuntu "Universe" component. This component is disabled by default. To compile qgis, it must be activated:
1. Edit the/etc/APT/sources. list file.
2. Open all rows starting with "Deb"
3. Update the sources library and enter sudo apt-Get update in the command line.
4. Install the dependent libraries mentioned in the first part
Note: There are different release versions and the installation commands are also different. Select lucid, Maverick, Natty, oneiric, precise, Sid, squeeze, or wheezy as needed.
|| Distribution | install command for packages | | lucid | ``apt-get install bison cmake doxygen flex git-core graphviz grass-dev libexpat1-dev libfcgi-dev libgdal1-dev libgeos-dev libgsl0-dev libpq-dev libproj-dev libqt4-dev libqwt5-qt4-dev libspatialindex-dev libspatialite-dev libsqlite3-dev pkg-config pyqt4-dev-tools python python-dev python-qt4 python-qt4-dev python-sip python-sip-dev txt2tags xauth xfonts-base xvfb`` | | maverick | ``apt-get install bison cmake doxygen flex git graphviz grass-dev libexpat1-dev libfcgi-dev libgdal1-dev libgeos-dev libgsl0-dev libpq-dev libproj-dev libqt4-dev libqtwebkit-dev libqwt5-qt4-dev libspatialindex-dev libspatialite-dev libsqlite3-dev pkg-config pyqt4-dev-tools python python-dev python-qt4 python-qt4-dev python-sip python-sip-dev txt2tags xauth xfonts-base xvfb`` | | natty | ``apt-get install bison cmake doxygen flex git graphviz grass-dev libexpat1-dev libfcgi-dev libgdal1-dev libgeos-dev libgsl0-dev libpq-dev libproj-dev libqt4-dev libqtwebkit-dev libqwt5-qt4-dev libspatialindex-dev libspatialite-dev libsqlite3-dev pkg-config pyqt4-dev-tools python python-dev python-qt4 python-qt4-dev python-sip python-sip-dev txt2tags xauth xfonts-base xvfb`` | | oneiric | ``apt-get install bison cmake doxygen flex git graphviz grass-dev libexpat1-dev libfcgi-dev libgdal1-dev libgeos-dev libgsl0-dev libpq-dev libproj-dev libqt4-dev libqtwebkit-dev libqwt5-qt4-dev libspatialindex-dev libspatialite-dev libsqlite3-dev pkg-config pyqt4-dev-tools python python-dev python-qt4 python-qt4-dev python-sip python-sip-dev txt2tags xauth xfonts-base xvfb`` | | precise | ``apt-get install bison cmake doxygen flex git graphviz grass-dev libexpat1-dev libfcgi-dev libgdal1-dev libgeos-dev libgsl0-dev libopenscenegraph-dev libosgearth-dev libpq-dev libproj-dev libqt4-dev libqt4-opengl-dev libqtwebkit-dev libqwt5-qt4-dev libspatialindex-dev libspatialite-dev libsqlite3-dev pkg-config pyqt4-dev-tools python python-dev python-qt4 python-qt4-dev python-sip python-sip-dev txt2tags xauth xfonts-base xvfb`` | | sid | ``apt-get install bison cmake doxygen flex git graphviz grass-dev libexpat1-dev libfcgi-dev libgdal1-dev libgeos-dev libgsl0-dev libopenscenegraph-dev libosgearth-dev libpq-dev libproj-dev libqt4-dev libqt4-opengl-dev libqtwebkit-dev libqwt-dev libspatialindex-dev libspatialite-dev libsqlite3-dev pkg-config pyqt4-dev-tools python python-dev python-qt4 python-qt4-dev python-sip python-sip-dev txt2tags xauth xfonts-base xvfb`` | | squeeze | ``apt-get install bison cmake doxygen flex git graphviz grass-dev libexpat1-dev libfcgi-dev libgdal1-dev libgeos-dev libgsl0-dev libpq-dev libproj-dev libqt4-dev libqwt5-qt4-dev libspatialindex-dev libspatialite-dev libsqlite3-dev pkg-config pyqt4-dev-tools python python-dev python-qt4 python-qt4-dev python-sip python-sip-dev txt2tags xauth xfonts-base xvfb`` | | wheezy | ``apt-get install bison cmake doxygen flex git graphviz grass-dev libexpat1-dev libfcgi-dev libgdal1-dev libgeos-dev libgsl0-dev libopenscenegraph-dev libosgearth-dev libpq-dev libproj-dev libqt4-dev libqt4-opengl-dev libqtwebkit-dev libqwt-dev libspatialindex-dev libspatialite-dev libsqlite3-dev pkg-config pyqt4-dev-tools python python-dev python-qt4 python-qt4-dev python-sip python-sip-dev txt2tags xauth xfonts-base xvfb`` |
V. Git
Git is a version control tool similar to SVN. The source code of qgis is managed by git. you can install the GIT tool on Ubuntu Software Center or through command lines.
Create the dev/CPP folder under the Home folder and put the source code of qgis in this directory:
CD $ {home}/dev/CPP
git clone git://github.com/qgis/Quantum-GIS.git
We recommend that you download the source code directly from the official qgis website. We recommend that you download the stable version of the release. (In my experience, the master version may cause problems during compilation, the current version is 1.7.4 ). Because git checkout from SourceForge is an unstable version, the compilation process may be faulty.
6. Compile the source code (you can select two compiling methods. If you want to rewrite the source code of qgis, you can use the second qtcreator to compile the source code)
(1) command line compilation
1. Create a directory $ {home}/apps
mkdir -p ${HOME}/apps
2. Create a build directory and run ccmake
cd Quantum-GIS
mkdir build-master
cd build-master
ccmake ..
When running ccmake (.. is required), a configuration menu will appear, modify cmake_install_prefix to $ {home}/apps. start configuration by C. Sometimes G occurs only after several times of C, so that you can generate make file.
3、build
Command line Input
make
make install
4. Run
$ Home/apps/bin/qgis
If the compilation is successful, qgis runs successfully.
(2) qtcreator Compilation
1. decompress the source code again (do not use the set of code compiled in the first method)
2. Open qtcreator
File-> open file or project
Find the root directory of the source code, which should contain cmakelists.txt. Open. The Directory of build is displayed.
Press next to set the cmake parameter-dcmake_build_type = debug
Click RUN cmake to automatically generate the corresponding makefiles. Then click Finish.
3. Set the Build Environment
Click projects> build Settings> Add build step> Custom process step. The settings are as follows:
By default, qgis is installed in/usr/local. In this case, you need to set the permission to read and write the directory.
4. Set the runtime environment and run settings (next to build settings ).
Overwrite the default executable file, click Add, and select Custom executable,
Executable: /usr/local/bin/qgisArguments :Working directory: $HOMERun in terminal: [no]Debugger: C++ [yes] Qml [no]
Click Rename to set the executable file name to installed qgis or another name you like.
The settings are as follows:
5. Run and Debug. After you set the breakpoint, click Start debugging to enter the debugging mode.