preload
Дек 14

При установке данного модуля столкнулся с такой проблемой. При запуске приложений, которые используют данный модуль, вылетала ошибка вроде такой «…DBD::Pg: libpq.so.4: cannot open shared object file: No such file or directory…», хотя установка прошла нормально. На различных форумах было множество предположений – нехватка прав, переустановить, перезагрузить компьютер, … Положение спасло только курение readme файла.Проблема на самом деле крылась в том, что не прописаны пути к библиотеке PostgreSQL и решалась эта проблема следующим образом.

  1. Прописать путь к директории содержащей библиотеку libpq.so в /etc/ld.so.conf
  2. Запустить /sbin/ldconfig

А вот выдержка из самого readme. Кстати, в последних версиях модуля в readme я уже не нашел данного текста.

DBD::Pg uses the libpq library that comes with Postgres. If the shared libpq
library is not available, DBD::Pg will error with a message that
usually mentions a file names libpq.so, like this:

    Can’t load ‘./blib/arch/auto/DBD/Pg/Pg.so’ for module DBD::Pg: libpq.so.5: cannot open
    shared object file: No such file or directory at …/DynaLoader.pm line 230.

This means that the libraries are not installed in a place where the system
can find them when it tries to load the Pg.so file. On some systems, you
can run /sbin/ldconfig -v to see a list of shared modules, or just search
the system for the file with «locate libpq.so». If it exists but is not being
loaded, you may need to add the directory it is in to /etc/ld.so.conf file
and run the ldconfig command. Otherwise, you may need to add the path to
the environment variable LD_LIBRARY_PATH.

Leave a Reply

You must be logged in to post a comment.