-
Notifications
You must be signed in to change notification settings - Fork 362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version 6 fails to find OCI libs where version 5 succeeded #15
Comments
This was noted in our own testing and discussed without coming to a definite conclusion. The new driver is capable of using any Oracle Client without needing to be recompiled. Setting RPATH detracts from that ability -- but it may be a price worth paying. :-) I'll do some further research and get back to you. |
I actually think the current behaviour is more correct, but anyway expect many complaints. We actually fixed our build environment to ensure LD_LIBRARY_PATH is set. Setting RPATH is probably really a bad idea, but how about doing the same discovery as before during the build if libclntsh is not found and storing the path into the binary. On import this could be used as a fallback together with reporting a deprecation warning that this behaviour will go away in, say, 7.0!? Actually it would be even more compatible to stick to the path discovered during build whenever available and warn if another version would be selected by standard linker behaviour. My two cents... |
Setting LD_LIBRARY_PATH rather than using RPATH / RUNPATH is deprecated on Solaris. When I built and packaged cx_Oracle for Solaris, as well as bundling the Instant Client software, I ensured that we baked in the RPATH so as to avoid needing any sort of environment hack with LD_LIBRARY_PATH. In general, it's much more secure to bake in RPATH. |
Thanks for the link @jmcp. It appears that RUNPATH is preferred over RPATH since there is no way to override RPATH without using LD_PRELOAD -- something I believe we want to avoid, but your point is well-taken. I attempted to set RPATH/RUNPATH in the cx_Oracle module and it failed miserably. The reason for this is that libclntsh.so itself depends on a few other libraries (like libmql1.so) and apparently the value of RPATH/RUNPATH in the cx_Oracle module is not consulted for looking up these secondary dependencies. And libclntsh.so itself does not have an RPATH/RUNPATH setting, unfortunately. I did a quick test with a utility called patchelf that can set RPATH/RUNPATH in an existing library without requiring relinking -- and that worked beautifully. I set the value to '$ORIGIN' since the dependent libraries are all found in the same directory. I'll see if this can be corrected in further releases of the Instant Client or whether it is worth mentioning the workaround for existing users.
Unfortunately, as noted above, even attempting to use the full path name of the known Instant Client library will fail due to the fact that it has no RPATH/RUNPATH setting so cannot find its own dependencies. And setting LD_LIBRARY_PATH within the library itself is useless since that environment variable is only consulted when a process starts.
This would be nice but there is no way to determine the actual library that was loaded as far as I know. And this is actually desirable behaviour anyway. I am producing a single binary which doesn't require OCI libraries or header files available and should be usable in all Oracle Client configurations. So this would need to be an opt-in warning if this was even doable. Assuming the Instant Client libraries can be adjusted, the best solution it would seem to me would be to set the RUNPATH setting to include the known locations for the instant client RPMs (on Linux) and any known location of an Oracle client located during the build process. If anyone has further thoughts and ideas I would love to hear them! |
Re the Instant Client delivery, I did file a bug requesting that that team update their Makefiles to bake in the rpath, but it doesn't seem to have gone very far :( |
Not sure if that would be such a great idea. All in all I am against rpath tweaks, in my eyes setting LD_LIBRARY_PATH is the more flexible approach. I seldom got bitten by a incorrectly set LD_LIBRARY_PATH and it was easy to debug. And I had a few fights with rpath already. See also https://wiki.debian.org/RpathIssue for more information, suffice to say is that Debian discourages using it. |
Closing due to lack of activity. Improving installation/configuration of the Oracle Client libraries is an ongoing concern, however. |
We are preparing to replace cx_Oracle 5 with version 6 in our application. Updating the requirements lead to our tests to fail.
The reason is quite obvious but I think cx_Oracle 5 was more robust: On our build slave the instantclient packages are installed but nothing else of the Oracle database. This always worked fine:
After upgrading to 6.0b1 we get this:
The version of instant client installed is a bit old:
The obvious way to fix this is to extend LD_LIBRARY_PATH:
For easing the upgrade to users of cx_Oracle it would make sense though to keep the behaviour to guess the instant client installations like setup.py did for cx_Oracle 5.3.
Feel free to close this if you disagree.
The text was updated successfully, but these errors were encountered: