pg_show_plans icon indicating copy to clipboard operation
pg_show_plans copied to clipboard

Install on mac with postgresql installed via brew

Open jankatins opened this issue 5 years ago • 0 comments

I installed postgresql via brew and then only installed the xcode commandline package (xcode-select --install). Installing this extension via make USE_PGXS=TRUE failed with

λ make  USE_PGXS=TRUE
clang -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -O2  -I. -I./ -I/usr/local/opt/postgresql@11/include/server -I/usr/local/opt/postgresql@11/include/internal -I/usr/local/Cellar/icu4c/64.2/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -I/usr/local/opt/[email protected]/include -I/usr/local/opt/readline/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2   -c -o pg_show_plans.o pg_show_plans.c
clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk' [-Wmissing-sysroot]
In file included from pg_show_plans.c:11:
In file included from /usr/local/opt/postgresql@11/include/server/postgres.h:46:
/usr/local/opt/postgresql@11/include/server/c.h:59:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
         ^~~~~~~~~
1 error generated.

The fix was to overwrite the hardcoded (from the brew compile of PG) systroot: make USE_PGXS=TRUE PG_SYSROOT=$(xcrun --show-sdk-path)

see https://github.com/citusdata/cstore_fdw/issues/207#issuecomment-605529428 for more details about the sysroot problem.

jankatins avatar Mar 28 '20 23:03 jankatins