EnterpriseDB / mongo_fdw

PostgreSQL foreign data wrapper for MongoDB
GNU Lesser General Public License v3.0
326 stars 70 forks source link

compile error in ubuntu:14.04 #55

Closed lifubang closed 8 years ago

lifubang commented 8 years ago

After I run ./autogen --with-master, the commond make display some errors as follows:

root@937118f50889:~/mongo_fdw# ls CONTRIBUTING.md Makefile.legacy autogen.sh data json_compilation_error.patch mongo_fdw--1.0.sql mongo_fdw.h mongo_wrapper.c option.c LICENSE Makefile.meta config.h expected mongo-c-driver mongo_fdw.c mongo_query.c mongo_wrapper.h sql Makefile README.md connection.c json-c mongo-c-driver-1.3.1.tar.gz.1 mongo_fdw.control mongo_query.h mongo_wrapper_meta.c root@937118f50889:~/mongo_fdw# make -f Makefile.meta && make -f Makefile.meta install gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -fPIC -pie -I/usr/include/mit-krb5 -DLINUX_OOM_SCORE_ADJ=0 -fno-omit-frame-pointer -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -fpic --std=c99 -I/usr/local/include/libmongoc-1.0 -I/usr/local/include/libbson-1.0 -Ijson-c -DMETA_DRIVER -I. -I./ -I/usr/include/postgresql/9.3/server -I/usr/include/postgresql/internal -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include/tcl8.6 -c -o connection.o connection.c In file included from /usr/local/include/libbson-1.0/bson-compat.h:38:0, from /usr/local/include/libbson-1.0/bson.h:23, from mongo_fdw.h:23, from mongo_wrapper.h:20, from connection.c:21: /usr/local/include/libbson-1.0/bson-macros.h:212:23: error: expected '=', ',', ';', 'asm' or 'attribute' before 'inline'

define BSON_INLINE inline

                   ^

/usr/local/include/libbson-1.0/bson-decimal128.h:61:20: note: in expansion of macro 'BSON_INLINE' static _Decimal128 BSON_INLINE ^ In file included from /usr/local/include/libbson-1.0/bson.h:33:0, from mongo_fdw.h:23, from mongo_wrapper.h:20, from connection.c:21: /usr/local/include/libbson-1.0/bson-decimal128.h:71:32: error: unknown type name '_Decimal128' bson_Decimal128_to_decimal128 (_Decimal128 decimal128, ^ make: *\ [connection.o] Error 1 root@937118f50889:~/mongo_fdw#

jeffgrant commented 8 years ago

Not sure if you've found a solution, but this is what I did to get it to work. It seemed to be an issue with version upgrades in dependencies that broke backwards compatibility.

This works for me, your mileage may vary.

For: Linux vagrant-ubuntu-trusty-64 3.13.0-32-generic #57-Ubuntu SMP

sudo su - root

apt-get install -y postgresql-server-dev-9.5 git-core automake autoconf libtool gcc unzip pkg-config make

grep -q -F '/usr/local/lib' /etc/ld.so.conf || echo '/usr/local/lib' >> /etc/ld.so.conf

mkdir ~/temp

cd ~/temp
rm -Rf libbson
git clone git://github.com/mongodb/libbson.git
cd libbson/
git checkout tags/1.3.1
./autogen.sh
make
make install
ldconfig

cd ~/temp
rm -Rf mongo-c-driver
git clone https://github.com/mongodb/mongo-c-driver.git
cd mongo-c-driver
git checkout tags/1.3.5
./autogen.sh
./configure --with-libbson=/usr/local/lib
make
make install
ldconfig

cd ~/temp
rm -Rf mongo_fdw
git clone --recursive https://github.com/EnterpriseDB/mongo_fdw.git
cd mongo_fdw
./autogen.sh --with-master
ldconfig
make
make clean
make
make install

The last 4 make commands are legit... you build it once, it fails, you clean it, then you build it again, and it works. Don't know why, didn't have time to dig into it at all.

Hope that helps.

ahsanhadi commented 8 years ago

lifubang is it working for you now? Can i close this case?

lifubang commented 8 years ago

ok, thanks. But the process of compilation is very difficult. I think it's the problem of how to reference mongo-c-driver.