[FYI] cstore_fdw build on OSX El capitan.

104 views
Skip to first unread message

Hiroyuki Sato

unread,
Oct 19, 2015, 11:21:12 PM10/19/15
to cstore users
Hello 

I'm newbie about cstore_fdw.

I would like to share cstore_fdw build step on OSX El capitan.
I'm using PostgreSQL build by EnterpriseDB.


Thanks

--
Hiroyuki Sato.


## Build step



### install 

brew install protobuf-c
export PATH="/Library/PostgreSQL/9.4/bin:$PATH"
tar xvfz cstore_fdw-1.3.tar.gz
cd cstore_fdw-1.3
make CFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib"
sudo make install


### setup

Edit /Library/PostgreSQL/9.4/data/postgresql.conf
shared_preload_libraries = 'cstore_fdw'         # (change requires restart)


### restart 

sudo launchctl stop com.edb.launchd.postgresql-9.4
sudo launchctl start com.edb.launchd.postgresql-9.4 


## FYI make failed without CFLAGS and LDFLAGS

make
protoc-c --c_out=. cstore.proto
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -mmacosx-version-min=10.7 -arch i386 -arch x86_64  --std=c99 -I. -I./ -I/Library/PostgreSQL/9.4/include/postgresql/server -I/Library/PostgreSQL/9.4/include/postgresql/internal -I/opt/local/20140401/include/libxml2  -I/opt/local/Current/include/libxml2 -I/opt/local/Current/include  -c -o cstore.pb-c.o cstore.pb-c.c
clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk'
clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk'
In file included from cstore.pb-c.c:9:
./cstore.pb-c.h:7:10: fatal error: 'protobuf-c/protobuf-c.h' file not found
#include <protobuf-c/protobuf-c.h>
         ^
1 error generated.
make: *** [cstore.pb-c.o] Error 1

Murat Tuncer

unread,
Oct 20, 2015, 3:16:14 AM10/20/15
to Hiroyuki Sato, cstore users
Hello

There was a similar issue mentioned here. Could you check if it solves your problem ?


--
You received this message because you are subscribed to the Google Groups "cstore users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cstore-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Murat Tuncer
Software Engineer | Citus Data
mtu...@citusdata.com

Hiroyuki Sato

unread,
Oct 20, 2015, 4:00:13 AM10/20/15
to cstore users, hiro...@gmail.com
Hello Murat.

Thank you for your reply.

First of all, I succeed build cstore_cdw following steps.

brew install protobuf-c
export PATH="/Library/PostgreSQL/9.4/bin:$PATH"
tar xvfz cstore_fdw-1.3.tar.gz
cd cstore_fdw-1.3
make CFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib"
sudo make install

And I tried xcode-select --install and make cstore_cdw again.
But it does not fix problem.

It is need to Add CFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib"
But I don't know hot to do it.










2015年10月20日火曜日 16時16分14秒 UTC+9 Murat Tuncer:

Hiroyuki Sato

unread,
Oct 20, 2015, 4:34:43 AM10/20/15
to cstore users, hiro...@gmail.com
Hello Murat.


pg_config require /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk

But I don't install it.

So If I add Makefile -I"/usr/local/include" like the following.

  PG_CPPFLAGS = --std=c99 -I/usr/local/include

I got the following fatal error.

<asset.h> not found.

gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -mmacosx-version-min=10.7 -arch i386 -arch x86_64  --std=c99 -I/usr/local/include -I. -I./ -I/Library/PostgreSQL/9.4/include/postgresql/server -I/Library/PostgreSQL/9.4/include/postgresql/internal -I/opt/local/20140401/include/libxml2  -I/opt/local/Current/include/libxml2 -I/opt/local/Current/include  -c -o cstore.pb-c.o cstore.pb-c.c
clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk'
clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk'
In file included from cstore.pb-c.c:9:
In file included from ./cstore.pb-c.h:7:
/usr/local/include/protobuf-c/protobuf-c.h:199:10: fatal error: 'assert.h' file
      not found
#include <assert.h>
         ^
