[Qgis-developer] Building on OSX with brew

Larry Shaffer larrys at dakotacarto.com
Fri Mar 28 17:45:17 PDT 2014

Hi Tim,

Just a quick note that the homebrew-osgeo repo (tap) is now under the OSGeo
user account [0]; switched over today. Since it was transferred on github,
the dakcarto/osgeo4mac tap should still work, since it is aliased by
github. If you run into issues, follow the new notes here [1], i.e. switch
taps. Sorry about the timing.

If you have the Kyngchaos stable QGIS packages installed, you may be better
off using the Homebrew python (and rebuilding), but only if you run into
significant Python issues, some of which many not show up until you run the
app. This is because the Kyngchaos GDAL.framework and others already have
*.pth files in your system site-packages.

This is the reason for the 'isolation' mode in the qgis-22 formula and the
use of the osgeo-osgeo4mac/enviro/python_startup.py script: to coexist, and
not interfere, with the Kyngchaos install. Isolation requires a separate
Python, for now, since initializing a virtualenv for QGIS.app on
double-click startup is not yet supported (at least I think it's not). In
isolation mode, no modules from /Library/* locations are loaded. So, you
will have to install all modules in Homebrew's site-packages, using

Be really nice to have a virtualenv creation and configuration GUI in the
main Options, as previously discussed.

[0] https://github.com/OSGeo/homebrew-osgeo4mac



On Fri, Mar 28, 2014 at 5:09 PM, Tim Sutton <lists at linfiniti.com> wrote:

> On Thu, Mar 27, 2014 at 9:05 PM, Larry Shaffer <larrys at dakotacarto.com>wrote:
>> 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
> Thanks very much Larry - I'm running through your notes now!
> Regards
> Tim

---- 8< ---snip------

> --
> 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
> ==============================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20140328/9715cfd4/attachment.html>

More information about the Qgis-developer mailing list