• QGIS的编译 (Windows)


    一、资源

    https://github.com/qgis/QGIS

    https://github.com/qgis/QGIS/blob/master/INSTALL.md

    二、编译需求

    Following a summary of the required dependencies for building:

    Required build tools:

    * CMake >= 3.10.0

    * Flex >= 2.5.6

    * Bison >= 2.4

    * Python >= 3.7

    Required build dependencies:

    * Qt >= 5.12.0

    * Proj >= 4.9.3

    * GEOS >= 3.4

    * Sqlite3 >= 3.0.0

    * SpatiaLite >= 4.2.0

    * libspatialindex

    * GDAL/OGR >= 2.1

    * Qwt >= 5.0 & (< 6.1 with internal QwtPolar)

    * expat >= 1.95

    * QScintilla2

    * QCA

    * qtkeychain (>= 0.5)

    * libzip

    Optional dependencies:

    * for GRASS providers and plugin - GRASS >= 7.0.0.

    * for georeferencer - GSL >= 1.8

    * for PostGIS support - PostgreSQL >= 8.0.x

    * for gps plugin - gpsbabel

    * for mapserver export and PyQGIS - Python >= 3.6

    * for python support - SIP >= 4.12, PyQt >= 5.3 must match Qt version, Qscintilla2

    * for qgis mapserver - FastCGI

    * for oracle provider - Oracle OCI library

    Indirect dependencies:

    Some proprietary formats (e.g., ECW and MrSid) supported by GDAL require proprietary third party libraries. QGIS doesn't need any of those itself to build, but will only support those formats if GDAL is built accordingly. Refer to http://gdal.org/formats_list.html ff. for instructions how to include those formats in GDAL.

    三、Building on Windows using vs

    3.1 Other tools and dependencies

    Download and install following packages:

    Tool

    Website

    CMake

    https://cmake.org/download/

    GNU flex, GNU bison and GIT

    在 windows 系统上提供的类 unix 环境,用于下载所需要的包。

    http://cygwin.com/setup-x86.exe (32bit) or 

    http://cygwin.com/setup-x86_64.exe (64bit)

    OSGeo4W

    用于 windows 系统里一系列的开源 gis 的发布。

    http://download.osgeo.org/osgeo4w/osgeo4w-setup-x86_64.exe  (推荐)

    https://qgis.org/en/site/forusers/download.html

    OSGeo4W介绍

    ninja

    https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-win.zip

    For the QGIS build you need to install following packages from cygwin:

    • bison
    • flex
    • git

    and from OSGeo4W (select Advanced Installation):

    • qgis-dev-deps

    This will also select packages the above packages depend on.

    If you install other packages, this might cause issues. Particularly, make sure not to install the msinttypes package. It installs a stdint.h file in OSGeo4W[64]include, that conflicts with Visual Studio own stdint.h, which for example breaks the build of the virtual layer provider.

    Earlier versions of this document also covered how to build all above dependencies. If you're interested in that, check the history of this page in the Wiki or the SVN repository.

    ninja: copy ninja.exe to d:OSGeo4W64in

    补充说明:

    1. cygwin的安装

    一步步安装,直至选择包的界面,分别搜索需以上的包,若未安装,会显示 skip,点击切换版本即可。下图为已安装,显示为 keep。

     

    搜索了:flex,  bison, ninja,。

    2. OSGeo4W安装 (例如,若自己电脑上有QGIS 3.12安装版本,可省去这部分)

    选择 Advanced Install,否则安装路径假设默认为 C:OSGeo4W64。

    之后一步步安装,直至选择包界面。
    后面的步骤省去,和cygwin类似。

    到选择包界面时,输入 qgis-dev-deps,同样,若未安装,会显示为 skip,点击切换版本即可。

    备注:

    qgis-dev-deps要安装的内容如下。

    avce00    (2.0.0-1)

    The AVCE00 commandline utilities for Arc/Info E00 conversion

    Required by: grass

    boost-libs    (1.56.0-2)

    The Boost library (runtime libraries).

    Required by: libkml

    cairo    (1.12.14-1)

    Cairo library

    Required by: grass

    curl    (7.67.0-1)

    The CURL HTTP/FTP library and commandline utility.

    Required by: gdal-dev, proj-dev, netcdf, gdal, gdal111dll

    curl-ca-bundle    (20191119-1)

    CURL CA certificates

    Required by: curl

    exiv2    (0.26-1)

    Image metadata library

    Required by: exiv2-devel

    exiv2-devel    (0.26-1)

    Image metadata library (development)

    Required by: qgis-dev-deps

    expat    (2.1.0-1)

    The Expat XML Parser library

    Required by: qgis-dev-deps, gdal-dev, ogdi, gpsbabel, gdal, exiv2, gdal111dll, libkml

    fcgi    (2.4.1-2)

    FastCGI Library

    Required by: qgis-dev-deps

    fftw    (3.3.3-1)

    Fast Fourier transformation library (Development)

    Required by: grass

    freexl    (1.0.2-1)

    The FreeXL library for accessing Excel (.xls) spreadsheet.

    Required by: gdal-dev, spatialite, gdal, gdal111dll

    gdal    (3.0.4-2)

    The GDAL/OGR library and commandline tools

    Required by: grass, gpsbabel, python3-gdal

    gdal-dev    (3.1.0-273)

    The GDAL/OGR library and commandline tools (nightly master)

    Required by: qgis-dev-deps

    gdal111dll    (1.11.3-1)

    The GDAL/OGR 1.11 DLL (backward compability package)

    Required by: liblas

    geos    (3.8.1-1)

    The GEOS geometry library

    Required by: gdal-dev, spatialite, gdal, liblwgeom, gdal111dll

    gpsbabel    (1.4.4-2)

    GPS file conversion plus transfer to/from GPS units

    Required by: grass

    grass    (7.8.2-2)

    GRASS GIS

    Required by: qgis-dev-deps

    gs    (9.07-1)

    Ghostscript

    Required by: grass

    gsl-devel    (1.15-1)

    GNU Scientific Library (GSL; Development)

    Required by: qgis-dev-deps

    gsl-libs    (1.15-1)

    GNU Scientific Library (GSL)

    Required by: gsl-devel

    hdf4    (4.2.14-1)

    The HDF4 library for reading and writing HDF4 format

    Required by: gdal-dev, gdal, gdal111dll

    hdf5    (1.10.4-1)

    The HDF5 library for reading and writing HDF5 format

    Required by: netcdf, gdal111dll

    iconv    (1.14-1)

    Codepage translation Library

    Required by: qgis-dev-deps, grass, spatialite, freexl, cairo, gdal111dll

    iconv-vc14    (1.15-1)

    Codepage translation Library

    Required by: gdal-dev, gdal

    icu-libs    (56.1-3)

    ICU (library)

    Required by: qtwebkit-qt5-libs

    laszip2    (2.2.0-3)

    The LASzip compression library (version 2)

    Required by: liblas

    libgeotiff    (1.4.2-1)

    The Libgeotiff library, commandline tools and supporting tables.

    Required by: liblas, gdal111dll

    libjpeg    (6b-4)

    A library for manipulating JPEG image format files

    Required by: gdal-dev, libtiff, gdal111dll

    libjpeg12    (6b-4)

    A library for manipulating 12bit JPEG image format files

    Required by: libtiff

    libkml    (1.3.0-1)

    LibKML

    Required by: gdal

    liblas    (1.8.0-1)

    The libLAS commandline utilities

    Required by: grass

    liblwgeom    (3.0.0-2)

    liblwgeom

    Required by: spatialite

    libmysql    (6.1.9-1)

    MySQL Client Library.

    Required by: gdal-dev, gdal, gdal111dll

    libpng    (1.6.3-1)

    the official PNG reference library

    Required by: gdal-dev, grass, gdal

    libpng-vc14    (1.6.29-1)

    the official PNG reference library

    Required by: openjpeg

    libpq    (11.5-1)

    The libpq library for accessing PostgreSQL + psql commandline client

    Required by: gdal-dev, gdal, gdal111dll

    libspatialindex    (1.9.0-1)

    The libspatialindex library

    Required by: qgis-dev-deps

    libtiff    (4.0.8-1)

    A library for manipulating TIFF format image files (runtime)

    Required by: grass, proj-dev, openjpeg, liblas, libgeotiff, gdal111dll

    libxml2    (2.9.1-1)

    An XML read/write library

    Required by: spatialite, cairo

    libzip-devel    (1.2.0-2)

    libzip (development)

    Required by: qgis-dev-deps

    libzip-libs    (1.2.0-2)

    libzip (runtime library)

    Required by: libzip-devel

    msvc2015    (1.0.0-1)

    msvc2015

    Required by: spatialite, icu-libs

    msvcrt    (1.0.3-1)

    Microsoft Visual C/C++ Runtimes

    Required by: grass, oci-devel, shell, openjpeg, msvcrt2015, oci, opencl, setup, libkml

    msvcrt2008    (1.0.0-1)

    Microsoft Visual C/C++ 2008 Runtimes

    Required by: msvcrt

    msvcrt2010    (1.0.0-2)

    Microsoft Visual C/C++ 2010 Runtimes

    Required by: msvcrt, xerces-c-vc10

    msvcrt2012    (1.0.0-2)

    Microsoft Visual C/C++ 2012 Runtimes.

    Required by: boost-libs

    msvcrt2013    (1.0.0-2)

    Microsoft Visual C/C++ 2013 Runtimes

    Required by: grass, liblas

    msvcrt2015    (1.0-2)

    Microsoft Visual C/C++ 2015 Runtimes

    Required by: grass, libspatialindex, proj-dev, curl, geos, libmysql, sqlite3, libpq, xerces-c, hdf4, ogdi, iconv-vc14, zstd, libtiff, gdal, proj, libzip-libs, python3-core, qt5-libs, liblwgeom, msvc2015, exiv2, protobuf, openssl, hdf5, szip, laszip2, xz

    netcdf    (4.7.3-1)

    The NetCDF library and commands for reading and writing NetCDF format

    Required by: gdal-dev, gdal, gdal111dll

    oci    (12.1.0.1.0-1)

    Oracle Instant Client

    Required by: oci-devel

    oci-devel    (12.1.0.1.0-1)

    Oracle Instant Client (Development)

    Required by: qgis-dev-deps

    ogdi    (4.1.0-1)

    OGDI data access library (mainly for VPF reading)

    Required by: gdal-dev, gdal, gdal111dll

    opencl    (2.0.10-5)

    KhronosGroup OpenCL runtime

    Required by: opencl-devel

    opencl-devel    (2.0.10-4)

    KhronosGroup OpenCL development files

    Required by: qgis-dev-deps

    openjpeg    (2.3.0-1)

    OpenJPEG

    Required by: gdal-dev, gdal, gdal111dll

    openssl    (1.1.1d-2)

    OpenSSL Cryptography (Runtime)

    Required by: curl, libpq, python3-core, qt5-libs

    openssl10    (1.0.2j-1)

    OpenSSL 1.0 Cryptography (Old Runtime)

    Required by: libzip-libs, openssl

    pdcurses    (3.4-2)

    PDCurses (MinGW built)

    Required by: grass

    proj    (6.3.1-1)

    The PROJ library and commands for coordinate system transformations.

    Required by: grass, spatialite, liblas, gdal, liblwgeom, gdal111dll

    proj-datumgrid    (1.8-1)

    Assorted PROJ datum grid shift files

    Required by: proj-dev, liblas, proj

    proj-dev    (7.1.0-37)

    The PROJ library and commands for coordinate system transformations (nightly master).

    Required by: gdal-dev

    proj-dev-data    (1.1-4)

    The PROJ data (nightly master).

    Required by: proj-dev

    proj-hpgn    (1.0-1)

    PROJ.4 HPGN (HARN) grid shift files

    Required by: proj-dev, liblas, proj

    protobuf    (3.11.4-2)

    Protocol Buffers - Google's data interchange format

    Required by: protobuf-devel

    protobuf-devel    (3.11.4-2)

    Protocol Buffers - Google's data interchange format (development)

    Required by: qgis-dev-deps

    pyqt5    (5.11.3-2)

    Python bindings for Qt5.

    Required by: qgis-dev-deps, python3-qscintilla

    python3-core    (3.7.0-4)

    Python3 core interpreter and runtime

    Required by: pyqt5, python3-devel, python3-qscintilla, python3-nose2, python3-future, python3-pyyaml, python3-mock, python3-six, sip-qt5, python3-gdal, python3-matplotlib, python3-wx, python3-numpy, python3-pillow, python3-pip, python3-ply, python3-pyopengl, python3-pywin32, python3-coverage, python3-pbr, python3-pyparsing, python3-cycler, python3-kiwisolver, python3-python-dateutil, python3-psycopg2-binary, python3-setuptools

    python3-coverage    (4.5.1-1)

    Code coverage measurement for Python

    Required by: python3-nose2

    python3-cycler    (0.10.0-2)

    Composable style cycles

    Required by: python3-matplotlib

    python3-devel    (3.7.0-1)

    Python3 library and header files

    Required by: qgis-dev-deps

    python3-future    (0.16.0-2)

    Clean single-source support for Python 3 and 2

    Required by: qgis-dev-deps

    python3-gdal    (3.0.4-2)

    The GDAL/OGR Python3 Bindings and Scripts

    Required by: grass

    python3-kiwisolver    (1.1.0-1)

    A fast implementation of the Cassowary constraint solver

    Required by: python3-matplotlib

    python3-matplotlib    (3.1.3-1)

    Python plotting package

    Required by: grass

    python3-mock    (2.0.0-2)

    Rolling backport of unittest.mock for all Pythons

    Required by: qgis-dev-deps

    python3-nose2    (0.8.0-1)

    nose2 is the next generation of nicer testing for Python

    Required by: qgis-dev-deps

    python3-numpy    (1.18.1-1)

    NumPy is the fundamental package for array computing with Python.

    Required by: grass, python3-gdal, python3-matplotlib

    python3-pbr    (4.3.0-1)

    Python Build Reasonableness

    Required by: python3-mock

    python3-pillow    (5.3.0-1)

    Python Imaging Library (Fork)

    Required by: grass

    python3-pip    (20.0.2-1)

    The PyPA recommended tool for installing Python packages.

    Required by: grass

    python3-ply    (3.11-2)

    Python Lex & Yacc

    Required by: grass

    python3-psycopg2    (2.8.4-1)

    psycopg2 - Python-PostgreSQL Database Adapter (transitional)

    Required by: grass

    python3-psycopg2-binary    (2.8.4-1)

    psycopg2 - Python-PostgreSQL Database Adapter

    Required by: python3-psycopg2

    python3-pyopengl    (3.1.0-1)

    Standard OpenGL bindings for Python

    Required by: grass

    python3-pyparsing    (2.4.6-1)

    Python parsing module

    Required by: python3-matplotlib

    python3-python-dateutil    (2.8.1-1)

    Extensions to the standard Python datetime module

    Required by: python3-matplotlib

    python3-pywin32    (224-1)

    Python for Window Extensions

    Required by: grass

    python3-pyyaml    (5.3-1)

    YAML parser and emitter for Python

    Required by: qgis-dev-deps

    python3-qscintilla    (2.10.8-1)

    Python3 bindings for Qt5 QScintilla

    Required by: qgis-dev-deps

    python3-setuptools    (45.2.0-1)

    Easily download, build, install, upgrade, and uninstall Python packages

    Required by: python3-kiwisolver

    python3-six    (1.14.0-1)

    Python 2 and 3 compatibility utilities

    Required by: qgis-dev-deps, grass, python3-nose2, python3-mock, python3-wx, python3-cycler, python3-python-dateutil

    python3-wx    (4.0.7-1)

    wxPython - Python3 bindings for wxWidgets

    Required by: grass

    qca-qt5-devel    (2.1.3-1)

    Qt5 Cryptographic Architecture headers and libraries (Development)

    Required by: qgis-dev-deps

    qca-qt5-libs    (2.1.3-1)

    Qt5 Cryptographic Architecture runtime libraries

    Required by: qgis-dev-deps

    qscintilla-qt5    (2.10.8-1)

    Qt5 source code editing component.

    Required by: qgis-dev-deps, python3-qscintilla

    qt5-devel    (5.11.2-1)

    Qt5 headers and libraries (Development)

    Required by: qgis-dev-deps, qca-qt5-devel, qtkeychain-qt5-devel

    qt5-libs    (5.11.2-1)

    Qt5 runtime libraries

    Required by: pyqt5, qca-qt5-devel, qca-qt5-libs, qscintilla-qt5, qt5-devel, qtkeychain-qt5-devel, qtwebkit-qt5-libs, qtwebengine-qt5-libs, qwt-libs-qt5, qtkeychain-qt5-libs

    qt5-libs-debug    (5.11.2-1)

    Qt5 runtime libraries (debug version)

    Required by: qgis-dev-deps

    qtkeychain-qt5-devel    (0.9-1)

    Platform-independent Qt API for storing passwords securely. (Development)

    Required by: qgis-dev-deps

    qtkeychain-qt5-libs    (0.9-1)

    Platform-independent Qt API for storing passwords securely.

    Required by: qtkeychain-qt5-devel

    qtwebengine-qt5-libs    (5.10.1-1)

    WebEngine for Qt5

    Required by: pyqt5

    qtwebkit-qt5-devel    (5.212-1)

    WebKit for Qt5 (development)

    Required by: qgis-dev-deps

    qtwebkit-qt5-libs    (5.212-1)

    WebKit for Qt5

    Required by: pyqt5, qtwebkit-qt5-devel, qtwebkit-qt5-libs-debug

    qtwebkit-qt5-libs-debug    (5.9.1-1)

    WekKit for Qt5 (debug libraries)

    Required by: qgis-dev-deps

    qwt-devel-qt5    (6.1.3-5)

    Qt5 widgets library for technical applications (Development)

    Required by: qgis-dev-deps

    qwt-libs-qt5    (6.1.3-5)

    Qt5 widgets library for technical applications (runtime)

    Required by: qwt-devel-qt5

    rbatch    (149-4)

    Windows batchfiles for use with R

    Required by: grass

    setup    (1.0.7-16)

    OSGeo4W Installer/Updater

    Required by: shell

    shell    (1.0.2-4)

    OSGeo4W Command Shell

    Required by: expat, fcgi, gdal-dev, gsl-devel, iconv, python3-qscintilla, qca-qt5-devel, qscintilla-qt5, qt5-libs-debug, qwt-devel-qt5, qtkeychain-qt5-devel, libpng, libjpeg, liblas, avce00, gpsbabel, pdcurses, zlib, fftw, cairo, gsl-libs, qwt-libs-qt5, libxml2, setup, libpng-vc14, libgeotiff, gdal111dll, laszip2, libjpeg12

    sip-qt5    (4.19.14-1)

    Python3/C++ bindings generator (Development)

    Required by: qgis-dev-deps, pyqt5

    spatialite    (4.3.0a-6)

    The SpatiaLite library for adding spatial capabilities to SQLite3 DBMS.

    Required by: qgis-dev-deps, gdal-dev, gdal, gdal111dll

    sqlite3    (3.29.0-1)

    The SQLite3 library for accessing SQLite3 database files.

    Required by: gdal-dev, spatialite, proj-dev, gdal, python3-core, qt5-libs, gdal111dll

    szip    (2.1.1-1)

    SZIP compression library

    Required by: hdf4, hdf5

    xerces-c    (3.2.0-1)

    The Xerces-C 3 library for parsing XML files (runtime)

    Required by: gdal-dev, gdal

    xerces-c-vc10    (3.1.1-1)

    The Xerces-C 3 library for parsing XML files

    Required by: gdal111dll

    xz    (5.2.3-1)

    XZ-format compression library

    Required by: libtiff, gdal

    zlib    (1.2.8-1)

    The zlib compression and decompression library (runtime)

    Required by: grass, qt5-libs-debug, ogdi, openjpeg, gpsbabel, libtiff, cairo, qt5-libs, exiv2, protobuf, libkml

    zstd    (1.3.2-1)

    Zstandard Long Range Match Finder (runtime)

    Required by: gdal-dev, grass, gdal, zstd-bin

    zstd-bin    (1.3.2-1)

    Zstandard Long Range Match Finder (binary)

    Required by: grass

    上面这一步是输入qgis-dev-deps ,其他的都不要,如果以前安装过QGIS最好要换一个安装目录,因为msinttypes中的头文件可能与VS2015中的文件件冲突,官方原话是这样的

    接下来把git上下载的QGIS源码(建议用移动网络手机WiFi热点下载,实测电信30kiB/s, 移动 4G通用流量 500kiB/s,5G套餐流量,使用4G手机,最快达到5.05 MiB/s)。

     

    可以看出,在2020.4.27的时候,qgis的源码已经达到了 1.64GB,下载时,一定要找一个网络比较稳定的时候。否则直接git clone将非常耗时。我之所以使用git clone, 是为了日后直接关联到 github远程仓库,同步远程仓库的

    将源码文件夹解压出来,我是把文件都放在“OSGeo4W”安装的父目录下,当然这个是可以自定义的。例如,放到一个编译qgis源码的父目录下 E:Projsalgsqgis。

    把ninj解压出来的EXE文件放入XXXOSGeo4W64in目录中。

    3.2 Setting up the Visual Studio project with Cmake

    环境设置

    以下保存为批处理文件 XXXqgis-dev.bat,其中具体的路径,替换成自己机子环境对应的路径,

    其中的路径包括 vs 、window sdk、OSGeo、cygwin64等。

    @echo off
    set VS140COMNTOOLS = D:GoProgramMicrosoft Visual Studio 14.0
    call "D:GoProgramMicrosoft Visual Studio 14.0VCvcvarsall.bat" x64
    set INCLUDE=%INCLUDE%;C:Program Files (x86)Microsoft SDKsWindowsv7.1AInclude
    set LIB=%LIB%;C:Program Files (x86)Microsoft SDKsWindowsv7.1ALib
    set OSGEO4W_ROOT=C:OSGeo4W64
    call "%OSGEO4W_ROOT%ino4w_env.bat"
    call "%OSGEO4W_ROOT%inpy3_env.bat"
    call "%OSGEO4W_ROOT%inqt5_env.bat"
    set O4W_ROOT=%OSGEO4W_ROOT:=/%
    set LIB_DIR=%O4W_ROOT%
    path %path%;D:GoProgramMicrosoft Visual Studio 14.0VCin
    path %PATH%;D:GoProgramCMakein;E:ProgramFilescygwin64in
    @set GRASS_PREFIX=C:OSGeo4W64apps/grass/grass-7.6.0
    @set INCLUDE=%INCLUDE%;%OSGEO4W_ROOT%include
    @set LIB=%LIB%;%OSGEO4W_ROOT%lib;%OSGEO4W_ROOT%lib
    set LIB=%LIB%;%OSGEO4W_ROOT%appsQt5lib;%OSGEO4W_ROOT%lib
    set INCLUDE=%INCLUDE%;%OSGEO4W_ROOT%appsQt5include;%OSGEO4W_ROOT%include
    @cmd

    备注:

    1)如果是vs2017, 上面两行蓝色的内容,并不好填写,可以省去。在cmake的时候,可以自动弹出窗口,选择设置。

    2)以上表格中的内容的路径,以D:/Pros/Office/QGIS_Dev/OSGeo4W/apps/Python37/形式填写,否则cmake得到的vs工程里,安装将会遇到"/p"的问题。

    New my file

    @echo off
    call "C:ProgramDevMicrosoft Visual Studio2017EnterpriseVCAuxiliaryBuildvcvarsall.bat" x64
    set INCLUDE=%INCLUDE%;C:Windows Kits10LibInclude
    set LIB=%LIB%;C:Windows Kits10Lib
    set OSGEO4W_ROOT=D:ProsOfficeQGIS_DevOSGeo4W
    call "%OSGEO4W_ROOT%ino4w_env.bat"
    call "%OSGEO4W_ROOT%inpy3_env.bat"
    call "%OSGEO4W_ROOT%inqt5_env.bat"
    set O4W_ROOT=%OSGEO4W_ROOT:=/%
    set LIB_DIR=%O4W_ROOT%
    path %PATH%;D:ProsIDEIDE Toolscmake-3.17.1-win64-x64in;D:ProsIDEIDE Toolscygwin64in
    @set GRASS_PREFIX=D:ProsOfficeQGIS_DevOSGeo4Wappsgrassgrass78
    @set INCLUDE=%INCLUDE%;%OSGEO4W_ROOT%include
    @set LIB=%LIB%;%OSGEO4W_ROOT%lib;%OSGEO4W_ROOT%lib
    set LIB=%LIB%;%OSGEO4W_ROOT%appsQt5lib;%OSGEO4W_ROOT%lib
    set INCLUDE=%INCLUDE%;%OSGEO4W_ROOT%appsQt5include;%OSGEO4W_ROOT%include
    @cmd

     

    在D:QGIS目录下按住shift键不放,右击鼠标选择 “在此处打开power shell 窗口(s)” ,输入下面命令进入cmake窗口。

     

    cmake

    双击以上保存的 qgis-dev.bat,输入 cmake-gui,会弹出 cmake 的配置界面,写好 qgis 源码目录及build 目录。

    build目录,要放到下载的qgis的源码根目录下

    点击Configure后可能会出现一些错误,找到相应的路径添加上去就行了,下面是我的路径。

    对上述cmake界面中的内容进行修改:

    Enable test

    Install please

    Configure后,出现如下内容。

    Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.18363.

    QGIS version: 3.13.0 Master (31300)

    Found OpenCL C++ headers: D:/Pros/Office/QGIS_Dev/OSGeo4W/include

    Could not find GRASS 7

    Found Proj: D:/Pros/Office/QGIS_Dev/OSGeo4W/lib/proj_i.lib version 6 (6.3.1)

    Found GEOS: D:/Pros/Office/QGIS_Dev/OSGeo4W/lib/geos_c.lib (3.8.1)

    Found GDAL: D:/Pros/Office/QGIS_Dev/OSGeo4W/lib/gdal_i.lib (3.0.4)

    Found Expat: D:/Pros/Office/QGIS_Dev/OSGeo4W/lib/expat.lib

    Found Spatialindex: D:/Pros/Office/QGIS_Dev/OSGeo4W/lib/spatialindex-64.lib

    Found Qwt: D:/Pros/Office/QGIS_Dev/OSGeo4W/apps/Qt5/lib/qwt.lib (6.1.3)

    Found libzip: D:/Pros/Office/QGIS_Dev/OSGeo4W/lib/zip.lib

    Found Sqlite3: D:/Pros/Office/QGIS_Dev/OSGeo4W/lib/sqlite3_i.lib

    Found Protobuf: D:/Pros/Office/QGIS_Dev/OSGeo4W/lib/libprotobuf.lib

    Found zlib: D:/Pros/Office/QGIS_Dev/OSGeo4W/lib/zlib.lib

    Found PostgreSQL: D:/Pros/Office/QGIS_Dev/OSGeo4W/lib/libpq.lib

    Found SpatiaLite: D:/Pros/Office/QGIS_Dev/OSGeo4W/lib/spatialite_i.lib

    Qt WebKit support enabled

    Found Qt version: 5.11.2

    Found QScintilla2: D:/Pros/Office/QGIS_Dev/OSGeo4W/apps/Qt5/lib/qscintilla2_qt5.lib (2.10.8)

    Found QtKeychain: D:/Pros/Office/QGIS_Dev/OSGeo4W/apps/Qt5/lib/qt5keychain.lib

    Found QCA: D:/Pros/Office/QGIS_Dev/OSGeo4W/apps/Qt5/lib/qca-qt5.lib (2.1.3)

    Pedantic compiler settings enabled

    Found Python executable: D:/Pros/Office/QGIS_Dev/OSGeo4W/bin/python3.exe

    Found Python version: 3.7.0

    Found Python library: D:/Pros/Office/QGIS_Dev/OSGeo4W/apps/Python37/libs/python37.lib

    Found Python site-packages: D:/Pros/Office/QGIS_Dev/OSGeo4W/apps/Python37/Lib/site-packages

    Found PyQt5 version: 5.11.3

    Found SIP version: 4.19.14

    Found QScintilla2 PyQt module: 2.10.8

    txt2tags not found - disabled

    Found exiv2: D:/Pros/Office/QGIS_Dev/OSGeo4W/lib/exiv2.lib

    Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)

    Found GSL: D:/Pros/Office/QGIS_Dev/OSGeo4W/lib/gsl.lib;D:/Pros/Office/QGIS_Dev/OSGeo4W/lib/cblas.lib

    Using PROJ 6 srs database.

    Ctest Binary Directory set to: E:/Projs/algs/qgis/qgis_source/build/output/bin

    Configuring done

    点击Open Project后会打开VS2015,打开后出现的工程项目比较多,如果只要基本功能的话,可以只保留下面几项,如果后期需要再加上。

    右键qgis工程,选择”设为启动项目“,然后右键ALL_BULID“生成”。
    在编译过程中会出现一些错误与警告,可以参考这个百度文库尾部。

    打开后,项目非常多,无论是编译、还是浏览,都非常慢。我们只需核心的几个库,其它的都移除。先把主程序运行起来,其它的插件若有需要再添加。

    • qgis:QGIS可执行程序
    • qgis_native:依赖项
    • libdxfrw:依赖项
    • qgis_app:
    • qgis_analysis:依赖项
    • qgis_core:依赖项,QGIS核心库
    • qgis_gui:依赖项,QGIS核心库
    • ui:QGIS所有的界面
    • gdalprovider:读取栅格数据驱动
    • ogrprovider:读取矢量数据驱动
    • version:版本

    由于源代码为 utf-8 编码,本机 locale 为中文,编译时可能出现 ”Newline in constant“ 的错误,需显示告诉编译器源码为 utf-8 :

    右键-Properties-- c/c++,Command Line,Addtional Options 里添加:

    /source-charset:utf-8

    编译选项选择“RelWithDebInfo”,进行编译。由于源码比较多,先编译 core、native。总体耗时比较久,可能30分钟以上。

    生成“后运行就会出现下面结果。

    备注:

    为了在vs工程中,将工程分门别类的合并到文件夹内,可以如下设置:

    cmakeCMakeHelper.cmake

    cmakeCMakeHelper_end.cmake

    # for folders in vs studio .sln projects.

    # added by weng. 20.4.27

    # Enable solution folders.

    set_property(GLOBAL PROPERTY USE_FOLDERS ON)

    set(CMAKE_TARGETS_ROOT_FOLDER "_build")

    set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER ${CMAKE_TARGETS_ROOT_FOLDER})

    set(QGIS_CORE_ROOT_FOLDER "_core")

    set(QGIS_QGIS_LIBS_ROOT_FOLDER "_qgis")

    set(QGIS_QGIS_TEST_ROOT_FOLDER "_qgis_test")

    set(QGIS_ABOUT_ROOT_FOLDER "about")

    set(QGIS_ZZZ_ROOT_FOLDER "zzz")

    set(QGIS_SERVER_ROOT_FOLDER "server")

    # Wrapper for test executables.

    # macro(QGIS_ADD_TEST TARGET_NAME)

    #    if(TESTS_ENABLED)

    #        # ${ARGN} will store the list of source files passed to this function.

    #        add_executable(${TARGET_NAME} ${ARGN})

    #        set_target_properties(${TARGET_NAME} PROPERTIES FOLDER ${QGIS_QGIS_TEST_ROOT_FOLDER}/${FOLDER_NAME})

    #        target_link_libraries(${TARGET_NAME} colmap ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})

    #        add_test("${FOLDER_NAME}/${TARGET_NAME}" ${TARGET_NAME})

    #        if(IS_MSVC)

    #            install(TARGETS ${TARGET_NAME} DESTINATION bin/)

    #        endif()

    #    endif()

    #endmacro(QGIS_ADD_TEST)

    #

    # weng for qgis test folders. 20.4.27

    # set_target_properties(clean-staged-${plugin} PROPERTIES FOLDER ${QGIS_ZZZ_ROOT_FOLDER}/)

    set_target_properties(libdxfrw PROPERTIES FOLDER ${QGIS_CORE_ROOT_FOLDER}/)

    set_target_properties(mdalprovider PROPERTIES FOLDER ${QGIS_CORE_ROOT_FOLDER}/)

    set_target_properties(owsprovider PROPERTIES FOLDER ${QGIS_CORE_ROOT_FOLDER}/)

    set_target_properties(postgresprovider PROPERTIES FOLDER ${QGIS_CORE_ROOT_FOLDER}/)

    set_target_properties(qgis PROPERTIES FOLDER ${QGIS_CORE_ROOT_FOLDER}/)

    set_target_properties(qgis_3d PROPERTIES FOLDER ${QGIS_CORE_ROOT_FOLDER}/)

    set_target_properties(qgis_analysis PROPERTIES FOLDER ${QGIS_CORE_ROOT_FOLDER}/)

    set_target_properties(qgis_app PROPERTIES FOLDER ${QGIS_CORE_ROOT_FOLDER}/)

    set_target_properties(qgis_core PROPERTIES FOLDER ${QGIS_CORE_ROOT_FOLDER}/)

    set_target_properties(qgis_desktop PROPERTIES FOLDER ${QGIS_CORE_ROOT_FOLDER}/)

    set_target_properties(qgis_gui PROPERTIES FOLDER ${QGIS_CORE_ROOT_FOLDER}/)

    set_target_properties(qgis_native PROPERTIES FOLDER ${QGIS_CORE_ROOT_FOLDER}/)

    set_target_properties(ui PROPERTIES FOLDER ${QGIS_CORE_ROOT_FOLDER}/)

    set_target_properties(version PROPERTIES FOLDER ${QGIS_CORE_ROOT_FOLDER}/)

    # uninstall

    set_target_properties(uninstall PROPERTIES FOLDER ${CMAKE_TARGETS_ROOT_FOLDER}/)  # weng for qgis test folders. 20.4.27

    # server

    # not all server about projects.

    # weng for qgis test folders. 20.4.29

    set_target_properties(qgis_server_full PROPERTIES FOLDER ${QGIS_SERVER_ROOT_FOLDER}/)

    set_target_properties(wms PROPERTIES FOLDER ${QGIS_SERVER_ROOT_FOLDER}/)

    set_target_properties(wfs PROPERTIES FOLDER ${QGIS_SERVER_ROOT_FOLDER}/)

    set_target_properties(wcs PROPERTIES FOLDER ${QGIS_SERVER_ROOT_FOLDER}/)

    set_target_properties(wfs3 PROPERTIES FOLDER ${QGIS_SERVER_ROOT_FOLDER}/)

    set_target_properties(wmts PROPERTIES FOLDER ${QGIS_SERVER_ROOT_FOLDER}/)

    set_target_properties(qgis_server PROPERTIES FOLDER ${QGIS_SERVER_ROOT_FOLDER}/)

    set_target_properties(qgis_mapserv.fcgi PROPERTIES FOLDER ${QGIS_SERVER_ROOT_FOLDER}/)

    set_target_properties(qgis_serverquerystringparametertest PROPERTIES FOLDER ${QGIS_SERVER_ROOT_FOLDER}/)

    然后设置1:

    # Include helper macros and commands, and allow the included file to override

    # the CMake policies in this file

    include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/CMakeHelper.cmake NO_POLICY_SCOPE)

    # move vs projects to folder. weng 20.4.27

    include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/CMakeHelper_end.cmake NO_POLICY_SCOPE)

    放置类别2:

    # weng for qgis test folders. 20.4.27

    set_target_properties(qgis_${testname} PROPERTIES FOLDER ${QGIS_QGIS_TEST_ROOT_FOLDER}/)

     

    语言设置:

    运行

    build 完成后,输出在 C:OSGeo4W64QGISuildoutputinRelWithDebInfo

     

    gis 依赖比较多,可通过设置环境变量的方式来运行。以下内容保存为 qgis.bat。
    @echo off
    set OSGEO4W_ROOT=C:OSGeo4W64
    call "%OSGEO4W_ROOT%ino4w_env.bat"
    call "%OSGEO4W_ROOT%inpy3_env.bat"
    call "%OSGEO4W_ROOT%inqt5_env.bat"
    start qgis

    双击运行 qgis.bat。

    问题及解决

    (0)CMake问题: ADD_SUBDIRECTORY given source "native" which is not an existing directory.
    问题,提示:

    CMake Error at src/CMakeLists.txt:1 (ADD_SUBDIRECTORY):

    ADD_SUBDIRECTORY given source "native" which is not an existing directory.

    Found exiv2: D:/Pros/Office/QGIS_Dev/OSGeo4W/lib/exiv2.lib

    CMake Error at src/CMakeLists.txt:9 (ADD_SUBDIRECTORY):

    ADD_SUBDIRECTORY given source "ui" which is not an existing directory.

    CMake Error at src/CMakeLists.txt:14 (ADD_SUBDIRECTORY):

    ADD_SUBDIRECTORY given source "providers" which is not an existing

    directory.

    CMake Error at src/CMakeLists.txt:22 (ADD_SUBDIRECTORY):

    ADD_SUBDIRECTORY given source "test" which is not an existing directory.

    CMake Error at src/CMakeLists.txt:26 (ADD_SUBDIRECTORY):

    ADD_SUBDIRECTORY given source "plugins" which is not an existing directory.

    CMake Error at src/CMakeLists.txt:34 (ADD_SUBDIRECTORY):

    ADD_SUBDIRECTORY given source "python" which is not an existing directory.

    CMake Error at src/CMakeLists.txt:50 (ADD_SUBDIRECTORY):

    ADD_SUBDIRECTORY given source "process" which is not an existing directory.

    Using PROJ 6 srs database.

    CMake Error at CMakeLists.txt:993 (ADD_SUBDIRECTORY):

    ADD_SUBDIRECTORY given source "tests" which is not an existing directory.

    原因,解压qgis库时,发现没有解压完整。

    (1) protobufC++)的使用(windows
    https://blog.csdn.net/pengshengli/article/details/90378455
    https://github.com/protocolbuffers/protobuf/releases

    (2) Qt5Gui_DIR
    https://blog.csdn.net/webzhuce/article/details/79960512

    WITH_QTWEBKIT 取消
    WITH_Qt5SerialPort 取消

    修改cmakelist, 新添加如下内容。

    set(Qt5Gui_DIR "C:/Program/Dev/Qt/Qt5.13.1/5.13.1/msvc2017_64/lib/cmake/Qt5Gui/")

    set(Qt5Widgets_DIR "C:/Program/Dev/Qt/Qt5.13.1/5.13.1/msvc2017_64/lib/cmake/Qt5Widgets/")

    set(Qt5Network_DIR "C:/Program/Dev/Qt/Qt5.13.1/5.13.1/msvc2017_64/lib/cmake/Qt5Network/")

    set(Qt5Xml_DIR "C:/Program/Dev/Qt/Qt5.13.1/5.13.1/msvc2017_64/lib/cmake/Qt5Xml/")

    set(Qt5Svg_DIR "C:/Program/Dev/Qt/Qt5.13.1/5.13.1/msvc2017_64/lib/cmake/Qt5Svg/")

    set(Qt5Concurrent_DIR "C:/Program/Dev/Qt/Qt5.13.1/5.13.1/msvc2017_64/lib/cmake/Qt5Concurrent/")

    set(Qt5PrintSupport_DIR "C:/Program/Dev/Qt/Qt5.13.1/5.13.1/msvc2017_64/lib/cmake/Qt5PrintSupport/")

    set(Qt5Positioning_DIR "C:/Program/Dev/Qt/Qt5.13.1/5.13.1/msvc2017_64/lib/cmake/Qt5Positioning/")

    set(Qt5WebKit_DIR "C:/Program/Dev/Qt/Qt5.13.1/5.13.1/msvc2017_64/lib/cmake/Qt5WebKit/")

    set(Qt5WebKitWidgets_DIR "C:/Program/Dev/Qt/Qt5.13.1/5.13.1/msvc2017_64/lib/cmake/Qt5WebKitWidgets/")

    set(Qt5Test_DIR "C:/Program/Dev/Qt/Qt5.13.1/5.13.1/msvc2017_64/lib/cmake/Qt5Test/")

    set(Qt5UiTools_DIR "C:/Program/Dev/Qt/Qt5.13.1/5.13.1/msvc2017_64/lib/cmake/Qt5UiTools/")

    set(Qt5Sql_DIR "C:/Program/Dev/Qt/Qt5.13.1/5.13.1/msvc2017_64/lib/cmake/Qt5Sql/")

    set(Qt53DCore_DIR "C:/Program/Dev/Qt/Qt5.13.1/5.13.1/msvc2017_64/lib/cmake/Qt53DCore/")

    set(Qt53DRender_DIR "C:/Program/Dev/Qt/Qt5.13.1/5.13.1/msvc2017_64/lib/cmake/Qt53DRender/")

    set(Qt53DInput_DIR "C:/Program/Dev/Qt/Qt5.13.1/5.13.1/msvc2017_64/lib/cmake/Qt53DInput/")

    set(Qt53DLogic_DIR "C:/Program/Dev/Qt/Qt5.13.1/5.13.1/msvc2017_64/lib/cmake/Qt53DLogic/")

    set(Qt53DExtras_DIR "C:/Program/Dev/Qt/Qt5.13.1/5.13.1/msvc2017_64/lib/cmake/Qt53DExtras/")

    但仍然编译不通过:

    Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.18363.

    QGIS version: 3.13.0 Master (31300)

    Found OpenCL C++ headers: E:/Projs/algs/qgis/qgis_source/external/opencl-clhpp/include

    Could not find GRASS 7

    Found Proj: D:/Pros/Office/QGIS_3_12/lib/proj_i.lib version 6 (6.3.1)

    Found GEOS: D:/Pros/Office/QGIS_3_12/lib/geos_c.lib (3.8.0)

    Found GDAL: D:/Pros/Office/QGIS_3_12/lib/gdal_i.lib (3.0.4)

    Found Expat: D:/Pros/Office/QGIS_3_12/lib/expat.lib

    Found Spatialindex: D:/Pros/Office/QGIS_3_12/lib/spatialindex-64.lib

    Found libzip: D:ProsIDEVS_LIBSoost_compzlib_installlib

    Found Sqlite3: D:/Pros/Office/QGIS_3_12/lib/sqlite3_i.lib

    Found Protobuf: D:ProsIDEVS_LIBSvcpkgvcpkginstalledx64-windowslib

    Found zlib: D:/Pros/Office/QGIS_3_12/lib/zlib.lib

    Found PostgreSQL: D:/Pros/Office/QGIS_3_12/lib/libpq.lib

    Found SpatiaLite: D:/Pros/Office/QGIS_3_12/lib/spatialite_i.lib

    Qt WebKit support DISABLED.

    CMake Error at C:/Program/Dev/Qt/Qt5.13.1/5.13.1/msvc2017_64/lib/cmake/Qt5UiTools/Qt5UiToolsConfig.cmake:74 (message):

    Library not found: Qt5Cored

    Call Stack (most recent call first):

    C:/Program/Dev/Qt/Qt5.13.1/5.13.1/msvc2017_64/lib/cmake/Qt5UiTools/Qt5UiToolsConfig.cmake:227 (_qt5_UiTools_process_prl_file)

    CMakeLists.txt:444 (FIND_PACKAGE)

    Configuring incomplete, errors occurred!

    See also "E:/Projs/algs/qgis/qgis_build/CMakeFiles/CMakeOutput.log".

    See also "E:/Projs/algs/qgis/qgis_build/CMakeFiles/CMakeError.log".

    解决方法:下载完整的qgis-dev-deps.

    (3)Could not load qgis_app.dll.

    Error loading QGIS

    Oops, looks like an error loading Qgis, Details Could not load qgis_app.dll.

    Window Erro: The specified procedure could not be found.

    Help: Check c:OS.. qgis-bin.env for correct environmental paths.

     

    解决方法(不可行):

    出现这种问题可能是多删除了项目,保留下面几个项目。

     

    (4)问题

    E:Projsalgsqgisqgis_sourceuildoutputinRelease

     

    猜测:

    是否和 D:ProsIDEVS_LIBSvcpkgvcpkginstalledx64-windowsinclude__,  中的protobuf重复了。所以,将其include更改,再试一下。

    发现不是和上述vcpkg中的protobuf冲突了,而是qgis_core.dll上引用的D:ProsOfficeQGIS_DevOSGeo4Wlib下的"libprotobuf-lite.lib", 将其改为 libprotobuf.lib 即可。

     

    (5)version编译失败。

    ModuleNotFoundError: No module named 'PyQt5.pyqtconfig'

    1>------ 已启动生成: 项目: version, 配置: Release x64 ------

    1>Building Custom Rule E:/Projs/algs/qgis/qgis_source2/CMakeLists.txt

    1>CMake is re-running because E:/Projs/algs/qgis/qgis_source2/build/CMakeFiles/generate.stamp is out-of-date.

    1>  the file 'E:/Projs/algs/qgis/qgis_source2/CMakeLists.txt'

    1>  is newer than 'E:/Projs/algs/qgis/qgis_source2/build/CMakeFiles/generate.stamp.depend'

    1>  result='-1'

    1>-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.18363.

    1>-- QGIS version: 3.13.0 Master (31300)

    1>-- Found OpenCL C++ headers: D:/Pros/Office/QGIS_Dev/OSGeo4W/include

    1>-- Could not find GRASS 7

    1>-- Found Proj: D:/Pros/Office/QGIS_Dev/OSGeo4W/lib/proj_i.lib version 6 (6.3.1)

    1>-- Found GEOS: D:/Pros/Office/QGIS_Dev/OSGeo4W/lib/geos_c.lib (3.8.1)

    1>-- Found GDAL: D:/Pros/Office/QGIS_Dev/OSGeo4W/lib/gdal_i.lib (3.0.4)

    1>-- Found Expat: D:/Pros/Office/QGIS_Dev/OSGeo4W/lib/expat.lib

    1>-- Found Spatialindex: D:/Pros/Office/QGIS_Dev/OSGeo4W/lib/spatialindex-64.lib

    1>-- Found Qwt: D:/Pros/Office/QGIS_Dev/OSGeo4W/apps/Qt5/lib/qwt.lib (6.1.3)

    1>-- Found libzip: D:/Pros/Office/QGIS_Dev/OSGeo4W/lib/zip.lib

    1>-- Found Sqlite3: D:/Pros/Office/QGIS_Dev/OSGeo4W/lib/sqlite3_i.lib

    1>-- Found Protobuf: D:/Pros/Office/QGIS_Dev/OSGeo4W/lib/libprotobuf.lib

    1>-- Found zlib: D:/Pros/Office/QGIS_Dev/OSGeo4W/lib/zlib.lib

    1>-- Found PostgreSQL: D:/Pros/Office/QGIS_Dev/OSGeo4W/lib/libpq.lib

    1>-- Found SpatiaLite: D:/Pros/Office/QGIS_Dev/OSGeo4W/lib/spatialite_i.lib

    1>-- Qt WebKit support enabled

    1>-- Found Qt version: 5.11.2

    1>-- Found QScintilla2: D:/Pros/Office/QGIS_Dev/OSGeo4W/apps/Qt5/lib/qscintilla2_qt5.lib (2.10.8)

    1>-- Found QtKeychain: D:/Pros/Office/QGIS_Dev/OSGeo4W/apps/Qt5/lib/qt5keychain.lib

    1>-- Found QCA: D:/Pros/Office/QGIS_Dev/OSGeo4W/apps/Qt5/lib/qca-qt5.lib (2.1.3)

    1>-- Pedantic compiler settings enabled

    1>-- Found Python executable: D:/Pros/Office/QGIS_Dev/OSGeo4W/bin/python3.exe

    1>-- Found Python version: 3.7.0

    1>-- Found Python library: D:/Pros/Office/QGIS_Dev/OSGeo4W/apps/Python37/libs/python37.lib

    1>-- Found Python site-packages: D:/Pros/IDE/Python37/Lib/site-packages

    1>Traceback (most recent call last):

    1>  File "E:/Projs/algs/qgis/qgis_source2/cmake/FindPyQt5.py", line 34, in <module>

    1>    import PyQt5.pyqtconfig

    1>ModuleNotFoundError: No module named 'PyQt5.pyqtconfig'

    1>

    1>During handling of the above exception, another exception occurred:

    1>

    1>Traceback (most recent call last):

    1>  File "E:/Projs/algs/qgis/qgis_source2/cmake/FindPyQt5.py", line 38, in <module>

    1>    import sipconfig # won't work for SIP v5

    1>ModuleNotFoundError: No module named 'sipconfig'

    1>Traceback (most recent call last):

    1>  File "E:/Projs/algs/qgis/qgis_source2/cmake/FindSIP.py", line 33, in <module>

    1>    import sipconfig

    1>ModuleNotFoundError: No module named 'sipconfig'

    1>CMake Error at cmake/FindSIP.cmake:54 (MESSAGE):

    1>  Could not find SIP

    1>Call Stack (most recent call first):

    1>  CMakeLists.txt:891 (FIND_PACKAGE)

    1>

    1>

    1>-- Configuring incomplete, errors occurred!

    1>See also "E:/Projs/algs/qgis/qgis_source2/build/CMakeFiles/CMakeOutput.log".

    1>See also "E:/Projs/algs/qgis/qgis_source2/build/CMakeFiles/CMakeError.log".

    1>C:ProgramDevMicrosoft Visual Studio2017EnterpriseCommon7IDEVCVCTargetsMicrosoft.CppCommon.targets(209,5): error MSB6006: “cmd.exe”已退出,代码为 1。

    1>已完成生成项目“version.vcxproj”的操作 - 失败。

    移除完,不相干的内容。再去编译。

    (6)Couldn't load SIP module.

    解决方法:

    D:ProsOfficeQGIS_DevOSGeo4WappsPython37>python Scripts/pip.exe list

    查看列出的结果(左侧)。

    D:ProsOfficeQGIS_DevOSGeo4WappsPython37>python Scripts/pip.exe list

    Package           Version

    ----------------- ---------

    bleach            3.1.0

    certifi           2019.9.11

    chardet           3.0.4

    coverage          4.5.1

    cycler            0.10.0

    docutils          0.15.2

    future            0.16.0

    GDAL              3.0.4

    idna              2.8

    kiwisolver        1.1.0

    matplotlib        3.1.3

    mock              2.0.0

    nose2             0.8.0

    numpy             1.18.1

    pbr               4.3.0

    Pillow            5.3.0

    pip               20.0.2

    pkginfo           1.5.0.1

    ply               3.11

    psycopg2-binary   2.8.4

    Pygments          2.4.2

    PyOpenGL          3.1.0

    pyparsing         2.4.6

    PyQt5             5.11.3

    python-dateutil   2.8.1

    pywin32           224

    PyYAML            5.3

    readme-renderer   24.0

    requests          2.22.0

    requests-toolbelt 0.9.1

    setuptools        41.2.0

    sip               4.19.14

    six               1.12.0

    tqdm              4.36.1

    twine             1.15.0

    urllib3           1.25.5

    webencodings      0.5.1

    wheel             0.33.6

    wxPython          4.0.7

    WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

    Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping

    D:ProsOfficeQGIS_DevOSGeo4WappsPython37>

    D:ProsOfficeQGIS_3_12appsPython37>python Scripts/pip.exe list

    Package           Version

    ----------------- ---------

    bleach            3.1.0

    certifi           2019.9.11

    chardet           3.0.4

    coverage          4.5.1

    cycler            0.10.0

    decorator         4.4.1

    docutils          0.15.2

    ExifRead          2.1.2

    future            0.16.0

    GDAL              3.0.4

    geographiclib     1.50

    httplib2          0.11.3

    idna              2.8

    ipython-genutils  0.2.0

    Jinja2            2.11.1

    jsonschema        2.6.0

    jupyter-core      4.4.0

    kiwisolver        1.1.0

    lxml              4.3.3

    MarkupSafe        1.1.1

    matplotlib        3.1.3

    mock              2.0.0

    nbformat          4.4.0

    networkx          2.2

    nose2             0.8.0

    numpy             1.18.1

    OWSLib            0.17.0

    pandas            1.0.1

    pbr               4.3.0

    Pillow            5.3.0

    pip               20.0.2

    pkginfo           1.5.0.1

    plotly            3.3.0

    ply               3.11

    psycopg2-binary   2.8.4

    Pygments          2.4.2

    pyodbc            4.0.24

    PyOpenGL          3.1.0

    pyparsing         2.4.6

    pypiwin32         223

    pyproj            2.5.0

    PyQt5             5.11.3

    python-dateutil   2.8.1

    pytz              2019.3

    pywin32           224

    PyYAML            5.3

    readme-renderer   24.0

    requests          2.22.0

    requests-toolbelt 0.9.1

    retrying          1.3.3

    scipy             1.4.1

    setuptools        41.2.0

    Shapely           1.7.0

    simplejson        3.16.0

    sip               4.19.14

    six               1.12.0

    tqdm              4.36.1

    traitlets         4.3.3

    twine             1.15.0

    urllib3           1.25.5

    webencodings      0.5.1

    wheel             0.33.6

    wxPython          4.0.7

    xlrd              1.1.0

    xlwt              1.3.0

    WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

    Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping

    D:ProsOfficeQGIS_3_12appsPython37>

    可以看到本该有的PyQt文件夹,没有在编译安装时,生成。

    解决方法是,全部生成QGIS目录下原本有的项目。不要取消生成一部分项目,以提高所谓的生成速度。

    而此时,千万不要听信网上的方法,删除 C:UsersAdministratorAppDataRoamingQGIS 下的QGIS3文件夹。

    否则,你的个性化设置,将全部丢失。

     

    (7)其它python所依赖的第三方库找不到的话,可以pip安装

    D:ProsOfficeQGIS_DevOSGeo4WappsPython37>python Scripts/pip.exe install jinja2 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

    (8)processing 菜单消失,processing box工具箱找不到

    Plugin processing: The plugin will be disabled because it crashed QGIS during last startup. Please report an issue and re-enable the plugin when the problem has been solved.

     

    可以在这个地方,看到QGIS的配置信息。

    C:UsersAdministratorAppDataRoamingQGISQGIS3profilesdefaultQGISQGIS3.ini

    解决方法:

    在插件,已经安装的插件中,重新开启processing,这个核心的插件。

    3.2 Packaging

    To create a standalone installer there is a perl script named 'creatensis.pl' in 'qgis/ms-windows/osgeo4w'. It downloads all required packages from OSGeo4W and repackages them into an installer using NSIS.

    The script can be run on both Windows and Linux.

    On Debian/Ubuntu you can just install the 'nsis' package.

    NSIS for Windows can be downloaded at:

    http://nsis.sourceforge.net

    And Perl for Windows (including other requirements like 'wget', 'unzip', 'tar' and 'bzip2') is available at:

    http://cygwin.com

    3.3 Packaging your own build of QGIS

    Assuming you have completed the above packaging step, if you want to include your own hand built QGIS executables, you need to copy them in from your windows installation into the ms-windows file tree created by the creatensis script.

    cd ms-windows/
    rm -rf osgeo4w/unpacked/apps/qgis/*
    cp -r /tmp/qgis1.7.0/* osgeo4w/unpacked/apps/qgis/

    Now create a package.

    ./quickpackage.sh

    After this you should now have a nsis installer containing your own build of QGIS and all dependencies needed to run it on a windows machine.

     

    3.4 Osgeo4w packaging

    The actual packaging process is currently not documented, for now please take a look at:

    ms-windows/osgeo4w/package.cmd

    你们的评论、反馈,及对你们有所用,是我整理材料和博文写作的最大的鼓励和唯一动力。欢迎讨论和关注!
    没有整理与归纳的知识,一文不值!高度概括与梳理的知识,才是自己真正的知识与技能。 永远不要让自己的自由、好奇、充满创造力的想法被现实的框架所束缚,让创造力自由成长吧! 多花时间,关心他(她)人,正如别人所关心你的。理想的腾飞与实现,没有别人的支持与帮助,是万万不能的。
  • 相关阅读:
    aspnet mvc 中 跨域请求的处理方法
    Aspnet Mvc 前后端分离项目手记(三)关于restful 风格Url设计
    Aspnet Mvc 前后端分离项目手记(二)关于token认证
    Aspnet Mvc 前后端分离项目手记(一) 关于跨域问题(还有前言)
    31 | 误删数据后除了跑路,还能怎么办?
    30 | 答疑文章(二):用动态的观点看加锁
    29 | 如何判断一个数据库是不是出问题了?
    28 | 读写分离有哪些坑?
    27 | 主库出问题了,从库怎么办?
    26 | 备库为什么会延迟好几个小时?
  • 原文地址:https://www.cnblogs.com/arxive/p/15084588.html
Copyright © 2020-2023  润新知