how to build pipeline_kafka extension - postgresql

i'm currently trying to compile the pipeline_kafka extension from Github to add it to my pipelinedb instance but i'm running in a problem neither i nor google seems to be able to solve.
when i execute make command i get the following error
stc#vm:~/pipeline_kafka$ make gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -I/usr/include/mit-krb5 -fPIC -pie -DLINUX_OOM_SCORE_ADJ=0 -fno-omit-frame-pointer -fpic -I. -I./ -I/usr/include/postgresql/9.4/server -I/usr/include/postgresql/internal -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include/tcl8.6 -c -o pipeline_kafka.o pipeline_kafka.c pipeline_kafka.c:23:40: fatal error: catalog/pipeline_stream_fn.h: No such file or directory #include "catalog/pipeline_stream_fn.h" ^ compilation terminated. : recipe for target 'pipeline_kafka.o' failed make: *** [pipeline_kafka.o] Error 1
does anyone has an idea what to do? I'm running on debian 8.
Does anyone know why this extension is not part of pipelinedb anymore?
cheers and thanks in advance

the reason for the error is my entire approach towards using/installing pipelinedb and pipeline_kafka.
the following script worked for me on a standard Debian 8 installation. Maybe it helps.
Download and install PipelineDB
wget -O pipelinedb_install_package "https://www.pipelinedb.com/download/0.9.1/debian8"
sudo dpkg -i pipelinedb_install_package
mkdir ~/logs
pipeline-init -D ~/data/pipelinedb
pipeline-ctl -D ~/data/pipelinedb -l ~/logs/pipelinedb.log start
sleep 5.0
pipeline pipeline
Download and install pipeline_kafka extension
sudo apt-get install git gcc g++ zlib1g-dev
mkdir ~/git
git clone https://github.com/edenhill/librdkafka.git ~/git/librdkafka
git clone https://github.com/pipelinedb/pipeline_kafka.git >~/git/pipeline_kafka
cd ~/git/librdkafka
./configure --prefix=/usr
make
sudo make install
cd ~/git/pipeline_kafka
./configure
make
sudo make install
pipeline pipeline -c "CREATE EXTENSION pipeline_kafka;"
sed -i 's/#shared_preload_libraries/shared_preload_libraries/' ~/data/pipelinedb/pipelinedb.conf
sed -i "s/shared_preload_libraries = ''/shared_preload_libraries=pipeline_kafka/" ~/data/pipelinedb/pipelinedb.conf

Related

Unable to setup pg_repack in ubuntu22.04.1 LTS

