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

A couple of months back I installed Cygwin and MySQL (from an MSI Win install) on Vista. I also installed DBI, DBDmysql and the MySQL drivers. For a while DBI was working happily and I was able to access the database through Perl scripts with use DBI.

Recently I looked at some older scripts and discovered that DBI no longer works.

$ perl -e 'use DBI'; Can't locate DBI.pm in @INC (@INC contains: /usr/lib/perl5/5.10/i686-cygwin /usr/lib/perl5/5.10 /usr/lib/perl5/site_perl/5.10/i686-cygwin /usr/lib/perl5/site_perl/5.10 /usr/lib/perl5/vendor_perl/5.10/i686-cygwin /usr/lib/perl5/vendor_perl/5.10 /usr/lib/perl5/vendor_perl/5.10 /usr/lib/perl5/site_perl/5.8 /usr/lib/perl5/vendor_perl/5.8 .) at -e line 1.
I ran a search for DBI.pm on my local machine and it finds the following:
C:\cygwin\home\me\.cpan\build\DBI-1.601\blib\lib C:\cygwin\home\me\.cpan\build\DBI-1.601 C:\cygwin\lib\perl5\site_perl\5.8\cygwin C:\cygwin\home\me\.cpan\build\DBI-1.601\blib\lib\Bundle C:\cygwin\home\me\.cpan\build\DBI-1.601\lib\Bundle C:\cygwin\lib\perl5\site_perl\5.8\cygwin\Bundle
Does that fact that DBI.pm is in C:\cygwin\lib\perl5\site_perl\5.8\cygwin instead of \usr\lib\perl5\site_perl\5.8 (without specifying cygwin) really matter - doesn't @INC drill down recursively into the folders?

The permissions in the former folder (that contain the sub folder cygwin; that contains DBI.pm) are as follows:
me@me-cmp /usr/lib/perl5/site_perl/5.8 $ ll total 8 drwxrwxrwx+ 9 me Users 4096 Apr 13 21:05 . drwxrwxrwx+ 4 me Users 0 Jul 21 23:20 .. drwxr-xr-x+ 3 me Power Users 0 Jan 9 2008 File drwxr-xr-x+ 2 me Power Users 0 Jan 9 2008 Number drwxr-xr-x+ 2 me Power Users 0 Apr 13 21:04 OLE drwxr-xr-x+ 2 me Power Users 0 Apr 13 21:04 Parse drwxr-xr-x+ 3 me Power Users 0 Apr 13 21:05 Spreads drwxr-xr-x+ 2 me Power Users 0 Jan 9 2008 Text drwxrwxrwx+ 7 me Users 4096 Jul 21 23:18 cygwin
Cygwin has a different group owner and slightly different permissions but nothing really bad right?

If I cd into C:\cygwin\lib\perl5\site_perl\5.8\cygwin and rerun $ perl -e 'use DBI';
me@me-cmp /usr/lib/perl5/site_perl/5.8/cygwin $ perl -e 'use DBI'; Can't load './auto/DBI/DBI.dll' for module DBI: No such file or direct +ory at /usr/lib/perl5/5.10/i686-cygwin/DynaLoader.pm line 201. at DBI.pm line 266 BEGIN failed--compilation aborted at DBI.pm line 266. Compilation failed in require at -e line 1. BEGIN failed--compilation aborted at -e line 1.
Seems to me that for some reason some folders and files that are there can't be found - is this a permissions thing?

I tried adding C:\cygwin\lib\perl5 to the Windows Environment Variable - no joy. I also added a new PERL5LIB variable with the same value - no joy.

I'd rather not reinstall Cygwin and MySQL. Does anyone have any advice?

Thanks in advance o wise and experienced monks.

Replies are listed 'Best First'.
Re: Can't locate DBI.pm @INC (Cygwin + MySQL)
by moritz (Cardinal) on Aug 25, 2008 at 20:00 UTC
    It seems that you have upgraded your perl to 5.10, but haven't actually upgraded the modules. It's also weird that you have paths with 5.8 in them in @INC.

    So basically you need to install DBI with perl-5.10.0.

      Thanks. I'm not sure how both 5.8 and 5.10 are available. I think Perl is installed by default as part of Cygwin. I didn't get it from ActiveState.

      Had a go an installing DBI manually.

      Downloaded the CPAN package with get DBI.

      perl Makefile.pm - no problem.
      make - no problem
      make test - problems:
      t/80proxy...................skipped: modules required for proxy are pr +obably not installed (e.g., RPC/PlClient.pm) t/85gofer...................112/? 4 [main] perl 4580 C:\cygwin\b +in\perl.exe: *** fatal error - unable to remap C:\cygwin\lib\perl5\5. +10\i686-cygwin\auto\Data\Dumper\Dumper.dll to same address as parent( +0x860000) != 0x14E0000 4 [main] perl 4580 C:\cygwin\bin\perl.exe: *** fatal error - una +ble to remap C:\cygwin\lib\perl5\5.10\i686-cygwin\auto\Data\Dumper\Du +mper.dll to same address as parent(0x860000) != 0x14E0000 9 [main] perl 5256 child_info::sync: wait failed, pid 4580, Win3 +2 error 183 2844 [main] perl 5256 fork: child 4580 - died waiting for dll loadi +ng, errno 11 t/85gofer...................115/? 9 [main] perl 5256 child_info: +:sync: wait failed, pid 4580, Win32 error 183 2844 [main] perl 5256 fork: child 4580 - died waiting for dll loadi +ng, errno 11 # Failed test 'pipeone: DBD::Gofer::db do failed: DBD::Gofer transmi +t_request timed-out after 60 seconds [for Statement "UPDATE fruit SET dVal='apples' WHERE dVal='oranges'"] at t/85gofer.t line 173. # ' # at t/85gofer.t line 104. t/85gofer...................160/? # Looks like you failed 1 test of 21 +9.
      Any additional suggestions gratefully recieved, I'm no expert when it comes to CPAN, let alone what to do when it appears there are two versions of Perl running locally!

      Thanks in advance.
        Hi,

        I got a similar problem today and resolved it in the following way:

        kill all CygWin processes

        just start ash (it doesn't work with bash / rxvt etc.)

        check with ps that ash is the only process running (you should only see ash and ps)
        $ ps PID PPID PGID WINPID TTY UID STIME COMMAND 20764 1 20764 20764 con 41423 15:35:44 /usr/bin/ash 82492 20764 20764 82548 con 41423 16:34:35 /usr/bin/ps
        run rebaseall
        $ rebaseall
        now run the normal building steps
        $ perl Makefile.pl $ make $ make test $ make install
        and you should be fine