ubuntu16.04 qgis3.1.0 compilation

参考 https://stackoverflow.com/questions/26305097/setup-gdb-with-qtcreator

https://blog.csdn.net/lovefqing/article/details/7568533

https://blog.csdn.net/u014124220/article/details/51901638

1. Preliminary preparation

It is recommended that beginners use the root user throughout! ! !

1. Edit the software source file /etc/apt/sources.list

Annotate all lines beginning with "deb", so that all software can be downloaded

2. In order to solve the problem of low gdal version, you need to add ubtuntugis support, enter the following command in the terminal

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ubuntugis/ppa

Update source

sudo apt-get update

3. Installation environment:

Enter the command directly in the terminal

apt-get install bison ca-certificates ccache cmake cmake-curses-gui dh-python doxygen expect flex gdal-bin git graphviz grass-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libpq-dev libproj-dev libqca-qt5-2-dev libqca-qt5-2-plugins libqt5opengl5-dev libqt5scintilla2-dev libqt5sql5-sqlite libqt5svg5-dev libqt5webkit5-dev libqt5xmlpatterns5-dev libqwt-qt5-dev libspatialindex-dev libspatialite-dev libsqlite3-dev libsqlite3-mod-spatialite libzip-dev lighttpd locales ninja-build pkg-config poppler-utils pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python3-all-dev python3-dateutil python3-dev python3-future python3-gdal python3-httplib2 python3-jinja2 python3-markupsafe python3-mock python3-nose2 python3-owslib python3-plotly python3-psycopg2 python3-pygments python3-pyproj python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-requests python3-sip python3-sip-dev python3-six python3-termcolor python3-tz python3-yaml qt5-default qt5keychain-dev qtbase5-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools spawn-fcgi txt2tags xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb

4.设置ccache加快编译时间:

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

5.创建存放qgis路径并进入该目录:

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

二、编译过程

1.将qgis3.1.0版本移动到${HOME}/dev/cpp目录下,开始编译配置:

cd QGIS
mkdir build-master
cd build-master
ccmake ..

After entering the cmake interface, CMAKE_BUILD_TYPE is set to Debug, press c for configuration check, press g to generate code

2.make to compile

make -jX

At this time, there may be an error that "setObsolete" cannot be found. This is because this method does not appear until after qt5.9, and the version of qt installed at the beginning is 5.5, so this method is not supported. Enter QGIS/src/core/qgsvectorlayer.cpp to comment this sentence.

3. pyuic-wrapper.sh: Permission denied  error

If the root user is not used, an error will be prompted when the compilation is completed. The error message is as follows

[ 94%] Generating ui_widgetMerge.py 
/bin/sh: 1: ../../../../../scripts/pyuic-wrapper.sh: Permission denied 
make[2]: * [python/plugins/GdalTools/tools/ui_widgetMerge.py] Error 126

Solution: 
modify the file permissions to 777

chmod 777 pyuic-wrapper.sh

Three, run

1. The operation can be carried out by the following methods:

1) Run directly in the current directory

./output/bin/qgis

2) make install and run

make install
qgis

四、qtcreator编译

1.安装qtcreator

2.在qtcreator中打开qgis项目的CMakeLists.txt

3.进行configure和build即可


Guess you like

Origin blog.csdn.net/lebusini/article/details/80246773