0

I have an issue that requires me to set the LD_LIBRARY_PATH environment variable when running Apache (2.2) unfortunately that breaks a perfectly functioning module. I'm looking for a way to fix it and wondered if the module that I compiled myself could be recompiled and linked with the use of rpath.

Story so far: I'm on Solaris and I've compiled Apache and enabled dynamic shared objects. Then I compiled a module called auth_gss using apxs and loaded it into Apache, everything works beautifully.

Then I compiled PHP and loaded that and that's great too, however the last piece of the puzzle is the Oracle OCI8 extension in PHP. This compiles fine, but complains when loaded that it can't find the required libraries, no problem, Oracle says you have to set LD_LIBRARY_PATH to the Oracle Instant Client home. I set that and restart apache and the OCI module is working, but the auth_gss module breaks now.

I'm assuming that it's picking up a library from the LD_LIBRARY_PATH that it shouldn't be and I want to know if there's a way that I can compile the auth_gss module so that it doesn't look to the LD_LIBRARY_PATH.

Hence my question, if when I link my auth_gss module I specify -Wl,-rpath=/usr/local/lib (where all its dependancies live) will it actually go looking for them in the LD_LIBRARY_PATH? From what I've read I think on Solaris it was always use that variable, in which case, how can I resolve the issue?

Or am I just being really stupid, will specifying all the library paths in order in the LD_LIBRARY_PATH variable just fix it?

Any help would be greatly appreciated.

HuggieRich
  • 101
  • 1
  • What is the output from `ldd -s -r XXX.so`, where `XXX.so` is your OCI8 PHP extension shared library? Also, be aware that Solaris supports concurrent 32- and 64-bit memory models and setting LD_LIBRARY_PATH applies to **both**, which can break things. You might need to use LD_LIBRARY_PATH_32 or LD_LIBRARY_PATH_64. See `man ld.so.1` for details. – Andrew Henle Jun 17 '15 at 00:29
  • Thanks Andrew, I've pasted the output of that command on [PasteBin](http://pastebin.com/KKvs63XZ) – HuggieRich Jun 17 '15 at 12:56
  • and with LD_LIBRARY_PATH set: [PasteBin](http://pastebin.com/zzkzzm86) – HuggieRich Jun 17 '15 at 13:12
  • It looks like the shared objects such as `libclntsh.so.12.1` are compiled without an rpath set, so for them to find their dynamic dependencies you pretty much have to set an LD_LIBRARY_PATH. Although in your case I'd recommend setting LD_LIBRARY_PATH_64, as it appears you're using 64-bit binaries. What happens if you set LD_LIBRARY_PATH_64? I'm not sure you have every dynamic dependency covered, though, as I see symbols not found even with LD_LIBRARY_PATH set. – Andrew Henle Jun 18 '15 at 00:23

1 Answers1

0

If you're interested in running the Oracle Solaris 11.3 beta release, you can get a fixed-up Instant Client in IPS form. And by 'fixed-up' I mean that you don't need to set LD_LIBRARY_PATH before running it.

https://blogs.oracle.com/jmcp/entry/oracle_instant_client_now_available

James McPherson
  • 2,476
  • 1
  • 12
  • 16