oracle / odpi

ODPI-C: Oracle Database Programming Interface for Drivers and Applications
https://oracle.github.io/odpi/
Other
268 stars 78 forks source link

Set rpath on Linux and Solaris #2

Closed kubo closed 7 years ago

kubo commented 7 years ago

Could you set -Wl,-rpath,$(OCI_LIB_DIR) to LDFLAGS on Linux and -R,$(OCI_LIB_DIR) on Solaris in addition to macOS?

    UNAME_S := $(shell uname -s)
    ifeq ($(UNAME_S), Linux)
        LDFLAGS += -Wl,-rpath,$(OCI_LIB_DIR)
    endif
    ifeq ($(UNAME_S), SunOS)
        LDFLAGS += -R,$(OCI_LIB_DIR)
    endif

If rpath is set, client programs depending on odpi have no need to use LD_LIBRARY_PATH to know the directory containing Oracle client libraries.

anthony-tuininga commented 7 years ago

@kubo Thanks. Did you test those changes on Solaris yourself?

kubo commented 7 years ago

Sorry, I have not tested it on Solaris. I wrote it from my memory. -R,$(OCI_LIB_DIR) should be -R$(OCI_LIB_DIR).

As far as I checked, -Wl,-rpath,$(OCI_LIB) is also okay on recent Solaris, at least Solaris 11.3 I tested. It had not been okay on old Solaris according to my memory.

anthony-tuininga commented 7 years ago

I suspect the -R$(OCI_LIB_DIR) is required for a different compiler. So I'll wait on that until I can test on a Solaris VM.

cjbj commented 7 years ago

I have rpath on Linux on my list - like we do for node-oracledb.

anthony-tuininga commented 7 years ago

Setting RPATH when compiling ODPI-C or a driver like cx_Oracle and node-oracledb won't help due to the fact that there is no RPATH set on libclntsh.so in Oracle Instant Client. If you have a full client, however, ODPI-C now automatically locates and loads the library.

kubo commented 7 years ago

Okay, thanks!