ERROR: could not load library "/opt/PostgreSQL/9.6/lib/postgresql/plperl.so": /opt/PostgreSQL/9.6/lib/postgresql/plperl.so: undefined symbol: Perl_save_strlen
I am using PostgreSQL 9.6 version and tried to create plperl language. I was getting the below error.
[postgres@localhost ~]$ export LD_LIBRARY_PATH=/usr/lib64/perl5/CORE:/opt/PostgreSQL/9.6/lib
[postgres@localhost ~]$ export PATH=/opt/PostgreSQL/9.6/bin:$PATH
[postgres@localhost ~]$ psql
Password:
psql.bin (9.6.0)
Type “help” for help.
postgres=# create language plperl;
ERROR: could not load library “/opt/PostgreSQL/9.6/lib/postgresql/plperl.so”: libperl.so: cannot open shared object file: No such file or directory
postgres=# \q
[postgres@localhost ~]$
[postgres@localhost ~]$ ldd /opt/PostgreSQL/9.6/lib/postgresql/plperl.so
linux-vdso.so.1 => (0x00007ffd06fcc000)
libperl.so => /usr/lib64/perl5/CORE/libperl.so (0x00007fda1ad1c000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fda1aaed000)
libc.so.6 => /lib64/libc.so.6 (0x00007fda1a72c000)
libresolv.so.2 => /lib64/libresolv.so.2 (0x00007fda1a512000)
libnsl.so.1 => /lib64/libnsl.so.1 (0x00007fda1a2f8000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fda1a0f4000)
libm.so.6 => /lib64/libm.so.6 (0x00007fda19df2000)
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007fda19bba000)
libutil.so.1 => /lib64/libutil.so.1 (0x00007fda199b7000)
/lib64/ld-linux-x86-64.so.2 (0x00007fda1b2c3000)
libfreebl3.so => /lib64/libfreebl3.so (0x00007fda197b4000)
[postgres@localhost ~]$
[postgres@localhost ~]$ pg_ctl -D /opt/PostgreSQL/9.6/data restart
waiting for server to shut down…. done
[postgres@localhost ~]$ psql
Password:
psql.bin (9.6.0)
Type “help” for help.
postgres=# create language plperl;
ERROR: could not load library “/opt/PostgreSQL/9.6/lib/postgresql/plperl.so”: /opt/PostgreSQL/9.6/lib/postgresql/plperl.so: undefined symbol: Perl_save_strlen
I have searched a lot for this error but did not find anything related to this. Finally I tried the same steps in PostgreSQL 9.4 and it was successful with same steps as above.
[postgres@localhost ~]$ export PATH=/opt/PostgreSQL/9.4/bin:$PATH
[postgres@localhost ~]$ export LD_LIBRARY_PATH=/usr/lib64/perl5/CORE:/opt/PostgreSQL/9.4/lib
[postgres@localhost ~]$ ldd /opt/PostgreSQL/9.4/lib/postgresql/plperl.so
linux-vdso.so.1 => (0x00007ffdfa973000)
libperl.so => /usr/lib64/perl5/CORE/libperl.so (0x00007ffb8e2d6000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007ffb8e0a7000)
libc.so.6 => /lib64/libc.so.6 (0x00007ffb8dce6000)
libresolv.so.2 => /lib64/libresolv.so.2 (0x00007ffb8dacc000)
libnsl.so.1 => /lib64/libnsl.so.1 (0x00007ffb8d8b2000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007ffb8d6ae000)
libm.so.6 => /lib64/libm.so.6 (0x00007ffb8d3ac000)
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007ffb8d174000)
libutil.so.1 => /lib64/libutil.so.1 (0x00007ffb8cf71000)
/lib64/ld-linux-x86-64.so.2 (0x00007ffb8e87c000)
libfreebl3.so => /lib64/libfreebl3.so (0x00007ffb8cd6e000)
[postgres@localhost ~]$
[postgres@localhost ~]$ pg_ctl -D /opt/PostgreSQL/9.4/data restart
waiting for server to shut down…. done
server stopped
server starting
[postgres@localhost ~]$ 2017-12-06 10:01:31 IST LOG: redirecting log output to logging collector process
2017-12-06 10:01:31 IST HINT: Future log output will appear in directory “pg_log”.
[postgres@localhost ~]$
[postgres@localhost ~]$ psql -p 5433
Password:
psql.bin (9.4.10)
Type “help” for help.
postgres=# create language plperl;
CREATE LANGUAGE
postgres=#
This is happening only in PostgreSQL 9.6.