EnterpriseDB / mongo_fdw

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

installation problem in centos 7 - postgres 11.10 #140

Open ztiagoxbr opened 3 years ago

ztiagoxbr commented 3 years ago

upon completing the package installation, and running ''create extension mongo_fdw'' on postgres, the following error occurs:

ERROR: could not load library "/usr/pgsql-11/lib/mongo_fdw.so": /usr/pgsql-11/lib/mongo_fdw.so: undefined symbol: mongoc_collection_find_with_opts SQL state: XX000

vaibhavdalvi93 commented 3 years ago

Thanks @ztiagoxbr for reporting an issue.

Can you provide operating system and mongo_fdw version details? which will help us to investigate this issue further.

ztiagoxbr commented 3 years ago

@vaibhavdalvi93 for sure, the information is as follows:

CentOS Linux release 7.7.1908 (Core) mongo_fdw is in the latest version, I use it using git clone https://github.com/EnterpriseDB/mongo_fdw.git PostgreSQL 11.10 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39), 64-bit

vaibhavdalvi93 commented 3 years ago

Thanks for the information.

Have you did mongo_fdw installation through recently released RPM or downloaded source from HEAD and compiled the source by your own? If you did source compilation then you have used "autogen.sh --with-master" script?

I am asking this because released version has mongo-c-driver(mongo client) version 1.9.5 where HEAD has 1.17.3.

ztiagoxbr commented 3 years ago

that's right, i compiled it using "autogen.sh --with-master"

however the driver was installed, along with the following items: cmake3, gcc, gcc-c++, openssl-devel cyrus-sasl-devel, pkgconfig, mongo-c-driver, mongo-c-driver-devel, mongo-c-driver-libs, libbson, libbson-devel, git, postgresql-common, epel-release-latest-7.noarch.rpm, centos-release-scl, postgresql11-devel, git gcc automake autoconf libtool.

and the command to download the mongo_fdw package: git clone https://github.com/EnterpriseDB/mongo_fdw.git --recursive

vaibhavdalvi93 commented 3 years ago

Thanks.

I think you are using old version of driver which don't have "mongoc_collection_find_with_opts" defined in it. I mean you are using old shared library available in /usr/local/lib.

What is "LD_LBRARY_PATH" set when you started the postgres server?

The environment variable LD_LIBRARY_PATH should have "/usr/local/lib64" path because this location contains required latest driver library i.e. libmongoc.so. After setting this variable, start the postgres server. With the latest changes, mongoc driver and bson libraries gets stored in "/usr/local/lib64" location.

This may resolve your problem.

ztiagoxbr commented 3 years ago

I managed to solve this problem by declaring this value, but now another one appears to me.

