I want to use the perl language in a postgres function.
I am attempting to:
CREATE EXTENSION plperlu
...via pgAdmin 4 connected to postgres 10 and I get this error:
ERROR: could not load library "/var/lib/pgsql10/lib/postgresql/plperl.so": libperl.so: cannot open shared object file: No such file or directory
SQL state: XX000
I look for the library:
find -name libperl.so
...and I see it in these locations:
./usr/lib/perl5/5.18.2/i586-linux-thread-multi/CORE/libperl.so
./usr/lib/perl5/5.18.2/x86_64-linux-thread-multi/CORE/libperl.so
So I conclude that it is already on my server distribution, but isn't in the location postgres is looking so I search and find this link:
...and I am opting do this (from the link above, but I have different paths): "- Add the directory that contains libperl.so to /etc/ld.so.conf and run "ldconfig" as root user. Then start the PostgreSQL server."
So I find the config file:
find -name ld.so.conf
And get this path:
./etc/ld.so.conf
...and edit the file:
vi ./etc/ld.so.conf
... and add this path:
./usr/lib/perl5/5.18.2/x86_64-linux-thread-multi/CORE/
... load the new config:
ldconfig
... restart pg:
systemctl restart postgresql-10.service
... run this query:
CREATE EXTENSION plperlu;
...and get the same error:
ERROR: could not load library "/var/lib/pgsql10/lib/postgresql/plperl.so": libperl.so: cannot open shared object file: No such file or directory
SQL state: XX000
...when I replace the previous path and add this path:
/usr/lib/perl5/5.18.2/x86_64-linux-thread-multi/CORE
..to ld.so.conf
, I get:
ERROR: could not load library "/var/lib/pgsql10/lib/postgresql/plperl.so": /var/lib/pgsql10/lib/postgresql/plperl.so: undefined symbol: Perl_xs_handshake
SQL state: XX000
... a little different error, but I don't know if I am closer or further away.
How do I get PostgreSQL pointed to the correct library so I can use perl?
I have:
- PostgreSQL 10.0 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18), 64-bit
- pgAdmin 4 2.0
- SUSE Linux Enterprise 12 64-bit virtual server
UPDATE 1:
I received help from the postgres general email list: The existing perl was likely built using an older OS (which I guess I have) therefore doesn't work (handshake) with a current version of postgres (v10). I hope to update my OS which will update my server OS distribution version of perl, which should be a postgres v10 supported version of perl. I'll try to come back with confirmation/an answer after we upgrade our OS. Any additional color or possible causes welcome though.