EnterpriseDB / mongo_fdw

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

Compilation errors #78

Closed dtheodor closed 7 years ago

dtheodor commented 7 years ago

Trying to compile on CentOS Linux release 7.3.1611 (Core) with postgres 9.6.2

When running ./autogen.sh --with-legacy I'm running into a json-c compilation error caused by this issue https://github.com/json-c/json-c/issues/159.

I updated json-c to 0.12.1 which fixes it. Now, when running PATH=/usr/pgsql-9.6/bin/:$PATH make I'm running into

gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -DLINUX_OOM_ADJ=0 -fpic -shared -o mongo_fdw.so connection.o option.o  mongo_wrapper.o mongo_fdw.o mongo_query.o mongo-c-driver/src/bson.os mongo-c-driver/src/encoding.os mongo-c-driver/src/md5.os mongo-c-driver/src/mongo.os mongo-c-driver/src/numbers.os mongo-c-driver/src/env.os json-c/json_util.o json-c/json_object.o json-c/json_tokener.o json-c/json_object_iterator.o json-c/printbuf.o json-c/linkhash.o json-c/arraylist.o json-c/random_seed.o json-c/debug.o -L/usr/pgsql-9.6/lib -Wl,--as-needed  -L/usr/lib64 -Wl,--as-needed -Wl,-rpath,'/usr/pgsql-9.6/lib',--enable-new-dtags
/bin/ld: json-c/json_util.o: relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
json-c/json_util.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [mongo_fdw.so] Error 1
gabbasb commented 7 years ago

clean your build, recompile after export CPPFLAGS=-fPIC and it should work fine.

dtheodor commented 7 years ago

yea, after a make clean it worked

dtheodor commented 7 years ago

Should we add the full compilation/install instructions in the main readme, I found them only by searching in the repo issues and in readmes of past versions. Something like:

Make sure pg_config is in your PATH, and you are running as root

./autogen.sh --with-legacy
make
make install
gabbasb commented 7 years ago

Why not, could you please open a new issue to track that readme change.

dtheodor commented 7 years ago

Ok https://github.com/EnterpriseDB/mongo_fdw/issues/80