Closed amit653 closed 1 year ago
Hi,
I don't know much about macos but it seems that you have a "sysroot" problem, whatever that is:
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk' [-Wmissing-sysroot]
I'm assuming that this is what contains the libc implementation on macos, so you would have to fix your installation and at least make sure that this "MacOSX11.3.sdk" is present to be able to compile pg_stat_kcache, or probably any postgres extension written in C.
Hi latest MacOSX SDK are present , i think pg_stat_kcache.c has to be compatible with latest SDK. ls -lrt /Library/Developer/CommandLineTools/SDKs/ total 0 drwxr-xr-x 7 root wheel 224 Dec 2 2022 MacOSX12.3.sdk drwxr-xr-x 7 root wheel 224 Mar 10 2023 MacOSX13.3.sdk lrwxr-xr-x 1 root wheel 14 Jun 29 14:19 MacOSX13.sdk -> MacOSX13.3.sdk lrwxr-xr-x 1 root wheel 14 Jun 29 14:19 MacOSX12.sdk -> MacOSX12.3.sdk lrwxr-xr-x 1 root wheel 14 Jun 29 14:20 MacOSX.sdk -> MacOSX13.3.sdk
With postgres extensions aren't responsible for most of the flags, those are inherited from postgres. You can check what postgres things your options are using pg_config
. For instance pg_config --cppflags
should display the -isysroot .... If this isn't the one that's currently installed, then something is broken on your local setup but it's not something that pg_stat_kcache or any extension can fix.
I guess it depends on how you installed postgres. Maybe you need to reinstall or recompile it as your current one is aware of some version 11, not 12 or 13.
I installed EDB postgresql-15.3-2-osx.dmg , Have to try community version.
You may face the same problem with another installer, as there's an inherent limitation that the cppflags at postgres compile time should be compatible with the system on which you compile extensions.
Maybe macos allows you to install multiple versions of this thing so you can make sure that you also have the specific version needed from a postgres point of view.
you were right,getting same error with community postgres. Fixed this by creating symbolic link
ln -s MacOSX13.3.sdk MacOSX11.3.sdk
root@Amits-MacBook-Pro SDKs # ls -lrt
total 0
drwxr-xr-x 7 root wheel 224 Dec 2 2022 MacOSX12.3.sdk
drwxr-xr-x 7 root wheel 224 Mar 10 2023 MacOSX13.3.sdk
lrwxr-xr-x 1 root wheel 14 Jun 29 14:19 MacOSX13.sdk -> MacOSX13.3.sdk
lrwxr-xr-x 1 root wheel 14 Jun 29 14:19 MacOSX12.sdk -> MacOSX12.3.sdk
lrwxr-xr-x 1 root wheel 14 Jun 29 14:20 MacOSX.sdk -> MacOSX13.3.sdk
lrwxr-xr-x 1 root wheel 14 Sep 9 16:27 MacOSX11.3.sdk -> MacOSX13.3.sdk ########
root@Amits-MacBook-Pro pg_stat_kcache # make gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -g -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -mmacosx-version-min=10.15 -arch x86_64 -arch arm64 -O2 -I. -I./ -I/Library/PostgreSQL/15/include/postgresql/server -I/Library/PostgreSQL/15/include/postgresql/internal -I/opt/local/Current_v15/include -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -I/opt/local/20220418/include/libxml2 -I/opt/local/Current_v15/include -I/opt/local/Current_v15/include -I/opt/local/Current_v15/include/libxml2 -I/opt/local/Current_v15/include -I/opt/local/Current_v15/include/openssl/ -c -o pg_stat_kcache.o pg_stat_kcache.c gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -g -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -mmacosx-version-min=10.15 -arch x86_64 -arch arm64 -O2 -bundle -multiply_defined suppress -o pg_stat_kcache.so pg_stat_kcache.o -L/Library/PostgreSQL/15/lib -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -L/opt/local/Current_v15/lib -L/opt/local/20220418/lib -L/opt/local/lib -L/opt/local/Current_v15/lib -L/opt/local/Current_v15/lib -Wl,-dead_strip_dylibs -bundle_loader /Library/PostgreSQL/15/bin/postgres ld: warning: directory not found for option '-L/opt/local/Current_v15/lib' ld: warning: directory not found for option '-L/opt/local/20220418/lib' ld: warning: directory not found for option '-L/opt/local/lib' ld: warning: directory not found for option '-L/opt/local/Current_v15/lib' ld: warning: directory not found for option '-L/opt/local/Current_v15/lib' ld: warning: directory not found for option '-L/opt/local/Current_v15/lib' ld: warning: directory not found for option '-L/opt/local/20220418/lib' ld: warning: directory not found for option '-L/opt/local/lib' ld: warning: directory not found for option '-L/opt/local/Current_v15/lib' ld: warning: directory not found for option '-L/opt/local/Current_v15/lib'
root@Amits-MacBook-Pro pg_stat_kcache # make install /bin/sh /Library/PostgreSQL/15/lib/postgresql/pgxs/src/makefiles/../../config/install-sh -c -d '/Library/PostgreSQL/15/lib/postgresql' /bin/sh /Library/PostgreSQL/15/lib/postgresql/pgxs/src/makefiles/../../config/install-sh -c -d '/Library/PostgreSQL/15/share/postgresql/extension' /bin/sh /Library/PostgreSQL/15/lib/postgresql/pgxs/src/makefiles/../../config/install-sh -c -d '/Library/PostgreSQL/15/share/postgresql/extension' /usr/bin/install -c -m 755 pg_stat_kcache.so '/Library/PostgreSQL/15/lib/postgresql/pg_stat_kcache.so' /usr/bin/install -c -m 644 .//pg_stat_kcache.control '/Library/PostgreSQL/15/share/postgresql/extension/' /usr/bin/install -c -m 644 .//pg_stat_kcache--2.1.0--2.1.1.sql .//pg_stat_kcache--2.1.0.sql .//pg_stat_kcache--2.1.1--2.1.2.sql .//pg_stat_kcache--2.1.1.sql .//pg_stat_kcache--2.1.2--2.1.3.sql .//pg_stat_kcache--2.1.2.sql .//pg_stat_kcache--2.1.3--2.2.0.sql .//pg_stat_kcache--2.1.3.sql .//pg_stat_kcache--2.2.0--2.2.1.sql .//pg_stat_kcache--2.2.0.sql .//pg_stat_kcache--2.2.1--2.2.2.sql .//pg_stat_kcache--2.2.1.sql .//pg_stat_kcache--2.2.2.sql '/Library/PostgreSQL/15/share/postgresql/extension/'
I'm glad that using a symlink solved your problem. Looking a bit into customization possibilities of pgxs.mk, I'm wondering if prepending your "real" sysroot could work. Does it work if you remove that symlink and try
PG_CPPFLAGS="-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk" make
or the 11.3 one? If yes, you will then also probably need to use PG_LDFLAGS to teach the linker the location of your current sysroot.
Unfortunately there's no possibility to override directly PG_SYSROOT.
I will try the solution in another environment, this issue can be closed. Thanks for your help
Ok! Feel free to reopen this issue or create a new one if needed.
root@Amits-MacBook-Pro extension # git clone https://github.com/powa-team/pg_stat_kcache.git Cloning into 'pg_stat_kcache'... remote: Enumerating objects: 577, done. remote: Counting objects: 100% (104/104), done. remote: Compressing objects: 100% (54/54), done. remote: Total 577 (delta 64), reused 75 (delta 48), pack-reused 473 Receiving objects: 100% (577/577), 157.33 KiB | 1.03 MiB/s, done. Resolving deltas: 100% (341/341), done.
root@Amits-MacBook-Pro extension # cd pg_stat_kcache root@Amits-MacBook-Pro pg_stat_kcache # make gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -g -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -mmacosx-version-min=10.15 -arch x86_64 -arch arm64 -O2 -I. -I./ -I/Library/PostgreSQL/15/include/postgresql/server -I/Library/PostgreSQL/15/include/postgresql/internal -I/opt/local/Current_v15/include -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -I/opt/local/20220418/include/libxml2 -I/opt/local/Current_v15/include -I/opt/local/Current_v15/include -I/opt/local/Current_v15/include/libxml2 -I/opt/local/Current_v15/include -I/opt/local/Current_v15/include/openssl/ -c -o pg_stat_kcache.o pg_stat_kcache.c clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk' [-Wmissing-sysroot] clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk' [-Wmissing-sysroot] In file included from pg_stat_kcache.c:16: In file included from /Library/PostgreSQL/15/include/postgresql/server/postgres.h:46: /Library/PostgreSQL/15/include/postgresql/server/c.h:59:10: fatal error: 'stdio.h' file not found
include
1 error generated. make: *** [pg_stat_kcache.o] Error 1