Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
    
And if this belongs in the DBA stack exchange feel free to send it over there. –  leeand00 May 5 at 20:26
    
Looks like sudo is changing the current working directory, or pg_config isn't on your path as the sudo'd user. Did you modify your PATH for your normal user? –  Craig Ringer May 6 at 0:11
    
Nope just my /etc/profile for my system. That makes a difference I take it...even when I run with sudo...? –  leeand00 May 6 at 0:34
    
hmm I ran the initial make with sudo and the make install with sudo. –  leeand00 May 6 at 0:46

1 Answer 1

up vote 1 down vote accepted

It's a typo.

sudo make USE_PGPX=1 install
              ^^^^
              PGXS
share|improve this answer
    
What's the USE_PGPX var for anyway? –  leeand00 May 6 at 2:00
1  
It enables out-of-tree extension compilation using the PG extension building tool. See postgresql.org/docs/current/static/extend-pgxs.html –  Craig Ringer May 6 at 3:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.