Comments (13)
Perhaps because I tend to have multiple Oracle libs around, I'd only ever use ldconfig when I have a single Instant Client and nothing else installed.
BTW, I contributed the installation code to cx_Oracle 5.2 to automatically find & use Instant Client RPMs or ORACLE_HOME, so I get the general install simplification desires. Before 5.2 you would always have needed to fiddle during install, and set LD_LIBRARY_PATH
to run.
The new ODPI-C layer model bring benefits for building and upgrading in scenarios that haven't been discussed in this issue. We've traded one install simplication for others, such as the ability to ship Python wheels. Can linking be improved - sure. I'd like changes to make it easier for apps that distribute Instant Client in arbitrary product directions. And maybe it could add ORACLE_HOME
to the library loading path too.
from odpi.
A few comments about this request:
- LD_LIBRARY_PATH is only examined when the process starts so it cannot be changed by the code
- the scripts provided by Oracle to change environment (oraenv) already include code to change LD_LIBRARY_PATH so you shouldn't need to fiddle!
- even if the environment variable ORACLE_HOME was examined and the exact library that needs to be opened found, dlopen() will still fail because libclntsh.so has dependent libraries and DT_RPATH is not set in that library (see oracle/python-cx_Oracle#15 for a further discussion on this issue)
Any comments?
from odpi.
oraenv works, I am able to compile and run the test like this (vs oracle XE)
ORACLE_BASE=/home/oracle
ORACLE_SID=XE
ORAENV_ASK=NO source oraenv
sqlplus / as sysdba @/home/oracle/odpi/test/sql/SetupTest.sql
cd /home/oracle/odpi/
make
cd /home/oracle/odpi/test/
make
/home/oracle/odpi/test/build/TestSuiteRunner
from odpi.
..., dlopen() will still fail because libclntsh.so has dependent libraries and DT_RPATH is not set in that library.
It is correct as for instant clients. As far as I checked, however, it isn't correct for ORACLE_HOME-based clients on Linux.
$ echo $ORACLE_HOME
/home/ora121/app/ora121/product/12.1.0/dbhome_1
$ readelf -d $ORACLE_HOME/lib/libclntsh.so | grep RPATH
0x000000000000000f (RPATH) Library rpath: [/home/ora121/app/ora121/product/12.1.0/dbhome_1/lib]
I made a small C program.
https://gist.github.com/kubo/4bbb374e2a3fb05f4a1baef2bf8875ea
It could not find libmql1.so as you pointed when the client is an instant client.
It could find dependent libraries and worked fine when the client is an ORACLE_HOME-based client.
$ wget https://gist.githubusercontent.com/kubo/4bbb374e2a3fb05f4a1baef2bf8875ea/raw/46e10020fe413e2710fbac1d48bd56a02dc05fea/dln-load.c
$ cc -o dln-load dln-load.c -ldl
$ env | grep LD_LIBRARY_PATH # verify that LD_LIBRARY_PATH isn't set.
$ ./dln-load /opt/oracle/ic_12102_64/libclntsh.so.12.1 # Instant client
dlopen error: libmql1.so: cannot open shared object file: No such file or directory
$ env | grep ORACLE_HOME
ORACLE_HOME=/home/ora121/app/ora121/product/12.1.0/dbhome_1
$ ./dln-load $ORACLE_HOME/lib/libclntsh.so.12.1 # ORACLE_HOME-based client
OCIEnvCreate() => 0
link map:
(nil):
0x7ffd00cf4000:
0x7f54c5798000: /lib/x86_64-linux-gnu/libdl.so.2
0x7f54c53ce000: /lib/x86_64-linux-gnu/libc.so.6
0x7f54c599c000: /lib64/ld-linux-x86-64.so.2
0x7f54c240f000: /home/ora121/app/ora121/product/12.1.0/dbhome_1/lib/libclntsh.so.12.1
0x7f54c2199000: /home/ora121/app/ora121/product/12.1.0/dbhome_1/lib/libmql1.so
0x7f54c1e1b000: /home/ora121/app/ora121/product/12.1.0/dbhome_1/lib/libipc1.so
0x7f54c1711000: /home/ora121/app/ora121/product/12.1.0/dbhome_1/lib/libnnz12.so
0x7f54c14cc000: /home/ora121/app/ora121/product/12.1.0/dbhome_1/lib/libons.so
0x7f54c11c3000: /lib/x86_64-linux-gnu/libm.so.6
0x7f54c0fa6000: /lib/x86_64-linux-gnu/libpthread.so.0
0x7f54c0d8d000: /lib/x86_64-linux-gnu/libnsl.so.1
0x7f54c0b85000: /lib/x86_64-linux-gnu/librt.so.1
0x7f54c0983000: /lib/x86_64-linux-gnu/libaio.so.1
0x7f54c0411000: /home/ora121/app/ora121/product/12.1.0/dbhome_1/lib/libclntshcore.so.12.1
0x7f54c0208000: /lib/x86_64-linux-gnu/libnss_compat.so.2
0x7f54bfffc000: /lib/x86_64-linux-gnu/libnss_nis.so.2
0x7f54bfdea000: /lib/x86_64-linux-gnu/libnss_files.so.2
from odpi.
Thanks, Kubo. Good point about ORACLE_HOME-based clients. That may be worth pursuing.
from odpi.
We don't use oraenv
since the target databases are remote and are listed in tnsnames.ora
and not in /etc/oratab
. I do share @kubo's opinion. ORACLE_HOME
based clients are linked from objects at install time. RPATH
should work:
$ readelf -d /opt/oracle/product/11.2.0/client_1/lib/libclntsh.so
Dynamic section at offset 0x26835e0 contains 28 entries:
Tag Type Name/Value
0x0000000000000001 (NEEDED) Shared library: [libnnz11.so]
0x0000000000000001 (NEEDED) Shared library: [libdl.so.2]
0x0000000000000001 (NEEDED) Shared library: [libm.so.6]
0x0000000000000001 (NEEDED) Shared library: [libpthread.so.0]
0x0000000000000001 (NEEDED) Shared library: [libnsl.so.1]
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
0x0000000000000001 (NEEDED) Shared library: [libaio.so.1]
0x000000000000000e (SONAME) Library soname: [libclntsh.so.11.1]
0x000000000000000f (RPATH) Library rpath: [/opt/oracle/product/11.2.0/client_1/lib]
from odpi.
@michael-o I have my own ideas about what should 'just work'. Can you expand a bit more on the various install cases you think need to be covered so we're in agreement on the direction? Cover install, upgrade of interfaces and upgrades of Oracle client. Installs with ORACLE_HOME, Instant Client ZIPs, Instant Client RPMs are also things to think about.
from odpi.
@cjbj Of course! We install (GUI installer) on all machines (RHEL6, HP-UX 11.31) the full client from MOSC. Set ORACLE_HOME
on a per-user basis and use SQL*Plus + Oracle PRO*C (with C and Fortran). In the next step, we'd like to Use cx_Oracle in Python and continue to use the basic env variables set as before with the two aforementioned tools. Namely, TNS_ADMIN
(with Oracle Wallet), NLS_*
, ORACLE_HOME
. So, at best, we don't need to change anything when we use Python with cx_Oracle 6.0.
from odpi.
@michael-o what's stopping you setting LD_LIBRARY_PATH?
from odpi.
Nothing actually, but supporting ORACLE_HOME
would make it consistent with the rest of the Oracle world -- and less configuration to distribute.
from odpi.
@anthony-tuininga So I added $ORACLE_HOME/lib
to /etc/ld.conf.d
and ran ldconfig
and poluted the entire system library path with all third-party libs Oracle is bundling for its database, e.g., libexpat
. Definitively not a way to go.
from odpi.
Good point. I'll discuss with @cjbj and get back to you.
from odpi.
Suggestion implemented. Thanks!
from odpi.
Related Issues (20)
- XMLTYPE as "real" XML HOT 3
- Ability to set OCI_ATTR_LOBPREFETCH_SIZE HOT 7
- "ORA-03106: fatal two-task communication protocol error" when CLOB is fetched as strings and then lob locators HOT 3
- core dumps generated in libclntsh when timeouts are configured HOT 10
- Any plan to support Apple's M1 plat? HOT 1
- Is there a reference example dequeue message with message ID dequeue option HOT 9
- When ODPI tries to translate a variable to a temporary LOB, and there is inadequate TEMP tablespace, ODPI segfaults when the cursor is closed HOT 6
- M1 Mac issue ( incompatible architecture) HOT 2
- How to use ODPI-C with Oracle Times Ten? HOT 9
- Column Alias Error HOT 7
- Add an option to convert numbers between double and decimal in the same way as node.js, python3, ruby, rust or so HOT 5
- Oracle Rust driver HOT 2
- Option to get json float as float. It is got as double now. HOT 8
- Bytes after nul in members of dpiXid are zeroed. HOT 2
- Is DPI_TPC_END_SUSPEND an undocumented flag in the OCI manual? HOT 3
- dpiEnqOptions_setVisibility and dpiLob_getType are listed not in round_trips.rst HOT 2
- Get column name for position HOT 2
- `dpiStmt_execute` with `DPI_MODE_EXEC_PARSE_ONLY` will create a table. HOT 4
- Retrieving CLOB from an OUT parameter of an Store Procedure HOT 1
- ERROR: DPI-1047: Cannot locate a 32-bit Oracle Client library HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from odpi.