Skip to content

Instantly share code, notes, and snippets.

@skissane
Last active June 14, 2022 14:17
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save skissane/0487c097872a7f6d0dcc9bcd120c2ccd to your computer and use it in GitHub Desktop.
Save skissane/0487c097872a7f6d0dcc9bcd120c2ccd to your computer and use it in GitHub Desktop.
Solutions and workarounds for issues with "pex install postgis" (assuming macOS+Homebrew)

Problem: configure: error: could not find libxml2
Solution: sudo xcode-select -s /Library/Developer/CommandLineTools

Problem: configure: error: could not find geos-config within the current path. You may need to try re-running configure with a --with-geosconfig parameter
Solution: brew install geos

Problem: configure: error: could not find proj_api.h - you may need to specify the directory of a PROJ.4 installation using --with-projdir
Solution: brew install proj and then CFLAGS=-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H pex install postgis

Problem: configure: error: gdal-config not found. Use --without-raster or try --with-gdalconfig=<path to gdal-config>
Solution: brew install gdal

Problem: lwin_geojson.c:36:10: fatal error: 'json-c/json_object_private.h' file not found
Hacky workaround: touch /usr/local/include/json-c/json_object_private.h

(Note: json_object_private.h is a private header file, and postgis should not include it. Newer json-c versions no longer ship it. Newer postgis versions this is fixed. Creating an empty file is enough to get past this error.)

Problem: ../liblwgeom/liblwgeom.h:35:10: fatal error: 'proj_api.h' file not found
Solution: PG_CPPFLAGS='-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H -I/usr/local/include' CFLAGS='-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H -I/usr/local/include' pex install postgis

see: petere/pex#8

Problem: address_parser.c:10:10: fatal error: 'pcre.h' file not found
Ultra-hacky workaround: ln -s /usr/local/include/pcre*.h /usr/local/opt/postgresql@9.6/include

Can't really defend this monstrosity except to say it works, and I haven't found any better solution. If anyone knows of a less stupid solution, I'm all ears!

@digi0ps
Copy link

digi0ps commented Jul 22, 2020

This helped me install it after struggling for a day. Thanks a lot. 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment