Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Mysteries of Oracle, Windows, and cygwin

by Cody Fendant (Hermit)
on Sep 05, 2018 at 03:19 UTC ( [id://1221724]=perlquestion: print w/replies, xml ) Need Help??

Cody Fendant has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to get DBD::Oracle to work on windows via cygwin.

Problem number one, it doesn't know where ORACLE_HOME is, when I run perl Makefile.PL

I have solved this by manually setting an ORACLE_HOME into the $ENV, now the perl Makefile.PL command works.

Now I try to run make and this fails with the following:

Oracle.h:37:17: fatal error: oci.h: No such file or directory #include <oci.h> ^ compilation terminated. make: *** [Makefile:378: Oracle.o] Error 1

I thought the way to solve this was to run the Makefile with this argument:

 perl Makefile.PL INC='-I/cygdrive/c/app/myname/product/12.1.0/client_2/oci/include/'

Which is exactly where the oci.h file can be found.

So, what am I doing wrong?

The second and even greater mystery is that when I installed the Oracle client, it installed its own Perl executable. Should I be using this to run/install DBD?

Spoiler, I tried that and it didn't work.

Replies are listed 'Best First'.
Re: Mysteries of Oracle, Windows, and cygwin
by marto (Cardinal) on Sep 05, 2018 at 06:13 UTC
Re: Mysteries of Oracle, Windows, and cygwin
by bliako (Monsignor) on Sep 05, 2018 at 11:24 UTC

    passing the include dirs to the C compiler is usually done via the CFLAGS (or CXXFLAGS for c++). Perhaps you should try:

      perl Makefile.PL CFLAGS='-I/cygdrive/c/app/myname/product/12.1.0/client_2/oci/include/'

    If that works, then probably you will fail at the link phase with something like undefined symbols. That calls for the LDFLAGS and setting it to point to the dir containing the libraries, for example:

    perl Makefile.PL CFLAGS='-I/cygdrive/c/app/myname/product/12.1.0/client_2/oci/include/' LDFLAGS='-L/abc/xyz/'

    But if it did find ORACLE_HOME why did it not write all these flags into the Makefile in the first place?

    Check ExtUtils::MakeMaker doc for more options if indeed your makefile is of that flavour.

Re: Mysteries of Oracle, Windows, and cygwin
by syphilis (Archbishop) on Sep 05, 2018 at 12:03 UTC
    perl Makefile.PL INC='-I/cygdrive/c/app/myname/product/12.1.0/client_2/oci/include/'

    Just noticed the single quotes in the command. Might that be the problem ?

    I always use double quotes for the INC arg on Windows - but since there's no spaces in the specified path you perhaps don't need any quotes at all in this instance.

    And what about the missing "C:" (or whatever drive it is) ... does that matter ?
    UPDATE: Brainfart - this is Cygwin, and therefore no drive letter. (Thanks Corion.)

    Cheers,
    Rob
      And what about the missing "C:" (or whatever drive it is) ... does that matter ? UPDATE: Brainfart - this is Cygwin, and therefore no drive letter.

      Tiny point but it's not "no drive letter". The drive letter is there: cygdrive/c/app/myname/product/12.1.0/client_2/oci/include/. It's virtualised or aliased or whatever to that letter after 'cygdrive'.

Re: Mysteries of Oracle, Windows, and cygwin
by afoken (Chancellor) on Sep 05, 2018 at 17:11 UTC
    The second and even greater mystery is that when I installed the Oracle client, it installed its own Perl executable. Should I be using this to run/install DBD?

    No. It is usually old and not needed except to recreate parts of the Oracle software that are already installed on your computer. Try to get rid of it.

    Oracle Installer is a pain, perhaps get rid of the entire Oracle installation and install "Instant Client" instead. As a rule of thumb, install only the ODBC driver (that depends on all required libraries and so also installs them) and everything that looks like "development", "libraries", "headers".

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

      In my experience Oracle do use the perl they ship, getting rid of it is a bad idea IMHO.

Re: Mysteries of Oracle, Windows, and cygwin
by Cody Fendant (Hermit) on Sep 06, 2018 at 09:15 UTC

    I don't have a great answer to this, in the sense of fixing my original problem.

    However I can say that the most recent Strawberry Perl comes with a readymade DBD::Oracle and it worked without a problem. So I have a solution to the general case "can I get Perl working with Oracle on Windows?" at least.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1221724]
Approved by Athanasius
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (2)
As of 2024-04-26 06:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found