I'm attempting to compile the MySQL Foreign Data Wrapper for Postgresql 9.1+, on Ubuntu 12.04 LTS and having a fair bit of trouble getting it to work.
So far I've managed to use git to download the source from github, and based on the instructions add the following to my /etc/profile
path in the hopes that this thing will compile:
# ^ The rest of the file ^
# POSTGRESQL Environment Vars
export PGDATA="/usr/local/pgsql/data"
export PGHOST="localhost"
export PGPORT="5432"
export PGLOG="/var/log/pgsql"
export PATH=$PATH:/usr/lib/postgresql/9.1/bin:/opt/lampp/bin
I then per the documentation I ran
$ make USE_PGXS=1
gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -fPIC -DLINUX_OOM_ADJ=0 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -fpic -I/usr/include/mysql -I. -I. -I/usr/include/postgresql/9.1/server -I/usr/include/postgresql/internal -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include/tcl8.5 -c -o mysql_fdw.o mysql_fdw.c
mysql_fdw.c: In function ‘mysqlPlanForeignScan’:
mysql_fdw.c:467:8: warning: ‘rows’ may be used uninitialized in this function [-Wuninitialized]
gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -fPIC -DLINUX_OOM_ADJ=0 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -fpic -shared -o mysql_fdw.so mysql_fdw.o -L/usr/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -L/usr/lib/i386-linux-gnu -Wl,--as-needed -L/usr/lib/i386-linux-gnu -lmysqlclient -lpthread -lz -lm -lrt -ldl
And aside from the warning I suppose it compiled ok... Next I tried to install it, and I get a couple of errors about some missing files...
$ sudo make USE_PGPX=1 install
Makefile:35: ../../src/Makefile.global: No such file or directory
Makefile:36: /contrib/contrib-global.mk: No such file or directory
make: *** No rule to make target `/contrib/contrib-global.mk'. Stop.
Do I need to compile all of Postgres and include this extension in the source? Because the sources seem to be referring to a directory above the one that I'm in.
sudo
is changing the current working directory, orpg_config
isn't on your path as thesudo
'd user. Did you modify yourPATH
for your normal user?/etc/profile
for my system. That makes a difference I take it...even when I run withsudo
...?make
withsudo
and themake install
withsudo
.