From dc95ab7d0e6d3f5056a651077b4efd94cd9e3e12 Mon Sep 17 00:00:00 2001 From: Seth Nickell Date: Wed, 2 Sep 2020 22:38:35 -1000 Subject: [PATCH 1/3] Update README.md for compiling python-mapnik on MacOS catalina Detailed directions, because its really really hard, three of us at ceresimaging have tried for a couple days each. --- README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/README.md b/README.md index bdcc1a0a6..8fdcbefe1 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,8 @@ After this is done simply follow the directions as per a source build. ### Building from Source +For detailed MacOS with Homebrew instructions, see section below + Assuming that you built your own mapnik from source, and you have run `make install`. Set any compiler or linking environment variables as necessary so that your installation of mapnik is found. Next simply run one of the two methods: ``` @@ -53,6 +55,33 @@ If you need Pycairo, make sure that PYCAIRO is set to true in your environment o PYCAIRO=true python setup.py develop ``` +### Building on MacOS Catalina with Homebrew: use mapnik/master and python-mapnik-master + +On MacOS Catalina with Homebrew, the homebrew's mapnik version (3.0) conflicts with the boost version (>1.73). + +Its much easier to compile mapnik 4.0 from `mapnik/master`, and compile `python-mapnik` against that. + +#### First: build `mapnik/master` + +Setting the `PYTHON=python2` env var is important, an older fork of SConstruct is embedded in mapnik source, which will not work with `python` if its linked to `python3` as on some MacOS systems. + +``` +git clone https://github.com/mapnik/mapnik ; cd mapnik +git submodule update --init +PYTHON=python2 ./configure +make +make install +``` + +#### Next: build `python-mapnik/master` + +Homebrew includes the python version in the libboost_python38.dylib name, which is not autodetected, and must be explicitly referenced: + +``` +git clone https://github.com/mapnik/python-mapnik ; cd python-mapnik +BOOST_PYTHON=“boost_python38” python3 setup.py install +``` + ### Building against Mapnik 3.0.x The `master` branch is no longer compatible with `3.0.x` series of Mapnik. To build against Mapnik 3.0.x, use [`v3.0.x`](https://github.com/mapnik/python-mapnik/tree/v3.0.x) branch. From 4a6e03cf29dc5ff1f18578b5a1151f845f38e7d4 Mon Sep 17 00:00:00 2001 From: Seth Nickell Date: Wed, 2 Sep 2020 22:42:25 -1000 Subject: [PATCH 2/3] Mention SQLITE path must be pointed at homebrew sqlite --- README.md | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8fdcbefe1..a2f7865fc 100644 --- a/README.md +++ b/README.md @@ -61,19 +61,32 @@ On MacOS Catalina with Homebrew, the homebrew's mapnik version (3.0) conflicts w Its much easier to compile mapnik 4.0 from `mapnik/master`, and compile `python-mapnik` against that. -#### First: build `mapnik/master` +#### First: setup homebrew packages -Setting the `PYTHON=python2` env var is important, an older fork of SConstruct is embedded in mapnik source, which will not work with `python` if its linked to `python3` as on some MacOS systems. +``` +# note: boost needs to be >= 1.73, make sure boost@1.73 is linked too +brew install boost boost-python3 sqlite gdal cairo python@3.8 +brew upgrade boost boost-python3 sqlite gdal cairo python@3.8 +brew link boost + +# We're build a custom mapnik 4, uninstall the stale 3.x version in homebrew: +brew uninstall mapnik +``` + +#### Second: build `mapnik/master` + +Setting the `PYTHON=python2` env var is important, an older fork of SConstruct is embedded in mapnik source, which will not work with `python` if its linked to `python3` as on some MacOS systems. Passing a path to sqlite3 will select the homebrew version instead of the MacOS system version (which doesn't include support for sqlite extensions and will break the mapnik compile). ``` +brew install boost git clone https://github.com/mapnik/mapnik ; cd mapnik git submodule update --init -PYTHON=python2 ./configure +PYTHON=python2 ./configure. SQLITE_INCLUDES=/usr/local/opt/sqlite3/include make make install ``` -#### Next: build `python-mapnik/master` +#### Finally: build `python-mapnik/master` Homebrew includes the python version in the libboost_python38.dylib name, which is not autodetected, and must be explicitly referenced: From 4a18669b33431344bc9f9779f8e4c2c8ee66cef5 Mon Sep 17 00:00:00 2001 From: Seth Nickell Date: Wed, 2 Sep 2020 22:55:03 -1000 Subject: [PATCH 3/3] Drop meddlesome quotes that break some shells --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a2f7865fc..cab7992f1 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,7 @@ Homebrew includes the python version in the libboost_python38.dylib name, which ``` git clone https://github.com/mapnik/python-mapnik ; cd python-mapnik -BOOST_PYTHON=“boost_python38” python3 setup.py install +BOOST_PYTHON=boost_python38 python3 setup.py install ``` ### Building against Mapnik 3.0.x