Postgresql – Installing Postgresql parray_gin extension on mac, include not found

installationmac os xpostgresqlpostgresql-10postgresql-extensions

I am trying to install parray_gin in PostgreSQL 10 on macOS, but I can't get it to build.

I'm running pgxn install parray_gin. This first gave me a missing stdio.h error, so I installed the xcode command line tools, and now it's complaining about

/Library/PostgreSQL/10/include/postgresql/server/utils/pg_locale.h:19:10: 
fatal error: 'unicode/ucol.h' file not found

After some Googling it appeared I needed to install an extra library, which I did through brew install icu4c

This printed:

This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS provides libicucore.dylib (but nothing else).

If you need to have this software first in your PATH run:
    echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.bash_profile
    echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.bash_profile

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/icu4c/lib
    CPPFLAGS: -I/usr/local/opt/icu4c/include

But it didn't change a thing and I have no idea how to pass /usr/local/opt/icu4c/include to pgxn

Best Answer

You need to manually download the sources and edit the Makefile

Add this:

PG_CPPFLAGS = "-I/usr/local/opt/icu4c/include"
SHLIB_LINK =  "-L/usr/local/opt/icu4c/lib"

and it works

https://github.com/theirix/parray_gin/issues/5