Friday, April 29, 2011

ERROR: could not load library "/opt/PostgreSQL/9.0/lib/postgresql/":

Above error thrown, when I was trying to create language plperlu. It indicates that there is a missing library Check out the steps performed to overcome this issue and successfully creating the plperlu language in PostgreSQL.

Method 1 (Finding the and making softlink to that location)

postgres=# create LANGUAGE plperlu;
ERROR:  could not load library "/opt/PostgreSQL/9.0/lib/postgresql/": cannot open shared object file: No such file or directory
postgres=# \q

Now, search for the file on your box and add that location to your LD_LIBRARY PATH. Dont forget switching user to postgres.

[root@localhost /]# find -name

[root@localhost /]# su - postgres

-bash-4.1$ export LD_LIBRARY_PATH=/usr/lib/perl5/5.10.0/i386-linux-thread-multi/CORE:$LD_LIBRARY_PATH

Restart the cluster to effect the changes.

-bash-4.1$ pg_ctl restart
waiting for server to shut down....... done
server stopped
server starting

You are now ready to create the language.
-bash-4.1$ psql
psql (9.0.1)
Type "help" for help.

postgres=# create LANGUAGE plperlu;

Method 2 (By installing the latest ActivePerl)

Step 1:
After installing ActivePerl, set the LD_LIBRARY_PATH.
postgres@localhost:/opt/ActivePerl-5.12/lib/CORE> export LD_LIBRARY_PATH=/opt/ActivePerl-5.12/lib/CORE:/opt/PostgreSQL/9.0/lib/postgresql

Step 2:
postgres@localhost:/opt/PostgreSQL/9.0/lib/postgresql> ldd =>  (0x00007fff8cf79000) => /opt/ActivePerl-5.12/lib/CORE/ (0x00007fbd3d654000) => /lib64/ (0x00007fbd3d40a000) => /lib64/ (0x00007fbd3d206000) => /lib64/ (0x00007fbd3cfb0000) => /lib64/ (0x00007fbd3cd74000) => /lib64/ (0x00007fbd3cb71000) => /lib64/ (0x00007fbd3c954000) => /lib64/ (0x00007fbd3c5f5000)
       /lib64/ (0x00007fbd3dad8000)

Step 3:

postgres@localhost:/opt/PostgreSQL/9.0/lib/postgresql> pg_ctl restart
postgres@localhost:/opt/PostgreSQL/9.0/lib/postgresql> psql
psql (9.0.2)
Type "help" for help.

postgres=# create language plperlu;

Post your comments.


1 comment :

Valeriano Cossu said...

on Debian install libperl-dev and try to createlang again

Post a Comment