[Qgis-developer] Building on OSX with brew

Larry Shaffer larrys at dakotacarto.com
Thu Mar 27 13:05:52 PDT 2014


Hi Tim,

On Thu, Mar 27, 2014 at 5:57 AM, Tim Sutton <lists at linfiniti.com> wrote:

> Hi Larry
>
> I finally have the time to sit down and try to get your recipe for
> building / debugging QGIS under QtCreator a try, but I cant seem to find
> your notes on this. I have two screenies showing some of the settings but
> not quite enough info to get it working. Currently I am getting this (see
> [2] below) output when trying to run cmake in QtCreator. I am building
> using options in [1].
>
> I also made this dirty hack so that some python libs could be found [3].
>
> Can you point me in the right direction of any notes etc you have?
>

I will add documentation about this to the site [0]. I have been debugging
this setup and now having it working smoothly on Mac 10.7.5 and 10.9.2. You
can use the following notes for now and we can work on making the online
docs better, eventually including it in INSTALL somehow.

Basic instructions:

1) Ensure deps are installed:

Install required build Python modules (use pip on system or Homebrew's pip
when using its Python). You can also tap homebrew/python for some more
complex modules [1]:

* numpy  <-- this is used by gdal.rb install, if building with python
option, which is the default

$ brew tap homebrew/science
$ brew tap dakcarto/osgeo4mac
$ brew install qgis-22 --only-dependencies --with-grass --with-globe
[--with-oracle]

Install required run-time Python modules :

* psycopg2 matplotlib pyparsing

2) Copy the following directory elsewhere and use it from there:
HOMEBREW_PREFIX/Library/Taps/dakcarto-osgeo4mac/scripts

Note: it's important to not edit the scripts where they are located, in the
tap, because it is a git repo. You should keep that working tree clean so
that `brew update` always works.

Open and review scripts:

* qgis-cmake-options.py - for generating CMake option string for use in Qt
Creator when built off dependencies from homebrew-osgeo4mac tap. Edit CMake
options to suit your build needs. Note, the current script usually has
CMake options for building QGIS with *all* options that the current
Homebrew formula, e.g. qgis-22, supports, which can include things like
Oracle support, etc. You will probably want to edit it and comment out such
lines for an initial build. I add this as an external tool in Qt Creator
[2].

* qgis-set-app-env.py - for setting env vars in dev build and installed
QGIS.app, to ensure they are available on double-click run. Needs to stay
in the same directory as the next scripts.

* qgis-creator-build.sh - sets up the build environ and ensures the
QGIS.app in the build directory can find resources, so it can run from
there.

* qgis-creator-install.sh - installs the app and ensures QGIS.app has
proper env variables, so it can be moved around on the filesystem.
Currently QGIS.app bundling beyond QGIS_MACAPP_BUNDLE=0 is not supported.

3) Configure a Creator Qt version and kit [3, 4].

4) Configure Creator project with prepended environment variables and to
use the build and install scripts [5].

This whole setup supports builds where the OSGeo4Mac deps are in a
non-standard Homebrew location, e.g. /usr/local/osgeo4mac or
/opt/osgeo4mac, instead of /usr/local. This allows for multiple build
scenarios, including placing the deps on an external drive, though that
requires building all deps with special 'bottle' parameters.

I've tried to make the setup as simple and flexible as possible, though I'm
sure it can use some work.

Let me know how it goes!  :-)

[0] https://github.com/dakcarto/homebrew-osgeo4mac
[1] https://github.com/Homebrew/homebrew-python

In screen snaps, substitute the appropriate directories for your setup, as
per notes above:
[2]
http://drive.dakotacarto.com/osgeo4mac/QtCreator_osgeo4mac_QGIS-CMakeOptions.png
[3] http://drive.dakotacarto.com/osgeo4mac/QtCreator_osgeo4mac_Kits.png
[4]
http://drive.dakotacarto.com/osgeo4mac/QtCreator_osgeo4mac_QtVersions.png
[5]
http://drive.dakotacarto.com/osgeo4mac/QtCreator_osgeo4mac_QGIS-Project.png


Regards,

Larry



