I installed packages, including Perl, from opencsw.org.  Then I tried to install the DBI bundle.  By default, CPAN attempts to compile package files with the same path and settings that perl was compiled with.  This is a problem since the build of perl distributed by OpenCSW was not compiled with the OpenCSW release of gcc, but with Sun Studio.  Here's how it can be fixed, in /opt/csw/share/perl/5.10.1/CPAN/Config.pm put the line:

'makepl_arg' => q[CC=/opt/csw/gcc4/bin/gcc LD=/opt/csw/gcc4/bin/gcc CCCDLFLAGS=-fPIC CCFLAGS='-D_REENTRANT
-I/opt/csw/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' OPTIMIZE=-march=i386],

assuming that gcc4 is the installed C compiler package.

From https://www.opencsw.org/mantis/view.php?id=1308