Closed tgulacsi closed 4 years ago
Thanks @tgulacsi. I've had this kind of tracing on the wishlist for a while.
For completeness sake, its not complete :-) : Linux (or POSIX)-only yet.
First, errors are already printed with DPI_DEBUG_LEVEL=8
so that aspect is unneeded, I believe.
Second, on success the first check (using a plain dlopen()) won''t print anything useful as it will simply print "libclntsh.so" -- which we already know. The seecond check (for ORACLE_HOME) will at least print a full path, but it isn't particularly helpful, either.
That said, ideally we would be able to print the full path of the library in all cases. On Windows this is easy enough as a system call is available to figure that out. On Linux with GCC this can also be done via means of dladdr() and dlinfo() -- by enabling the GNU extensions with the macro _GNU_SOURCE. There may be other options for other platforms. If you're aware of those, that would be helpful to know. I can add a new debug level to print out this information. I don't think we want to print it all of the time.
the first check (using a plain dlopen()) won''t print anything useful as it will simply print "libclntsh.so"
dlopen() prints not only "libclntsh.so" in the following case.
libclntsh.so
is not found.libclntsh.so.18.1
is installed.libaio.so.1
, needed by libclntsh.so.18.1
, is not installed.dlopen("libclntsh.so", RTLD_LAZY)
fails with "libclntsh.so: cannot open shared object file: No such file or directory".
dlopen("libclntsh.so.18.1", RTLD_LAZY)
fails with "libaio.so.1: cannot open shared object file: No such file or directory".
ODPI-C picks up the error message of liclntsh.so
. However the error message of libclntsh.so.18.1
is useful in order to know libaio.so.1
is missing.
On Linux with GCC this can also be done via means of dladdr() and dlinfo() -- by enabling the GNU extensions with the macro _GNU_SOURCE. There may be other options for other platforms.
dladdr() is available on HP-UX, Solaris and *BSD also. I believe it came from Solaris.
Thanks, @kubo. That's useful information. The errors that are not actually returned to the user should still be reported in the debug output. I'll look into that.
With the latest code in the master branch, setting DPI_DEBUG_LEVEL to the value 64 will debug the loading of the Oracle Client library.
ODPI-C 4.0 was just released containing these changes.
Review existing enhancement requests https://github.com/godror/godror/issues/35
Describe your new request in detail Debug print failed/succeeded dlopen calls to help identify misconfigured library path search routes.
Give supporting information about tools and operating systems. Give relevant product version numbers Linux
debug-dlopen.patch.txt