> Regards
>
> Tim
>
> [1]
>
> -DCMAKE_INSTALL_PREFIX="/Users/timlinux/Applications/"
>  -DCMAKE_BUILD_TYPE="RelWithDebInfo" -DWITH_ASTYLE=FALSE
> -DENABLE_TESTS=TRUE -DWITH_INTERNAL_SPATIALITE=FALSE
> -DWITH_PYSPATIALITE=FALSE
> -DSPATIALINDEX_INCLUDE_DIR=/usr/local/include/spatialindex
> -DSPATIALINDEX_LIBRARY=/usr/local/Cellar/libspatialite/4.1.1/libspatialindex.dylib
> -DQWT_LIBRARY=/usr/local/Cellar/qwt/6.1.0/lib/qwt.framework/Versions/Current/qwt
> -DQWT_INCLUDE_DIR=/usr/local/Cellar/qwt/6.1.0/lib/qwt.framework/Versions/Current/Headers/
> -DBISON_EXECUTABLE=/usr/local/Cellar/bison/3.0.2/bin/bison
> -DWITH_MAPSERVER=TRUE -DWITH_APIDOC=FALSE -DQGIS_MACAPP_BUNDLE=2
> -DSIP_BINARY_PATH=/usr/local/bin
> -DPYTHON_LIBRARIES=/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib
> -DWITH_MAPSERVER=False
>
> [2]
>
> CMake Error: The following variables are used in this project, but they
> are set to NOTFOUND.
>
> Please set them or make sure they are set and tested correctly in the
> CMake files:
>
> QWTPOLAR_INCLUDE_DIR
>
> used as include directory in directory /Users/timlinux/dev/cpp/QGIS/src/app
>
> used as include directory in directory /Users/timlinux/dev/cpp/QGIS/src/app
>
> used as include directory in directory /Users/timlinux/dev/cpp/QGIS/src/app
>
> QWTPOLAR_LIBRARY
>
> linked by target "QGIS" in directory /Users/timlinux/dev/cpp/QGIS/src/app
>
> linked by target "qgis_app" in directory
> /Users/timlinux/dev/cpp/QGIS/src/app
>
> linked by target "qgis_qgisappclipboard" in directory
> /Users/timlinux/dev/cpp/QGIS/tests/src/app
>
>
> /usr/bin/python: can't open file '_find_qsci_py-NOTFOUND': [Errno 2] No
> such file or directory
>
> /usr/bin/python: can't open file '_find_pyqt_py-NOTFOUND': [Errno 2] No
> such file or directory
>
> -- QGIS version: 2.3.0 Master (20300)
>
> -- Could not find GRASS
>
> -- Found Proj: /usr/local/lib/libproj.dylib
>
> -- Found GEOS: /usr/local/Cellar/geos/3.4.2/lib/libgeos_c.dylib
>
> -- Found GDAL: /usr/local/Cellar/gdal/1.10.1/lib/libgdal.dylib (1.10.1)
>
> -- Found Expat: /usr/local/lib/libexpat.dylib
>
> -- Found Spatialindex:
> /usr/local/Cellar/libspatialite/4.1.1/libspatialindex.dylib
>
> -- Found Qwt:
> /usr/local/Cellar/qwt/6.1.0/lib/qwt.framework/Versions/Current/qwt (6.1.0)
>
> -- Found Sqlite3: /usr/lib/libsqlite3.dylib
>
> -- Found PostgreSQL: /usr/local/Cellar/postgresql/9.3.2/lib/libpq.dylib
>
> -- Found SpatiaLite: /usr/local/lib/libspatialite.dylib
>
> -- Found Qt version: 4.8.6
>
> -- Touch support disabled
>
> -- Found QScintilla2: /usr/local/lib/libqscintilla2.dylib (2.8)
>
> -- Pedantic compiler settings enabled
>
> -- Debug output enabled
>
> -- Found Python executable: /usr/bin/python
>
> -- Found Python version: 2.7.5
>
> -- Found Python library: -framework Python
>
> -- Found SIP version: 4.15.4
>
> -- Found GSL: -L/usr/local/Cellar/gsl/1.16/lib -lgsl -lgslcblas
>
> -- txt2tags not found - disabled
>
> -- Ctest Binary Directory set to:
> /Users/timlinux/dev/cpp/QGIS/build-osx/output/bin
>
> -- Configuring incomplete, errors occurred!
>
> See also
> "/Users/timlinux/dev/cpp/QGIS/build-osx/CMakeFiles/CMakeOutput.log".
>
> See also
> "/Users/timlinux/dev/cpp/QGIS/build-osx/CMakeFiles/CMakeError.log".
>
>
> [3]
>
> Tims-MacBook-Pro:QGIS timlinux$ git diff
>
> diff --git a/cmake/FindPyQt.py b/cmake/FindPyQt.py
>
> index 256c4a6..b658cde 100644
>
> --- a/cmake/FindPyQt.py
>
> +++ b/cmake/FindPyQt.py
>
> @@ -29,6 +29,7 @@
>
>  # Copyright (c) 2007, Simon Edwards <simon at simonzone.com>
>
>  # Redistribution and use is allowed according to the terms of the BSD
> license.
>
>  # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
>
> +import sys
>
>
>
>  import PyQt4.pyqtconfig
>
>
>
> diff --git a/cmake/FindSIP.py b/cmake/FindSIP.py
>
> index e291baa..7eb8d68 100644
>
> --- a/cmake/FindSIP.py
>
> +++ b/cmake/FindSIP.py
>
> @@ -31,6 +31,8 @@
>
>  # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
>
>
>
>  import sys
>
> +sys.path.append('/usr/local/lib/python2.7/site-packages/')
>
> +print sys.path
>
>  import sipconfig
>
>
>
>  sipcfg = sipconfig.Configuration()
>
>
>
>
>
>
> --
> Tim Sutton - QGIS Project Steering Committee Member
> ==============================================
> Please do not email me off-list with technical
> support questions. Using the lists will gain
> more exposure for your issues and the knowledge
> surrounding your issue will be shared with all.
>
> Irc: timlinux on #qgis at freenode.net
> ==============================================
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20140327/61c8344a/attachment.html>


More information about the Qgis-developer mailing list