in reply to Help building Devel::Caller

It's, as stated, typically a problem you have with Module::Build in ActivePerl with the non-original C compiler — thus: MinGW. What happens is that Module::Build for some obscure reason uses -lperl58 as a libary to link against, which is short for perl58.lib in any searched directory, but the directory C:\Perl\lib\CORE, where perl58.lib actually resides, isn't in the search path.

The problem is so bad that I can't even install Module::Build 0.2805, because the tests fail for the exact same reason.

The solution that works for me, is find a way to specify that directory into the command line for the linker. Open the file C:\Perl\site\lib\ActivePerl\Config.pm, and replace the line 108,

_override("lddlflags", "-mdll");
which is one of the parameters passed to the linker, with
_override("lddlflags", "-mdll -LC:/Perl/lib/CORE");
Now, Module::Build passes all tests. And, after installing Module::Build, so does Devel::Caller.

Replies are listed 'Best First'.
Re^2: Help building Devel::Caller
by Limbic~Region (Chancellor) on Aug 02, 2006 at 16:36 UTC
    bart,
    Very interesting though this workaround is just that - a workaround. I would be interested in knowing who the right people are to get a real fix for this. The alternative I found for Devel::Caller was just to bypass Module::Build though I have confirmed your workaround also works.

    Cheers - L~R

      Despite your skeptiscism, after some more digging together with Intrepid who enjoys messing with build problems, I appear to have found the exact spot of the problem. You see, here is the line in Config Config_heavy.pl for ActivePerl5.8.8:
      lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf -libpath:"C +:\Perl\lib\CORE" -machine:x86'

      And here is what is made of in in ActivePerl::Config:

      _override("lddlflags", "-mdll");
      which lists the option for the dynamic libraries, i.e. the DLLs made out of the XS modules.

      Do you see anything missing? Well, actually, a lot is missing, but most importantly, the command line switch to include the library search directory "C:\Perl\lib\CORE" is not there any more.

      So, with a bit of cleanup, i.e. poring the library path out of _orig_config instead of hardcoding it, I guess I have the most acceptable patch.

      update I've made a more politically correct patch, which gets the (MSVC style) -libpath: parameter switches out of the original lddlflags setting, and replaces each with the gcc style -L switch for MinGW. I've tested it and it seems to work, even with quotes and backslashes in place.

      _override("lddlflags", join " ", "-mdll", map "-L$_", map /^-libpath:(.+)/, _orig_conf("lddlflags") =~ /(?=\S)(?>[^"\s]+|"[^"]*")+/g);

      update The code has been updated (from a simple split " ") so it can properly handle spaces embedded between quotes.

        bart,
        It does not suprise me that there is a problem with ActiveState's customization as it isn't the first time I have encountered such a problem. The thing that has me puzzled is why this only appears to affect ActiveState with MinGW with Module::Build. Trying other configurations have worked just fine for me.

        Update: I suppose it is because ExtUtils::MakeMaker specifies an absolute path to perl58.lib and MSVC++ doesn't use the customize configuration.

        Cheers - L~R