BUILD.txt 4.5 KB

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