One way to install Perl's DBI/DBD modules
Nov 08, '06 07:30:01AM
Contributed by: benholt
This may be kind of obscure, but if you're into Perl and trying to install modules via CPAN, specifically the DBI and DBD ones, things can get hairy. I spent a few hours trying to install these modules from source and from the CPAN perl shell. Neither worked, but gave frustrating errors that were impossible to track down. After a bunch of testing, I found the solution:
- Install Fink.
- In a Terminal window, type fink list dbi or fink list dbd and you will see a list of available packages.
- Now type fink install dbi-pm586 (that's the default DBI package for Perl 5.8.6)
- Here's the tricky part. Fink installs the modules in /sw -> lib -> perl5 -> 5.8.6 -> darwin-thread-multi-2level, which is not in your normal @INC when you run perl scripts. I'm sure you could recompile Perl to include Fink's installation directory, or move the files to the right places, but instead I found a different way. In your perl script, simply put:
use lib '/sw/lib/perl5/5.8.6/darwin-thread-multi-2level';
and Perl will look in the correct directory.
This solution eliminates the annoying CPAN - compiler - make errors for me.
[robg adds: A much older hint refers to some compiler issues with gcc3 that prevent the DBI and DBD modules from compiling. The hint claims that simply changing the compiler to gcc2 solves those issues. I'm not sure if that's still relevant to the issue in this hint, but it might be something to look at. In any event, using the Fink versions appears to be a valid workaround.]
Comments (6)
Mac OS X Hints
http://hints.macworld.com/article.php?story=20061101085045782