could not load library "/usr/pgsql-11/lib/mongo_fdw.so": /usr/local/lib64/libmongoc-1.0.so.0: version `LIBMONGOC_1.0' not found (required by /usr/pgsql-11/lib/mongo_fdw.so)

rajkumarraghuwanshi commented 3 years ago

Could you provide some more information so we can debug it more.

  1. can you confirm if you installed postgresql11 using yum packages.
  2. did you get any error while compiling mongo_fdw sources.
  3. current libmongo-c driver version (cat mongo_fdw/mongo-c-driver/VERSION_CURRENT).
  4. output of ldd /usr/pgsql-11/lib/mongo_fdw.so
ztiagoxbr commented 3 years ago

1 - yes, the installation was done through the yum repository

2 - from what I saw, then do a compilation it returns this following error:

src/mongoc/mongoc-read-prefs.c: In function 'mongoc_read_prefs_set_mode': src/mongoc/mongoc-read-prefs.c:49:4: warning: implicit declaration of function 'bson_return_if_fail' [-Wimplicit-function-declaration] bson_return_if_fail(read_prefs); ^ CC src/mongoc/libmongoc_1_0_la-mongoc-write-command.lo CC src/mongoc/libmongoc_1_0_la-mongoc-rand.lo CC src/mongoc/libmongoc_1_0_la-mongoc-scram.lo CC src/mongoc/libmongoc_1_0_la-mongoc-stream-tls.lo src/mongoc/mongoc-stream-tls.c: In function '_mongoc_stream_tls_check_closed': src/mongoc/mongoc-stream-tls.c:830:4: warning: implicit declaration of function 'bson_return_val_if_fail' [-Wimplicit-function-declaration] bson_return_val_if_fail(stream, -1); ^ CC src/mongoc/libmongoc_1_0_la-mongoc-ssl.lo CC src/mongoc/libmongoc_1_0_la-mongoc-sasl.lo CCLD libmongoc-1.0.la CC tests/test_load-test-load.o CCLD test-load ./.libs/libmongoc-priv.so: undefined reference to bson_return_if_fail' ./.libs/libmongoc-priv.so: undefined reference tobson_return_val_if_fail' collect2: error: ld returned 1 exit status make[1]: ** [test-load] Erro 1

3- 1.17.3

  1. result below: linux-vdso.so.1 => (0x00007ffcc4bf8000) libmongoc-1.0.so.0 => /lib64/libmongoc-1.0.so.0 (0x00007f5bfc7a8000) libbson-1.0.so.0 => /lib64/libbson-1.0.so.0 (0x00007f5bfc574000) libc.so.6 => /lib64/libc.so.6 (0x00007f5bfc1a6000) /lib64/ld-linux-x86-64.so.2 (0x00007f5bfcc11000) librt.so.1 => /lib64/librt.so.1 (0x00007f5bfbf9e000) libssl.so.10 => /lib64/libssl.so.10 (0x00007f5bfbd2c000) libcrypto.so.10 => /lib64/libcrypto.so.10 (0x00007f5bfb8c9000) libsasl2.so.3 => /lib64/libsasl2.so.3 (0x00007f5bfb6ac000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f5bfb490000) libm.so.6 => /lib64/libm.so.6 (0x00007f5bfb18e000) libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007f5bfaf41000) libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007f5bfac58000) libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007f5bfaa54000) libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007f5bfa821000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f5bfa61d000) libz.so.1 => /lib64/libz.so.1 (0x00007f5bfa407000) libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f5bfa1ed000) libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f5bf9fb6000) libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007f5bf9da6000) libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007f5bf9ba2000) libfreebl3.so => /lib64/libfreebl3.so (0x00007f5bf999f000) libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f5bf9778000) libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f5bf9516000)
vaibhavdalvi93 commented 3 years ago

Thanks for more information.

Looks like you have installed mongoc-driver separately.

Please note that you don't need to install mongoc driver separately. The script "autogen.sh --with-master" do take care of building and installing driver as well.

Please follow below steps: Download source code, run autogen.sh script(--with-master), Set LD_LIBRAY_PATH to '/usr/local/lib64' and then compile and install mongo_fdw code.

Before all this please remove all older mongoc driver libraries from your machine.

Hope, this helps.

ztiagoxbr commented 3 years ago

I removed all installations of the mongoc driver but now I get this error when running ./autogen.sh --with-master

2021-01-21 09:14:40 (609 KB/s) - “json-c-0.15-20200726.tar.gz” salvo [348261]

/home/user/mongo_fdw ./autogen.sh: line 80: cmake3: comando não encontrado make: Sem regra para processar o alvo `install'. Pare. ./autogen.sh: line 69: cmake3: comando não encontrado make: Sem regra para processar o alvo `install'. Pare. Done

vaibhavdalvi93 commented 3 years ago

Looks like cmake3 is not installed on your machine. Please install it to make this work.

ztiagoxbr commented 3 years ago

but cmake3 is installed

The cmake3-3.17.5-1.el7.x86_64 package is already installed in its latest version

rajkumarraghuwanshi commented 3 years ago

May be it’s picking default cmake instead of cmake3 while installing. Check with cmake —version. You can create symbolic link with cmake3 to cmake and then try.

On Mon, 25 Jan 2021 at 5:26 PM, ztiagoxbr notifications@github.com wrote:

but cmake3 is installed

The cmake3-3.17.5-1.el7.x86_64 package is already installed in its latest version

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/EnterpriseDB/mongo_fdw/issues/140#issuecomment-766765433, or unsubscribe https://github.com/notifications/unsubscribe-auth/AR3NDTNCLIZZT5P6YJC2DJ3S3VMAHANCNFSM4WEQ3AIQ .

-- Thanks & Regards, Rajkumar Raghuwanshi

vaibhavdalvi93 commented 2 years ago

Hi @ztiagoxbr ,

Could you please check if you're still facing reported issue?