wal2json icon indicating copy to clipboard operation
wal2json copied to clipboard

Unable to compile wal2json on Mac M1

Open mr-nano opened this issue 1 year ago • 1 comments

I'm trying to compile wal2json on Mac M1 (commit - 75629c2e1e81a12350cc9d63782fc53252185d8d ) with pg_conf as:

BINDIR = /Users/USER/anaconda3/bin
DOCDIR = /Users/USER/anaconda3/share/doc
HTMLDIR = /Users/USER/anaconda3/share/doc
INCLUDEDIR = /Users/USER/anaconda3/include
PKGINCLUDEDIR = /Users/USER/anaconda3/include
INCLUDEDIR-SERVER = /Users/USER/anaconda3/include/server
LIBDIR = /Users/USER/anaconda3/lib
PKGLIBDIR = /Users/USER/anaconda3/lib
LOCALEDIR = /Users/USER/anaconda3/share/locale
MANDIR = /Users/USER/anaconda3/share/man
SHAREDIR = /Users/USER/anaconda3/share
SYSCONFDIR = /Users/USER/anaconda3/etc
PGXS = /Users/USER/anaconda3/lib/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--prefix=/Users/USER/anaconda3' '--with-readline' '--with-libraries=/Users/USER/anaconda3/lib' '--with-includes=/Users/USER/anaconda3/include' '--with-openssl' '--with-gssapi' 'PG_SYSROOT=undefined' 'build_alias=arm64-apple-darwin20.0.0' 'host_alias=arm64-apple-darwin20.0.0' 'CC=arm64-apple-darwin20.0.0-clang' 'CFLAGS=-ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /Users/USER/anaconda3/include -fdebug-prefix-map=/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_e997o28lzi/croot/postgresql-split_1687380402610/work=/usr/local/src/conda/postgresql-split-12.15 -fdebug-prefix-map=/Users/USER/anaconda3=/usr/local/src/conda-prefix' 'LDFLAGS=-Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/Users/USER/anaconda3/lib -L/Users/USER/anaconda3/lib' 'CPPFLAGS=-D_FORTIFY_SOURCE=2 -isystem /Users/USER/anaconda3/include -mmacosx-version-min=11.1' 'CXX=' 'CLANG=arm64-apple-darwin20.0.0-clang' 'PKG_CONFIG_PATH=/Users/USER/anaconda3/lib/pkgconfig'
CC = arm64-apple-darwin20.0.0-clang
CPPFLAGS = -D_FORTIFY_SOURCE=2 -isystem /Users/USER/anaconda3/include -mmacosx-version-min=11.1 -I/Users/USER/anaconda3/include
CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /Users/USER/anaconda3/include -fdebug-prefix-map=/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_e997o28lzi/croot/postgresql-split_1687380402610/work=/usr/local/src/conda/postgresql-split-12.15 -fdebug-prefix-map=/Users/USER/anaconda3=/usr/local/src/conda-prefix
CFLAGS_SL =
LDFLAGS = -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/Users/USER/anaconda3/lib -L/Users/USER/anaconda3/lib -L/Users/USER/anaconda3/lib -Wl,-dead_strip_dylibs
LDFLAGS_EX =
LDFLAGS_SL =
LIBS = -lpgcommon -lpgport -lssl -lcrypto -lgssapi_krb5 -lz -lreadline -lm
VERSION = PostgreSQL 12.15

And the clang -v results in

clang -v
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

The error becomes:

arm64-apple-darwin20.0.0-clang -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /Users/USER/anaconda3/include -fdebug-prefix-map=/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_e997o28lzi/croot/postgresql-split_1687380402610/work=/usr/local/src/conda/postgresql-split-12.15 -fdebug-prefix-map=/Users/USER/anaconda3=/usr/local/src/conda-prefix  -I. -I./ -I/Users/USER/anaconda3/include/server -I/Users/USER/anaconda3/include/internal  -D_FORTIFY_SOURCE=2 -isystem /Users/USER/anaconda3/include -mmacosx-version-min=11.1  -I/Users/USER/anaconda3/include  -c -o wal2json.o wal2json.c
make: arm64-apple-darwin20.0.0-clang: No such file or directory
make: *** [wal2json.o] Error 1

Can someone help how to fix this issue?

mr-nano avatar May 08 '24 17:05 mr-nano

PGXS uses the same compiler reported by CC in the pg_config output. You can specify your compiler using the following command:

# I'm assuming clang is in your PATH, if it is not, add the absolute path.
make CC=clang

eulerto avatar May 08 '24 19:05 eulerto