citusdata / postgresql-hll

PostgreSQL extension adding HyperLogLog data structures as a native data type
http://blog.aggregateknowledge.com/2013/02/04/open-source-release-postgresql-hll/
Apache License 2.0
1.13k stars 116 forks source link

Compile error on Alpine 3.17 #141

Closed hbontempo-br closed 8 months ago

hbontempo-br commented 1 year ago

The extension is not compiling on Alpine 3.17

ARG POSTGRES_VERSION

FROM postgres:$POSTGRES_VERSION

ENV POSTGRES_PASSWORD postgres

RUN apk --update add --no-cache wget build-base postgresql-dev

WORKDIR /src

ARG HLL_VERSION
ARG SRC=postgresql-hll
RUN wget https://github.com/citusdata/postgresql-hll/archive/refs/tags/v${HLL_VERSION}.tar.gz -O ${SRC}.tar.gz && \
    mkdir ${SRC} && \
    tar xf ./${SRC}.tar.gz -C ${SRC} --strip-components 1
WORKDIR /src/${SRC}
RUN make
RUN make install
RUN echo "shared_preload_libraries = 'hll'" >> /usr/local/share/postgresql/postgresql.conf.sample
COPY hll_extension.sql /docker-entrypoint-initdb.d/

Build command:

docker build --no-cache --build-arg POSTGRES_VERSION=15-alpine3.17 --build-arg HLL_VERSION=2.17 .

Output:

...
 > [6/9] RUN make:                                                                                                                                                      
#9 0.126 gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -fPIC -std=c99 -fPIC -Wall -Wextra -Werror -Wno-unused-parameter -Wno-implicit-fallthrough -Iinclude -I/usr/local/include -I. -I./ -I/usr/local/include/postgresql/server -I/usr/local/include/postgresql/internal  -D_GNU_SOURCE -I/usr/include/libxml2   -c -o src/hll.o src/hll.c
#9 0.827 g++ -Wall -Wpointer-arith -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -O2 -fPIC -fPIC -Wall -Wextra -Werror -Wno-unused-parameter -Wno-implicit-fallthrough -Iinclude -I/usr/local/include -I. -I./ -I/usr/local/include/postgresql/server -I/usr/local/include/postgresql/internal  -D_GNU_SOURCE -I/usr/include/libxml2   -c -o src/MurmurHash3.o src/MurmurHash3.cpp
#9 0.999 gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -fPIC -shared -o hll.so src/hll.o src/MurmurHash3.o -L/usr/local/lib   -L/usr/lib/llvm15/lib  -L/usr/local/lib -Wl,--as-needed   -lstdc++
#9 1.023 cpp -undef -w -P -imacros /usr/local/include/postgresql/server/pg_config.h update/hll--2.10--2.11.sql > hll--2.10--2.11.sql
#9 1.038 cpp -undef -w -P -imacros /usr/local/include/postgresql/server/pg_config.h update/hll--2.10.sql > hll--2.10.sql
#9 1.049 cpp -undef -w -P -imacros /usr/local/include/postgresql/server/pg_config.h update/hll--2.11--2.12.sql > hll--2.11--2.12.sql
#9 1.059 cpp -undef -w -P -imacros /usr/local/include/postgresql/server/pg_config.h update/hll--2.12--2.13.sql > hll--2.12--2.13.sql
#9 1.069 cpp -undef -w -P -imacros /usr/local/include/postgresql/server/pg_config.h update/hll--2.13--2.14.sql > hll--2.13--2.14.sql
#9 1.078 cpp -undef -w -P -imacros /usr/local/include/postgresql/server/pg_config.h update/hll--2.14--2.15.sql > hll--2.14--2.15.sql
#9 1.089 cpp -undef -w -P -imacros /usr/local/include/postgresql/server/pg_config.h update/hll--2.15--2.16.sql > hll--2.15--2.16.sql
#9 1.098 cpp -undef -w -P -imacros /usr/local/include/postgresql/server/pg_config.h update/hll--2.16--2.17.sql > hll--2.16--2.17.sql
#9 1.108 /usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -Xclang -no-opaque-pointers -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -Wno-deprecated-non-prototype -O2  -fPIC -Wall -Wextra -Werror -Wno-unused-parameter -Wno-implicit-fallthrough -Iinclude -I/usr/local/include -I. -I./ -I/usr/local/include/postgresql/server -I/usr/local/include/postgresql/internal  -D_GNU_SOURCE -I/usr/include/libxml2  -flto=thin -emit-llvm -c -o src/hll.bc src/hll.c
#9 1.294 error: unknown warning option '-Wno-deprecated-non-prototype'; did you mean '-Wno-deprecated-coroutine'? [-Werror,-Wunknown-warning-option]
#9 1.294 error: unknown argument: '-no-opaque-pointers'
#9 1.304 make: *** [/usr/local/lib/postgresql/pgxs/src/makefiles/../../src/Makefile.global:1080: src/hll.bc] Error 1
...

By what I searched it is probably related to the substitution of clang version 13 used on Alpine 3.16 to version 15 on Alpine 3.17. Unfortunately I'm not very familiar with C so I didn't managed to go much further in my search.

Thanks in advance!