I finally got around to installing cx_oracle under cygwin on a 64-bit
Win 7 Pro machine. I'd like to share some pointers and a patch to setup.py.
cygwin is (still) 32-bit only, so install a win32 instant client for
e.g. 11.1, and be sure to supplement the basic package with at least the
SDK package. (Multiple instant clients for different versions and widths
can reside on the same machine, as the instant client install does not
touch the registry.)
Make sure you have an ORACLE_HOME environment variable in the cygwin
environment which points to the instant client install directory. This
variable must be something like
/cygdrive/e/Oracle/x86/instantclient_11_1, not an windows path, like
E:\Oracle\x86\instantclient_11_1.
Modify the cx_Oracle setup.py file according to this diff:
$ diff setup.py ../../setup.py.djh
151,152c151,154
< "network/public", "oci/include"]
< libDirs = ["bin", "lib"]
---
> "network/public", "oci/include", "sdk/include"]
> libDirs = [os.path.join(oracleHome, "bin"),
os.path.join(oracleHome, "lib"), oracleHome,
> os.path.join(oracleHome, "oci", "lib", "msvc"),
> os.path.join(oracleHome, "sdk", "lib", "msvc")]
155,156c157,158
< for i in range(len(libDirs)):
< libDirs[i] = os.path.join(oracleHome, libDirs[i])
---
> #for i in range(len(libDirs)):
> # libDirs[i] = os.path.join(oracleHome, libDirs[i])
We are adding the locations for the oci.h and oci.lib files. My changes
propagate changes in the Win32 section into the cygwin section.
After a successful build and install, I found all but one test ran
successfully. The "test binding in/out a unicode array (with arrayvar)"
test failed.
When I re-built with the WITH_UNICODE environment variable set, then all
the tests succeed.
To make running cx_Oracle easier under cygwin, I copied the dbhome and
oraenv scripts from a linux install to cygwin. These use /etc/oratab to
set the ORACLE_HOME variable and add the right directories to the PATH.
|