Xcode 使用Postgis从Postgres 10升级到11

Xcode 使用Postgis从Postgres 10升级到11,xcode,postgresql,clang,homebrew,postgis,Xcode,Postgresql,Clang,Homebrew,Postgis,我最近不得不用macOS Mojave上的homebrew将Postgres版本从10升级到11,因为需要使用Postgis,所以在升级Postgres版本后,遵循brew postgresql升级数据库的标准方法看起来并不简单 我发现这似乎是解决我问题的一个可能办法。当我试图在postgis-2.5.1上运行make时,它抛出一个错误,似乎将命令行工具与Xcode路径混淆,我目前还没有安装该路径 下面是我迄今为止尝试过的命令序列: ❯ xcrun --show-sdk-path /Librar

我最近不得不用macOS Mojave上的
homebrew
将Postgres版本从10升级到11,因为需要使用Postgis,所以在升级Postgres版本后,遵循
brew postgresql升级数据库的标准方法看起来并不简单

我发现这似乎是解决我问题的一个可能办法。当我试图在
postgis-2.5.1
上运行
make
时,它抛出一个错误,似乎将
命令行工具
Xcode
路径混淆,我目前还没有安装该路径

下面是我迄今为止尝试过的命令序列:

❯ xcrun --show-sdk-path
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk

❯ ./configure --with-pgconfig=/usr/local/Cellar/postgresql@10/10.6_1/bin/pg_config --with-xml2config=/usr/local/Cellar/libxml2/2.9.9_2/bin/xml2-config --with-projdir=/usr/local/Cellar/proj/5.2.0 --with-jsondir=/usr/local/Cellar/json-c/0.13.1 --with-pcredir=/usr/local/Cellar/pcre/8.4

❯ make
/usr/local/bin/perl utils/svn_repo_revision.pl
Can't fetch local revision (neither .svn nor .git found)
Not updating existing rev file at 17027
for s in liblwgeom libpgcommon postgis regress raster topology loader utils doc extensions; do \
                echo "---- Making all in ${s}"; \
                /Library/Developer/CommandLineTools/usr/bin/make -C ${s} all || exit 1; \
        done;
---- Making all in liblwgeom
make[1]: Nothing to be done for `all'.
---- Making all in libpgcommon
make[1]: Nothing to be done for `all'.
---- Making all in postgis
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../liblwgeom -g -O2 -I../libpgcommon  -I/usr/local/Cellar/geos/3.7.1_1/include -I/usr/local/Cellar/proj/5.2.0/include  -I/usr/local/Cellar/libxml2/2.9.9_2/include/libxml2 -I/usr/local/Cellar/sfcgal/1.3.6/include -DHAVE_SFCGAL -I/usr/local/Cellar/json-c/0.13.1/include -I/usr/local/Cellar/pcre/8.42/include  -fPIC -I/usr/local/Cellar/sfcgal/1.3.6/include -DHAVE_SFCGAL -I. -I./ -I/usr/local/Cellar/postgresql@10/10.6_1/include/server -I/usr/local/Cellar/postgresql@10/10.6_1/include/internal -I/usr/local/Cellar/icu4c/63.1/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/libxml2   -c -o postgis_module.o postgis_module.c
clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk' [-Wmissing-sysroot]
In file included from postgis_module.c:26:
In file included from /usr/local/Cellar/postgresql@10/10.6_1/include/server/postgres.h:47:
/usr/local/Cellar/postgresql@10/10.6_1/include/server/c.h:81:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
         ^~~~~~~~~
1 error generated.
make[1]: *** [postgis_module.o] Error 1
make: *** [all] Error 1
为了记录在案,我已经为macOS_10.14.pkg安装了
macOS_SDK_headers_,我发现可能需要它

我非常感谢任何关于我可能做错了什么的线索或提示,或者任何其他可以解决问题的方法


谢谢

经过一番努力,我最终将旧数据库与以下内容一起转储:

pg_dumpall > /tmp/my_databases.sql
然后安装新的Postgres并使用以下方法将所有数据恢复到新版本:

psql -f /tmp/my_databases.sql

我希望它将来能帮助其他人。

你有没有在StackOverflow之外偶然得到过这个答案?在经历了同样的步骤之后,我遇到了同样的问题。@mattdeboard刚刚在下面报告。希望这对你有用!
psql -f /tmp/my_databases.sql