Open dtrejod opened 5 years ago
I fully agree with @dtrejod, there should be built packages available as RPM (RedHat/CentOS) and DLL (Windows) for Prometheus. Docker images alone will not suffice for all use cases.
Make somehow fails for me as well. I will post the error here as well.
When I build from source on Centos , there is always failed , is there any prebuild bianary or good tested build script for us , though it's open source pain
my go version is 1.11.3 my PostgreSQLversion is 11 The bellow is what I met. first build prometheus-postgresql-adapter need go lint https://golang.github.io/dep/docs/installation.html
go get -d -u github.com/golang/dep
cd $(go env GOPATH)/src/github.com/golang/dep
DEP_LATEST=$(git describe --abbrev=0 --tags)
git checkout $DEP_LATEST
go install -ldflags="-X main.version=$DEP_LATEST" ./cmd/dep
git checkout master
then build prometheus-postgresql-adapter again
# Install dependencies (only required once)
dep ensure
# Build binary
make
next , build pg_prometheus , the error messages tip need llvm on centos7 so I have to install it
yum install devtoolset-7
yum install llvm-toolset-7
then make success , but make install pg_prometheus failed
[root@vultr pg_prometheus]# make
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC -DINCLUDE_PACKAGE_SUPPORT=0 -MMD -I. -I./ -I/usr/pgsql-11/include/server -I/usr/pgsql-11/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -c -o src/prom.o src/prom.c
src/prom.c: In function ‘prom_construct’:
src/prom.c:407:2: warning: implicit declaration of function ‘PG_GETARG_JSONB’ [-Wimplicit-function-declaration]
Jsonb *jb = PG_GETARG_JSONB(3);
^
src/prom.c:407:17: warning: initialization makes pointer from integer without a cast [enabled by default]
Jsonb *jb = PG_GETARG_JSONB(3);
^
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC -DINCLUDE_PACKAGE_SUPPORT=0 -MMD -I. -I./ -I/usr/pgsql-11/include/server -I/usr/pgsql-11/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -c -o src/parse.o src/parse.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC -DINCLUDE_PACKAGE_SUPPORT=0 -MMD -I. -I./ -I/usr/pgsql-11/include/server -I/usr/pgsql-11/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -c -o src/utils.o src/utils.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC -DINCLUDE_PACKAGE_SUPPORT=0 -MMD -shared -o pg_prometheus.so src/prom.o src/parse.o src/utils.o -L/usr/pgsql-11/lib -Wl,--as-needed -L/usr/lib64/llvm5.0/lib -L/usr/lib64 -Wl,--as-needed -Wl,-rpath,'/usr/pgsql-11/lib',--enable-new-dtags
/opt/rh/llvm-toolset-7/root/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2 -I. -I./ -I/usr/pgsql-11/include/server -I/usr/pgsql-11/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o src/prom.bc src/prom.c
src/prom.c:407:17: warning: implicit declaration of function 'PG_GETARG_JSONB' is invalid in C99 [-Wimplicit-function-declaration]
Jsonb *jb = PG_GETARG_JSONB(3);
^
src/prom.c:407:12: warning: incompatible integer to pointer conversion initializing 'Jsonb *' with an expression of type 'int' [-Wint-conversion]
Jsonb *jb = PG_GETARG_JSONB(3);
^ ~~~~~~~~~~~~~~~~~~
2 warnings generated.
/opt/rh/llvm-toolset-7/root/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2 -I. -I./ -I/usr/pgsql-11/include/server -I/usr/pgsql-11/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o src/parse.bc src/parse.c
/opt/rh/llvm-toolset-7/root/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2 -I. -I./ -I/usr/pgsql-11/include/server -I/usr/pgsql-11/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o src/utils.bc src/utils.c
[root@vultr pg_prometheus]# make install
/usr/bin/mkdir -p '/usr/pgsql-11/lib'
/usr/bin/mkdir -p '/usr/pgsql-11/share/extension'
/usr/bin/mkdir -p '/usr/pgsql-11/share/extension'
/usr/bin/install -c -m 755 pg_prometheus.so '/usr/pgsql-11/lib/pg_prometheus.so'
/usr/bin/install -c -m 644 .//pg_prometheus.control '/usr/pgsql-11/share/extension/'
/usr/bin/install -c -m 644 .//sql/pg_prometheus--0.2.1.sql '/usr/pgsql-11/share/extension/'
/usr/bin/mkdir -p '/usr/pgsql-11/lib/bitcode/pg_prometheus'
/usr/bin/mkdir -p '/usr/pgsql-11/lib/bitcode'/pg_prometheus/src/
/usr/bin/install -c -m 644 src/prom.bc '/usr/pgsql-11/lib/bitcode'/pg_prometheus/src/
/usr/bin/install -c -m 644 src/parse.bc '/usr/pgsql-11/lib/bitcode'/pg_prometheus/src/
/usr/bin/install -c -m 644 src/utils.bc '/usr/pgsql-11/lib/bitcode'/pg_prometheus/src/
cd '/usr/pgsql-11/lib/bitcode' && /usr/lib64/llvm5.0/bin/llvm-lto -thinlto -thinlto-action=thinlink -o pg_prometheus.index.bc pg_prometheus/src/prom.bc pg_prometheus/src/parse.bc pg_prometheus/src/utils.bc
/bin/sh: /usr/lib64/llvm5.0/bin/llvm-lto: No such file or directory
make: *** [install] Error 127
You can make this, under sudo:
mkdir -p /usr/lib64/llvm5.0 \ mkdir -p /usr/lib64/llvm5.0/bin \ cd /usr/lib64/llvm5.0/bin \ ln -s /opt/rh/llvm-toolset-7/root/usr/bin/llvm-lto
then make install
and build will be installed. Was built and tested with pgsql11, centos7.
Currently
make package
fails due to missing pg_prometheus.soConsider changing -- https://github.com/timescale/pg_prometheus/blob/5ac6ef8a485004a0f521498b3348b91cf454bf64/Makefile#L63 to:
Additional question -- Is there a pre-built version
pg_prometheus
available? Was looking specifically for a RPM and not the docker image.