BUILD.txt 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. Linux Build Hints
  2. -----------------
  3. (Tested on RedHat 4.x, Gentoo 2008.0, Ubuntu 8.x, and Debian 4.x)
  4. These hints are based on using Oracle's instantclient_11_1. It is necessary
  5. to download both 'instantclient-linux-basic' and 'instantclient-sdk-linux' from
  6. oracle.com in order to successfully compile. Note, however, that if using RPMs
  7. you do not need to do anything as cx_Oracle will compile out of the box without
  8. any changes to the configuration of the machine.
  9. http://www.oracle.com/technology/software/tech/oci/instantclient/index.html
  10. Each compressed tarball needs to be extracted to the exact same location.
  11. Uncompress and untar each file from the same location in order to achieve this
  12. result. If placing into a system area such as /opt or /usr/local, make sure to
  13. have the correct permissions for writing to these filesystems and/or
  14. directories. It is advisable to use the same account from start to finish while
  15. installing cx_Oracle in order not to clobber the pre-set environment variables
  16. set below.
  17. It is necessary to set environment variables ORACLE_HOME and LD_LIBRARY_PATH
  18. inside $HOME/.profile in order for cx_Oracle to import properly after
  19. installation and in order to build correctly. Using a text editor add the
  20. settings below to $HOME/.profile making sure to change the location of your
  21. actual installation path.
  22. Example ($HOME/.profile):
  23. -------------------------
  24. export ORACLE_HOME=[your installation path]/instantclient_11_1
  25. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME
  26. To put these variables into the working shell env, either source .profile
  27. (. $HOME/.profile) or execute each export statement above from a shell
  28. individually to set these variables. If these are not added to $HOME/.profile
  29. they will need to be manually set each time cx_Oracle is loaded into Python.
  30. After both packages are untarred to there installation location a link needs
  31. to be made inside the instantclient_11_1 directory. If you are using a
  32. different version of the instant client simply adjust the link per the version
  33. of libclntsh.so.
  34. Steps:
  35. ------
  36. cd $ORACLE_HOME
  37. ln -s libclntsh.so.x.x libclntsh.so
  38. Continue to step: Building and Compilation.
  39. OS X Build Hints
  40. ----------------
  41. (Tested on Leopard 10.5.x)
  42. The procedures for OS X are almost idential to Linux except for the package
  43. names and a few environmental caveats. For OS X it is necessary to download
  44. both 'instantclient-basic-macosx' and 'instantclient-sdk-macosx'. Download and
  45. extract each file per the build hints for Linux.
  46. For OS X it is necessary to set environment variables ORACLE_HOME,
  47. LD_LIBRARY_PATH and DYLD_LIBRARY_PATH inside $HOME/.profile and start a new
  48. shell before testing cx_Oracle. If .profile does not exist, simply create one
  49. with a text editor and add the necessary path info to these variables.
  50. Example ($HOME/.profile):
  51. -------------------------
  52. export ORACLE_HOME=[your installation path]/instantclient_11_1
  53. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME
  54. export DYLD_LIBRARY_PATH=$ORACLE_HOME
  55. The variables placed inside $HOME/.profile need to be set prior to building.
  56. Therefore, source .profile (. $HOME/.profile) or execute each export statement
  57. above from a shell individually to set these variables. Not having
  58. DYLD_LIBRARY_PATH set inside $HOME/.profile prior to building will cause a
  59. compilation error regardless of being set in the current shell's env.
  60. After both packages are untarred a link needs to be made inside the
  61. instantclient_11_1 directory. If you are using a different version of the
  62. instant client simply adjust the link per the version of libclntsh.dylib.
  63. Steps:
  64. ------
  65. cd $ORACLE_HOME
  66. ln -s libclntsh.dylib.x.x libclntsh.dylib
  67. Continue to step: Building and Compilation.
  68. Building and Compilation
  69. ------------------------
  70. Use the provided setup.py to build and install the module which makes use of
  71. the distutils module. Note that on Windows, I have used mingw32
  72. (http://www.mingw.org) and the module will not build with MSVC without
  73. modification. The commands required to build and install the module are as
  74. follows:
  75. python setup.py build
  76. python setup.py install
  77. Testing (Post Installation Quick Test)
  78. --------------------------------------
  79. A very quick installation test can be performed from the command line using
  80. the Python interpreter. Below is an example of how this done. After importing
  81. cx_Oracle there should be a line containing only '>>>' which indicates the
  82. library successfully loaded.
  83. $ python
  84. Python 2.5.2 (r252:60911, Oct 25 2008, 19:37:28)
  85. [GCC 4.1.2 (Gentoo 4.1.2 p1.1)] on linux2
  86. Type "help", "copyright", "credits" or "license" for more information.
  87. >>> import cx_Oracle
  88. >>>