FAQ
Has anyone successfully compiled cx_Oracle (2.4) under cygwin again
Oracle 8.1.7 running on Windows 2000?

I've grabbed the source package from Anthony's web site and am running
into a few 'opportunities'. To save me from removing what little hair
I've got left I wondered if anyone else has successfully done this before
me?

My problem is (I believe) that I need to tweak the setup.py but I have
absolutely no knowledge of make and its falling over trying to find the
right libraries.

Out of the box 'python setup.py build' doesn't work because it assumes I
am on Unix and looks for the Unix specific Oracle client library clntsh.

To get round this hiccup I've changed the setup.py so that it uses the
same arguments for cygwin as it does for Windows. To do this I changed
line 13 from;

if sys.platform == "win32":

to;

if sys.platform == "win32" or sys.plaform == "cygwin":

Now everything is fine until we reach this stage;

gcc -shared -Wl,--enable-auto-image-base build/temp.cygwin-1.3.9-i686-
2.2/cx_Oracle.o -L/Tools/Lib -L/usr/lib/python2.2/config -loci -
lpython2.2 -o build/lib.cygwin-1.3.9-i686-2.2/cx_Oracle.dll -s
/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/../../../../i686-pc-
cygwin/bin/ld: cannot find -loci
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

Reading 'man' for gcc this *seems* to be a problem because the linker is
looking for a file called liboci.a which, naturally, doesn't exist under
windows. I think I should be linking to oci.dll, but I don't know enough
to be sure.

Any suggestions, pointers or re-education would be most welcome.

Andy
--
Contents free posts a speciality

Search Discussions

  • Gerhard Häring at Feb 6, 2002 at 7:59 am

    Le 06/02/02 ? 02:55, Andy Todd ?crivit:
    [...]
    Now everything is fine until we reach this stage;

    gcc -shared -Wl,--enable-auto-image-base build/temp.cygwin-1.3.9-i686-
    2.2/cx_Oracle.o -L/Tools/Lib -L/usr/lib/python2.2/config -loci -
    lpython2.2 -o build/lib.cygwin-1.3.9-i686-2.2/cx_Oracle.dll -s
    /usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/../../../../i686-pc-
    cygwin/bin/ld: cannot find -loci
    collect2: ld returned 1 exit status
    error: command 'gcc' failed with exit status 1

    Reading 'man' for gcc this *seems* to be a problem because the linker is
    looking for a file called liboci.a which, naturally, doesn't exist under
    windows. I think I should be linking to oci.dll, but I don't know enough
    to be sure.
    I've little experience with Cygwin, but I have some with mingw32.

    You need to create an import library for the oci.dll fle. The import
    library will have a name liboci.a. This is a two-step task.

    1) Create a .def file for the DLL
    2) Create the import library

    Assuming the mingw approach also works with Cygwin (which I'm 95 % sure
    it does), you can look here: http://www.mingw.org/docs.shtml in the
    section "How to create a def file for a dll".

    This should work (more options at the URL above):

    echo EXPORTS > oci.def
    nm oci.dll | grep ' T _' | sed 's/.* T _//' >> oci.def
    dlltool --def oci.def --dllname oci.dll --output-lib liboci.a

    Be sure to put liboci.a in a place where Python finds it when linking.

    Gerhard
    --
    This sig powered by Python!
    Au?entemperatur in M?nchen: 8.2 ?C Wind: 0.3 m/s
  • Jason Tishler at Feb 11, 2002 at 2:16 pm
    Andy,
    Now everything is fine until we reach this stage;

    gcc -shared -Wl,--enable-auto-image-base build/temp.cygwin-1.3.9-i686-
    2.2/cx_Oracle.o -L/Tools/Lib -L/usr/lib/python2.2/config -loci -
    lpython2.2 -o build/lib.cygwin-1.3.9-i686-2.2/cx_Oracle.dll -s
    /usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/../../../../i686-pc-
    cygwin/bin/ld: cannot find -loci
    collect2: ld returned 1 exit status
    error: command 'gcc' failed with exit status 1

    Reading 'man' for gcc this *seems* to be a problem because the linker is
    looking for a file called liboci.a which, naturally, doesn't exist under
    windows. I think I should be linking to oci.dll, but I don't know enough
    to be sure.

    Any suggestions, pointers or re-education would be most welcome.
    You *should* be able to link directly with the DLL -- although, it is
    recommended to link against the corresponding import library instead.

    Create an import library, if necessary. I recommend pexports:

    http://www.cygwin.com/ml/cygwin/2000-03/msg00694.html

    Here are some (possibly useless) suggestions:

    o Try using the "-v" option to see what is really going on.
    o Did you supply the correct -L option to find -loci?
    o Try replacing -loci with oci.dll.

    HTH,
    Jason

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedFeb 6, '02 at 2:55a
activeFeb 11, '02 at 2:16p
posts3
users3
websitepython.org

People

Translate

site design / logo © 2022 Grokbase