January 2011 Archives

You don't need a watchdog while smoking perl when you have a watchcat


Hairy blib vs -I 5.6 note to myself

$ /usr/local/bin/perl5.6.2d-nt -Iblib/arch -Iblib/lib -MO=C 
    -e 'use Class::Accessor; print "ok"' | grep DynaLoader::dl_install_xsub
-e syntax OK


$ /usr/local/bin/perl5.6.2d-nt -Mblib -MO=C -e 'use Class::Accessor; print "ok"' | grep DynaLoader::dl_install_xsub
Using /cygdrive/d/data/urbanr/My Documents/Perl/B-C-work/blib
    gv_list[42] = gv_fetchpv("DynaLoader::dl_install_xsub", TRUE, SVt_PV);
    GvCV(gv_list[42]) = (CV*)(newXS("DynaLoader::dl_install_xsub", XS_DynaLoader_dl_install_xsub, (char*)xsfile));
-e syntax OK

What does blib do to fix the old compiler? Note that cwd contains spaces in the path.

The compiler uses something like

$ /usr/local/bin/perl5.6.2d-nt -I"/cygdrive/d/data/urbanr/My Documents/Perl/B-C-work/blib/arch" 
  -I"/cygdrive/d/data/urbanr/My Documents/Perl/B-C-work/blib/lib" -MO=C 
  -e 'use Class::Accessor; print "ok"' | grep DynaLoader::dl_install_xsub

Explanation of the problem

With -I the compiler - only on 5.6 - misses to detect DynaLoader as it is needed to load XS functions, Sub::Name in this case. When parsing all op's and sv's the compiler sees a XSUB and may decide that it needs to bootstrap DynaLoader because it's a dynaloaded XS not a static one, so that it can boostrap the needed XSUB at run-time. Here it fails to detect this. DynaLoader::dlinstallxsub is one of the needed functions for the DynaLoader run-time. Bad things happen all the time, but here it is unexpected and it is very strange that it works if I use -Mblib instead.

Explanation of the root cause

Need to investigate it later

Why Module::Build sucks

I never understood why Module::Build attracted people at all

It is limited, broken and has less features than the good old EU::MM (ExtUtils::MakeMaker).

1. dependencies, like the equivalent of make or make clean never works.
It does not check or clean important intermediate dirs and object files.
I always have to do a make realclean, to start testing with a new perl,
or updated xs file.

2. You cannot use a XS as a submodule in your package.
E.g. with Base\XS.xs windows builds will fail. Windows only!