Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save xurshid29/f2b06363d8f72262368aa1d232550249 to your computer and use it in GitHub Desktop.
Save xurshid29/f2b06363d8f72262368aa1d232550249 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/[email protected]/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!

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