Confusion of Win32::ODBC under CygWin. Please help...

M

MartinM

Hi,

I use Perl under Cygwin. I need to use Win32::ODBC. It is located
in

c:\cygwin\lib\perl5\site_perl\5.8.2\cygwin-thread-multi-64int\Win32\ODBC.pm

but this path is not in @INC. There are just links 5.8.5 not 5.8.2
in the @INC and (to my surprise), the 5.8.5/cygwin-thread-multi-64int
is completely empty.

The @INC includes:
/usr/lib/perl5/5.8.5/cygwin-thread-multi-64int
/usr/lib/perl5/5.8.5
/usr/lib/perl5/site_perl/5.8.5/cygwin-thread-multi-64int
/usr/lib/perl5/site_perl/5.8.5
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.5/cygwin-thread-multi-64int
/usr/lib/perl5/vendor_perl/5.8.5
/usr/lib/perl5/vendor_perl

So the execution of code with use Win32::ODBC; ends up with
Can't locate Win32/ODBC...

If I copy content of 5.8.2/ into 5.8.5 it results with error

Can't load the
/usr/lib/perl5/site_perl/5.8.5/cygwin-thread-multi-64int/auto/Win32/ODBC/ODBC.dll
for module Win32/ODBC: dlopen: Win32 error 126 at
/usr/lib/perl5/site_perl/5.8.5/cygwin-thread-multi-64int/Dynaloader.pm
line 230



Please, can you send a piece of advice to me?

Martin
 
A

A. Sinan Unur

(e-mail address removed) (MartinM) wrote in
Hi,

I use Perl under Cygwin. I need to use Win32::ODBC. It is located
in

c:\cygwin\lib\perl5\site_perl\5.8.2\cygwin-thread-multi-64int\Win32\ODB
C.pm

but this path is not in @INC. There are just links 5.8.5 not 5.8.2
in the @INC and (to my surprise), the 5.8.5/cygwin-thread-multi-64int
is completely empty.
....

So the execution of code with use Win32::ODBC; ends up with
Can't locate Win32/ODBC...

If I copy content of 5.8.2/ into 5.8.5 it results with error

Can't load the
/usr/lib/perl5/site_perl/5.8.5/cygwin-thread-multi-64int/auto/Win32/ODB
C/ODBC.dll for module Win32/ODBC: dlopen: Win32 error 126 at
/usr/lib/perl5/site_perl/5.8.5/cygwin-thread-multi-64int/Dynaloader.pm
line 230

Please, can you send a piece of advice to me?


What is the output of perl -v?

It looks like your Win32::ODBC was compiled for perl 5.8.2 whereas you
have perl 5.8.5. You need probably need to reinstall Win32::ODBC.
 
C

Chris

MartinM said:
Hi,

I use Perl under Cygwin. I need to use Win32::ODBC. It is located
in

c:\cygwin\lib\perl5\site_perl\5.8.2\cygwin-thread-multi-64int\Win32\ODBC.pm

but this path is not in @INC. There are just links 5.8.5 not 5.8.2
in the @INC and (to my surprise), the 5.8.5/cygwin-thread-multi-64int
is completely empty.

The @INC includes:
/usr/lib/perl5/5.8.5/cygwin-thread-multi-64int
/usr/lib/perl5/5.8.5
/usr/lib/perl5/site_perl/5.8.5/cygwin-thread-multi-64int
/usr/lib/perl5/site_perl/5.8.5
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.5/cygwin-thread-multi-64int
/usr/lib/perl5/vendor_perl/5.8.5
/usr/lib/perl5/vendor_perl

So the execution of code with use Win32::ODBC; ends up with
Can't locate Win32/ODBC...

If I copy content of 5.8.2/ into 5.8.5 it results with error

Can't load the
/usr/lib/perl5/site_perl/5.8.5/cygwin-thread-multi-64int/auto/Win32/ODBC/ODBC.dll
for module Win32/ODBC: dlopen: Win32 error 126 at
/usr/lib/perl5/site_perl/5.8.5/cygwin-thread-multi-64int/Dynaloader.pm
line 230



Please, can you send a piece of advice to me?

My advice is to not try to mix and marry Cygwin Perl and ActiveState
Perl (assuming that is where you are getting Win32::ODBC from?). Not
only are you going to have the problems you speak of above, but you are
going to have other pathing issues as well (Cygwin/Unix style paths vs.
Windows paths with drive names). This has been my experience anyway.

My personal solution to this, since both Perls are actually native Win32
images, is to place a symlink in /usr/bin under Cygwin that points to
ActiveState Perl and use THAT in my Perl scripts under Cygwin that
require specific Win32 capabilities:

$ ln -sn /cygdrive/c/perl/bin/perl.exe /usr/bin/winperl.exe
$ winperl -v
....blah, blah, blah version information from AS Perl...
$ perl -v
....blah, blah, blah version information from Cygwin Perl...

Then begin all Cygwin Perl scripts that require Win32 modules with:

#!/usr/bin/winperl -w

The caveat with this is that AS Perl, even under Cygwin, still wants
Windows style pathings (eg. with drive letters, "\" etc.) whereas Cygwin
Perl expects Unix style pathings (eg. "/"). Not to mention your
she-bang is a little non-conventional. But the plus to the she-bang is
since AS Perl doesn't use the she-bang line (except to pick up options
like -w), then scripts written using 'winperl' work well at both the
Cygwin shell prompt as well as a regular Win32 Command Prompt window.

The symlink hack will also solve your version discrepancies as well
between the two versions. (I, for instance, am running AS Perl v5.8.3
and Cygwin Perl v5.8.2). I've found this to work best. YMMV.

HTH,
-ceo
 
A

A. Sinan Unur

My advice is to not try to mix and marry Cygwin Perl and ActiveState
Perl

That is not what he is doing at all.
(assuming that is where you are getting Win32::ODBC from?).

No. He is getting that from the lib directory of a previous version of perl
(from the Cygwin distribution).

You seem to be unaware of the fact that the cygwin setup program includes
the Win32 modules as an extra download that can be selected separately.
My personal solution to this, since both Perls are actually native
Win32 images, is to place a symlink in /usr/bin under Cygwin that
points to ActiveState Perl and use THAT in my Perl scripts under
Cygwin that require specific Win32 capabilities:

This is kinda nuts. You say not to mix various perls and then you go ahead
and do that.

The solution to the OP's problem is to install (using the Cygwin setup
program) the the Cygwin versions of the Win32 modules.

Sinan.
 
C

ChrisO

A. Sinan Unur said:
That is not what he is doing at all.




No. He is getting that from the lib directory of a previous version of perl
(from the Cygwin distribution).

You seem to be unaware of the fact that the cygwin setup program includes
the Win32 modules as an extra download that can be selected separately.

Indeed I was not aware and that certainly clouded my response. I would
be quite surprised however to see that the Win32 modules under Cygwin
compare well to the support in AS however. I'll have to check it out.
This is kinda nuts. You say not to mix various perls and then you go ahead
and do that.

This is not mixing them. They are *quite* separate using this method
(which you call "nuts".) In fact, the separation is the point. I think
you would find this a sensible solution if you tried it. It works
terrifically well.
The solution to the OP's problem is to install (using the Cygwin setup
program) the the Cygwin versions of the Win32 modules.

My last point remains moot in light of your revealing the presence of
the Win32 mods under Cygwin. I'll have to check these out before
commenting further.

-ceo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top