1 error generated.
make: *** [cstore.pb-c.o] Error 1


this is pg_config output


BINDIR = /Library/PostgreSQL/9.4/bin
DOCDIR = /Library/PostgreSQL/9.4/doc/postgresql
HTMLDIR = /Library/PostgreSQL/9.4/doc/postgresql
INCLUDEDIR = /Library/PostgreSQL/9.4/include
PKGINCLUDEDIR = /Library/PostgreSQL/9.4/include/postgresql
INCLUDEDIR-SERVER = /Library/PostgreSQL/9.4/include/postgresql/server
LIBDIR = /Library/PostgreSQL/9.4/lib
PKGLIBDIR = /Library/PostgreSQL/9.4/lib/postgresql
LOCALEDIR = /Library/PostgreSQL/9.4/share/locale
MANDIR = /Library/PostgreSQL/9.4/share/man
SHAREDIR = /Library/PostgreSQL/9.4/share/postgresql
SYSCONFDIR = /Library/PostgreSQL/9.4/etc/postgresql
PGXS = /Library/PostgreSQL/9.4/lib/postgresql/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--prefix=/mnt/hgfs/pginstaller.pune/server/staging/osx' '--with-ldap' '--with-openssl' '--with-perl' '--with-python' '--with-tcl' '--with-bonjour' '--with-pam' '--enable-thread-safety' '--with-libxml' '--with-uuid=e2fs' '--with-includes=/opt/local/Current/include/libxml2:/opt/local/Current/include:/opt/local/Current/include/security' '--docdir=/mnt/hgfs/pginstaller.pune/server/staging/osx/doc/postgresql' '--with-libxslt' '--with-libedit-preferred' '--with-gssapi' 'CFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -mmacosx-version-min=10.7 -arch i386 -arch x86_64' 'LDFLAGS=-L/opt/local/Current/lib'
CC = gcc
CPPFLAGS = -I/opt/local/20140401/include/libxml2 -I/opt/local/Current/include/libxml2 -I/opt/local/Current/include
CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -mmacosx-version-min=10.7 -arch i386 -arch x86_64
CFLAGS_SL = 
LDFLAGS = -L../../../src/common -L/opt/local/Current/lib -L/opt/local/20140401/lib -Wl,-dead_strip_dylibs
LDFLAGS_EX = 
LDFLAGS_SL = 
LIBS = -lpgcommon -lpgport -lxslt -lxml2 -lpam -lssl -lcrypto -lgssapi_krb5 -lz -ledit -lm 
VERSION = PostgreSQL 9.4.5





2015年10月20日火曜日 17時00分13秒 UTC+9 Hiroyuki Sato:

Murat Tuncer

unread,
Oct 20, 2015, 6:09:09 AM10/20/15
to cstore users
Hello Hiroyuki

you should not need to change CPP_FLAGS or LD_FLAGS.  My system has assert.h located under MacOSX10.11.sdk.

I suggest installing sdk for the same xcode that used to build enterprise db.  We are not testing cstore_fdw against enterprise db.

Could you temprorarily switch to stock postgresql which is known to work while we investigate the issue ?


Hiroyuki Sato

unread,
Oct 20, 2015, 6:37:44 AM10/20/15
to cstore users
Hello Murat.

Thank you for your reply. 

Unfortunately, It seems enterprisedb build on OSX 10.8 only.

I build cstore_cdw with postgresql(homebrew version)
I could build it without CFLAGS LDFLAGS modification.

Please upadate README.

Use postgresql(homebrew version)

Thanks.

brew install protobuf-c
brew install postgresql

export PATH="/usr/local/bin:$PATH"

which pg_config
/usr/local/bin/pg_config

tar xvfz cstore_fdw-1.3.tar.gz
cd cstore_fdw-1.3
make


2015年10月20日火曜日 19時09分09秒 UTC+9 Murat Tuncer:

Murat Tuncer

unread,
Oct 20, 2015, 7:56:53 AM10/20/15
to cstore users
thanks for the feedback.
Reply all
Reply to author
Forward
0 new messages