I want to perform pg_repack in remote postgres server. pg_repack is used to remove bloat from PostgreSQL.
I am following this for reference: https://reorg.github.io/pg_repack/#installation
After installing pgxn, we need to install pg_repack. It's done by
sudo pgxn install pg_repack
And it's resulting in this
INFO: best version: pg_repack 1.4.8
INFO: saving /tmp/tmp3dyb4e3e/pg_repack-1.4.8.zip
INFO: unpacking: /tmp/tmp3dyb4e3e/pg_repack-1.4.8.zip
INFO: building extension
gmake[1]: Entering directory '/tmp/tmp3dyb4e3e/pg_repack-1.4.8/bin'
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 -g -g -O2 -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -I/usr/include/postgresql -DREPACK_VERSION=1.4.8 -I. -I./ -I/usr/include/postgresql/14/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -c -o pg_repack.o pg_repack.c
gmake[1]: gcc: No such file or directory
gmake[1]: *** [<builtin>: pg_repack.o] Error 127
gmake[1]: Leaving directory '/tmp/tmp3dyb4e3e/pg_repack-1.4.8/bin'
gmake: *** [Makefile:35: all] Error 2
ERROR: command returned 2: gmake PG_CONFIG=/usr/bin/pg_config all`
I tried to clone this repo and perform gmake on it directly
gmake PG_CONFIG=/pg_config all
but still I'm getting
gmake: *** No rule to make target 'all'. Stop.

Compiling psqlODBC on CENTOS 7 gives me errors in connection.c - undeclared identifiers

So i'm stuck again.
What I want to do: access a postgreSQL database via database link from Oracle (12.1 - yes, I know it's old ...).
Oracle is running on Centos 7.
Initially I did a
yum -y install postgresql-odbc
yum -y install unixODBC
and was able to access postgreSQL (running on another machine).
But it didn't work for UTF-8 data. Got a hint that this might be due to an old version of unixODBC so I decided to compile from source (as the centos package is rather old).
Compiling and installing unixODBC worked without a hassle:
wget http://www.unixodbc.org/unixODBC-2.3.11.tar.gz
tar xzf unixODBC-2.3.11.tar.gz
cd unixODBC-2.3.11/
./configure
make
make install
But compiling psqlODBC is where it's at:
yum install postgresql
yum install postgresql-devel
wget https://ftp.postgresql.org/pub/odbc/versions/src/psqlodbc-13.02.0000.tar.gz
cd psqlodbc-13.02.0000/
./configure
make
...
Make gives me the following output:
[root#tukanbox psqlodbc-13.02.0000]# make
make all-am
make[1]: Entering directory `/root/psqlodbc-13.02.0000'
/bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I/usr/local/include -I/usr/include -I/usr/include/pgsql/internal -DUNICODE_SUPPORT -g -O2 -Wall -MT psqlodbcw_la-connection.lo -MD -MP -MF .deps/psqlodbcw_la-connection.Tpo -c -o psqlodbcw_la-connection.lo `test -f 'connection.c' || echo './'`connection.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I/usr/local/include -I/usr/include -I/usr/include/pgsql/internal -DUNICODE_SUPPORT -g -O2 -Wall -MT psqlodbcw_la-connection.lo -MD -MP -MF .deps/psqlodbcw_la-connection.Tpo -c connection.c -fPIC -DPIC -o .libs/psqlodbcw_la-connection.o
connection.c: In function 'handle_pgres_error':
connection.c:900:45: error: 'PG_DIAG_SCHEMA_NAME' undeclared (first use in this function)
errschemaname = PQresultErrorField(pgres, PG_DIAG_SCHEMA_NAME);
^
connection.c:900:45: note: each undeclared identifier is reported only once for each function it appears in
connection.c:901:44: error: 'PG_DIAG_TABLE_NAME' undeclared (first use in this function)
errtablename = PQresultErrorField(pgres, PG_DIAG_TABLE_NAME);
^
connection.c:902:45: error: 'PG_DIAG_COLUMN_NAME' undeclared (first use in this function)
errcolumnname = PQresultErrorField(pgres, PG_DIAG_COLUMN_NAME);
^
connection.c:903:47: error: 'PG_DIAG_DATATYPE_NAME' undeclared (first use in this function)
errdatatypename = PQresultErrorField(pgres, PG_DIAG_DATATYPE_NAME);
^
make[1]: *** [psqlodbcw_la-connection.lo] Fehler 1
make[1]: Leaving directory `/root/psqlodbc-13.02.0000'
make: *** [all] Fehler 2
Wondering where to declare these undeclared idenifiers. What does it want to know here? How to solve it?
No answer to the problem of not being able to compile - but an answer to the original problem that the original packages didn't work for UTF8:
https://www.postgresql.org/message-id/OFA166DBFD.19742AF7-ONC1257B6A.005692E6-C1257B6A.0056F890#lladro.net
This has to be done in the database as sysdba:
select fds_class_name from HS_FDS_CLASS;
select * from hs_class_caps where upper(CAP_DESCRIPTION) like '%NCHAR%' and FDS_CLASS_NAME ='ODBC12.1.0.1.0_0017';
exec DBMS_HS.ALTER_CLASS_CAPS('ODBC12.1.0.1.0_0017' , 564, 'ODBC12.1.0.1.0_0017', 564,131071, NULL, NULL);

MySQL Workbench for PostgreSQL - ./psqlodbc.h:41:10: fatal error: 'sql.h' file not found

I am trying to connect to a Postgres db trough MySQL Workbench.
Following the documentation we need to install a driver for psql in our machine.
I am running a MacOS Big Sur 11.2.3.
After run CFLAGS="-arch i386 -arch x86_64" make I'm getting the following error:
/Library/Developer/CommandLineTools/usr/bin/make all-am
source='info.c' object='info.lo' libtool=yes \
depfile='.deps/info.Plo' tmpdepfile='.deps/info.TPlo' \
depmode=gcc3 /bin/sh ./depcomp \
/bin/sh ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -c -o info.lo `test -f 'info.c' || echo './'`info.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -c info.c -MT info.lo -MD -MP -MF .deps/info.TPlo -fno-common -DPIC -o info.lo
In file included from info.c:19:
./psqlodbc.h:41:10: fatal error: 'sql.h' file not found
#include <sql.h>
^~~~~~~
1 error generated.
make[1]: *** [info.lo] Error 1
make: *** [all] Error 2
It seems that the 'sql.h' file is not found.
How to solve this issue?

Install postgres extension PGXN "fatal error: unistd.h: No such file or directory"

I need to sync some postgres tables with elasticsearch and come to conclusion that the best solution for my case is the one described here. Unfortunately I'm still failing to install required postgres extension amqp.
I use docker so I start from image postgres:13-alpine.
Here is how my Dockerfile looks like so far:
FROM postgres:13-alpine
ENV POSTGRES_DB ''
ENV POSTGRES_USER ''
ENV POSTGRES_PASSWORD ''
RUN apk update \
&& apk add py-pip make gcc \
&& pip install pgxnclient
Then when you enter the container and try to run pgxn install pg_amqp you will get following error.
bash-5.1# pgxn install pg_amqp
INFO: best version: pg_amqp 0.3.0
INFO: saving /tmp/tmpgjtefhgh/pg_amqp-0.3.0.zip
INFO: unpacking: /tmp/tmpgjtefhgh/pg_amqp-0.3.0.zip
INFO: building extension
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -fPIC -I. -I./ -I/usr/local/include/postgresql/server -I/usr/local/include/postgresql/internal -D_GNU_SOURCE -I/usr/include/libxml2 -c -o src/pg_amqp.o src/pg_amqp.c
src/pg_amqp.c:36:10: fatal error: unistd.h: No such file or directory
36 | #include <unistd.h>
| ^~~~~~~~~~
compilation terminated.
make: *** [<builtin>: src/pg_amqp.o] Error 1
ERROR: command returned 2: make PG_CONFIG=/usr/local/bin/pg_config all
It seems that I am out of the ideas what to do with that. Any help?
You are missing the musl C library (libc) implementation: musl-dev
RUN apk update \
&& apk add py-pip make gcc musl-dev \
&& pip install pgxnclient

Installing B::C with cpanm hangs?

When I install B::C with cpanm, it hangs
$ sudo cpanm B::C
--> Working on B::C
Fetching http://www.cpan.org/authors/id/R/RU/RURBAN/B-C-1.57.tar.gz ... OK
Configuring B-C-1.57 ... OK
Building and testing B-C-1.57 ... ^C
First you'll want to try to check the install by using the verbose flag cpanm -v B::C, after which you should see a lot of looping like
x86_64-linux-gnu-gcc -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib/x86_64-linux-gnu/perl/5.28/CORE -o cccode1_o1 cccode1_o1.c -Wl,-E -fstack-protector-strong -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/perl/5.28/CORE -lperl -ldl -lm -lpthread -lc -lcrypt 2>/dev/null 2>&1
# /usr/bin/ld: cannot find -lperl
collect2: error: ld returned 1 exit status
This is because ld can't find libperl.so. If you're on Debian you'll need to run,
sudo apt install libperl-dev