EnterpriseDB / mongo_fdw

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

Create extension causes error #134

Closed AllHailTheHypnotoad closed 4 years ago

AllHailTheHypnotoad commented 4 years ago

No issues compiling with autogen and the control and sql files all ended up in their proper locations under PostgreSQL extensions along with my other FDW extensions.

However, when I ran CREATE EXTENSION mongo_fdw I received the following error below.
_SQL Error [58P01]: ERROR: could not access file "$libdir/mongofdw": No such file or directory.

Here is where the sql and control files dropped to (where I have many other extensions):

[root@hypnotoad mongo_fdw]# cd /usr/pgsql-11/share/extension/ [root@hypnotoad extension]# ll mongo. -rw-r--r--. 1 root root 157 May 15 23:01 mongo_fdw--1.0--1.1.sql -rw-r--r--. 1 root root 592 May 15 23:01 mongo_fdw--1.0.sql -rw-r--r--. 1 root root 708 May 15 23:01 mongo_fdw--1.1.sql -rw-r--r--. 1 root root 273 May 15 23:01 mongo_fdw.control -rw-r--r--. 1 root root 7107 May 15 23:06 mongo_fdw.sql [root@hypnotoad extension]#

Any ideas to help me fix this issue? Happens when I tried legacy and master builds on different servers one with PostgreSQL 12 and the other with PostgreSQL 11

andreasscherbaum commented 4 years ago

What is the output of:

pg_config --version
pg_config --libdir
pg_config --sharedir

On both the host you are building and running PostgreSQL.

AllHailTheHypnotoad commented 4 years ago

I tried on Postgres11 this time, here is the output of the commands:

[root@hypnotoad mongo_fdw-master]# /usr/pgsql-11/bin/pg_config --version PostgreSQL 11.4 [root@hypnotoad mongo_fdw-master]# /usr/pgsql-11/bin/pg_config --libdir /usr/pgsql-11/lib [root@hypnotoad mongo_fdw-master]# /usr/pgsql-11/bin/pg_config --sharedir /usr/pgsql-11/share

What is the output of:

pg_config --version
pg_config --libdir
pg_config --sharedir

On both the host you are building and running PostgreSQL.

andreasscherbaum commented 4 years ago

On both hosts ... or both installations. And this is not the pg_config you are using to compile the extension, right?

AllHailTheHypnotoad commented 4 years ago

Here is the other machine. There is only one pg_config on the 12 and 11 servers:

[root@bender~]# find / -name "pg_config" -print /usr/pgsql-12/bin/pg_config [root@bender~]# /usr/pgsql-12/bin/pg_config --version PostgreSQL 12.1 [root@bender~]# /usr/pgsql-12/bin/pg_config --libdir /usr/pgsql-12/lib [root@bender~]# /usr/pgsql-12/bin/pg_config --sharedir /usr/pgsql-12/share [root@bender~]#

AllHailTheHypnotoad commented 4 years ago

Another note:

When I build oracle_fdw, it drops the libraries in the /usr/pgsql-11/lib. Since the mongo_fdw build put the libraries in /usr/local/lib with links. I duplicated the same libraries by copying the libraries and creating the same links from /usr/local/lib to /usr/pgsql-11/lib, figuring that might get around the error after running ldconfig. I figured that would give PostgreSQL visibility to the libraries but still receive the same error. I didn't try this on the PG12 server, just the PG11 one.

AllHailTheHypnotoad commented 4 years ago

I have the entire output from autogen.sh from the PG11 build, would that help troubleshoot (after I sanitize anything sensitive)?

AllHailTheHypnotoad commented 4 years ago

I was able to finally get this working. The servers I work with are highly locked down via STIG, run SELinux, etc. and some combination of that was causing issues. I had already had to add --no-check-certificate to the autogen.sh wget calls by editing the file to start with. But I had that working fine, it was the make that caused most of the problems. Most of my issues came from SELinux not playing nice with the libraries during the build and deploy. Once I built and had them in place with SELinux off, I was able to run ldconfig and then re-enable SELinux and everything is working. I also disabled some of the security software during the process that conducts behavior analysis which may have also been part of the issue.