Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling on MacOS Catalina + Homebrew: update README.md #232

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

```
Expand Down Expand Up @@ -53,6 +55,46 @@ 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: setup homebrew packages

```
# note: boost needs to be >= 1.73, make sure [email protected] is linked too
brew install boost boost-python3 sqlite gdal cairo [email protected]
brew upgrade boost boost-python3 sqlite gdal cairo [email protected]
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. SQLITE_INCLUDES=/usr/local/opt/sqlite3/include
make
make install
```

#### 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:

```
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.
Expand Down