Opened 12 years ago

Closed 12 years ago

#38626 closed enhancement (fixed)

oracle-instantclient: set rpath instead of advising users to set DYLD_LIBRARY_PATH

Reported by: danielluke (Daniel J. Luke) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.1.3
Keywords: Cc:
Port: oracle-instantclient

Description

As we generally advise users to never set DYLD_* variables, it would be good if oracle-instantclient did not require setting DYLD_LIBRARY_PATH. We should be able to fix it by setting an appropriate rpath.

See also mailing list thread here: https://lists.macosforge.org/pipermail/macports-dev/2013-March/022472.html

Attachments (2)

oracle-instantclient.diff (2.1 KB) - added by ryandesign (Ryan Carsten Schmidt) 12 years ago.
the change I tried, which did not work
oracle-instantclient.2.diff (2.1 KB) - added by ryandesign (Ryan Carsten Schmidt) 12 years ago.
fixed string match usage; works with v11 on Intel, not with v10 on PowerPC

Download all attachments as: .zip

Change History (8)

comment:1 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Status: newassigned
Type: defectenhancement

Thanks for filing this ticket. Yes absolutely if there is a way to avoid requiring users to set DYLD_LIBRARY_PATH then we should do that. But setting DYLD_LIBRARY_PATH is what Oracle says to do, and I would have hoped that a large software company like Oracle would have already tried all possible workarounds for this requirement, and if they say it must be done, then it must be done. Then again, other aspects of their software release procedures demonstrate that perhaps they don't really know what they're doing.

I was looking into this today. I did not get it to work yet. For example, trying to use a php-oracle function without setting DYLD_LIBRARY_PATH results in:

$ php55 -r 'oci_connect("username", "password");'
Warning: oci_connect(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that DYLD_LIBRARY_PATH includes the directory with Oracle Instant Client libraries in Command line code on line 1

Warning: oci_connect(): Error while trying to retrieve text for error ORA-01804
 in Command line code on line 1

Setting DYLD_LIBRARY_PATH=/opt/local/lib/oracle first, as port notes oracle-instantclient currently says to do, works around the problem.

I tried the attached patch to oracle-instantclient, and it did not change the situation. Am I doing it wrong? As I said on the mailing list, I'm not familiar with this "rpath" concept.

Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Attachment: oracle-instantclient.diff added

the change I tried, which did not work

comment:2 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

But I may have just messed up my usage of string match.

comment:3 in reply to:  1 ; Changed 12 years ago by danielluke (Daniel J. Luke)

Replying to ryandesign@…:

But setting DYLD_LIBRARY_PATH is what Oracle says to do, and I would have hoped that a large software company like Oracle would have already tried all possible workarounds for this requirement, and if they say it must be done, then it must be done.

You are assuming more competence there than you should. Oracle recommends setting a path like that on every platform (LD_LIBRARY_PATH usually) and on the linux and solaris systems I've worked with it has never actually been necessary.

I think perhaps their internal build setup is broken enough that they can't do this the right way and/or they just don't care enough about doing it the right way since they can tell everyone to set a linker search path instead.

I was looking into this today. I did not get it to work yet. For example, trying to use a php-oracle function without setting DYLD_LIBRARY_PATH results in:

$ php55 -r 'oci_connect("username", "password");'
Warning: oci_connect(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that DYLD_LIBRARY_PATH includes the directory with Oracle Instant Client libraries in Command line code on line 1

Warning: oci_connect(): Error while trying to retrieve text for error ORA-01804
 in Command line code on line 1

that's what it looks like if no rpath is set and DYLD_LIBRARY_PATH isn't set for me too (or very similar).

Setting DYLD_LIBRARY_PATH=/opt/local/lib/oracle first, as port notes oracle-instantclient currently says to do, works around the problem.

I tried the attached patch to oracle-instantclient, and it did not change the situation. Am I doing it wrong? As I said on the mailing list, I'm not familiar with this "rpath" concept.

I can try the patch, but if you have output from the build log on what command is actually run, that might be easier.

on my non-macports install that I tested with, the command that I ran to fix it was (from /usr/local/instantcleint_11_2):

install_name_tool -add_rpath /usr/local/instantclient_11_2/ libclntsh.dylib.11.1

Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Attachment: oracle-instantclient.2.diff added

fixed string match usage; works with v11 on Intel, not with v10 on PowerPC

comment:4 in reply to:  3 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to ryandesign@…:

But I may have just messed up my usage of string match.

Yes, I did. Fixed version attached. It seems to work using oracle instant client 11 on Intel on Mountain Lion. But it fails as follows using oracle instant client 10 on PowerPC on Tiger:

$ php55 -r 'oci_connect("username", "password");'
PHP Warning:  PHP Startup: Unable to load dynamic library '/Volumes/Data/macports/tiger/lib/php55/extensions/no-debug-non-zts-20121212/oci8.so' - dlopen(/Volumes/Data/macports/tiger/lib/php55/extensions/no-debug-non-zts-20121212/oci8.so, 9): Library not loaded: /Volumes/Data/macports/tiger/lib/oracle/libclntsh.dylib.10.1
  Referenced from: /Volumes/Data/macports/tiger/lib/php55/extensions/no-debug-non-zts-20121212/oci8.so
  Reason: no suitable image found.  Did find:
        /Volumes/Data/macports/tiger/lib/oracle/libclntsh.dylib.10.1: unknown required load command 0x8000001C in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/Volumes/Data/macports/tiger/lib/php55/extensions/no-debug-non-zts-20121212/pdo_oci.so' - dlopen(/Volumes/Data/macports/tiger/lib/php55/extensions/no-debug-non-zts-20121212/pdo_oci.so, 9): Library not loaded: /Volumes/Data/macports/tiger/lib/oracle/libclntsh.dylib.10.1
  Referenced from: /Volumes/Data/macports/tiger/lib/php55/extensions/no-debug-non-zts-20121212/pdo_oci.so
  Reason: no suitable image found.  Did find:
        /Volumes/Data/macports/tiger/lib/oracle/libclntsh.dylib.10.1: unknown required load command 0x8000001C in Unknown on line 0

Fatal error: Call to undefined function oci_connect() in Command line code on line 1

Replying to dluke@…:

I can try the patch, but if you have output from the build log on what command is actually run, that might be easier.

MacPorts does not log anything for commands run with system.

comment:5 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

I had the cctools port installed, which provides a newer version of install_name_tool. Deactivating cctools and using the one provided by Tiger's Xcode makes the build fail with:

--->  Building oracle-instantclient
DEBUG: Executing org.macports.build (oracle-instantclient)
install_name_tool: more than one input file specified (/Volumes/Data/macports/tiger/lib/oracle and -add_rpath)
Usage: install_name_tool [-change old new] ... [-id name] input

So I think Tiger does not support rpath.

comment:6 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: assignedclosed

Added for Leopard and up in r104770.

Note: See TracTickets for help on using tickets.