0

Does systemd do something funny with linking shared libraries?

I have a php extension which loads a shared library outside the php extension directory. If I run php-cli or start php-fpm from the CLI it works as expected and phpinfo() shows how the extension was built:

Compile-time ORACLE_HOME    /path/to/oracle_home
Libraries Used  -Wl,-rpath,/path/to/oracle_home/lib -L/path/to/oracle_home/lib -lclntsh

When starting php-fpm using systemd (systemctl), this error shows up in the logs:

NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/oci8.so' - libclntsh.so.12.1: cannot open shared object file: No such file or directory in Unknown on line 0

Shouldn't the -lclntsh be using the rpath to find the needed library? Why does systemd break this?

Note: Adding the following to the unit file doesn't help:

Environment=LD_LIBRARY_PATH=/path/to/oracle_home/lib

Nor does it help to add that path under /etc/ld.so.conf.d/

chell
  • 51
  • 1
  • 6
  • 1
    What does `strace` show the process looking for regarding files? – thrig Jul 25 '17 at 22:27
  • @thrig I don't know how to trace a process under systemd but tracing from the CLI (when it works), it looks for the file in a couple places it's not but finds it after a that. What part of the trace would be useful? – chell Jul 26 '17 at 01:44
  • you'll need to trace both to see what is different; `sysdig` would be another option, or use a small wrapper shell script that does `exec strace ... yourprogramhere ...` – thrig Jul 26 '17 at 14:19

0 Answers0