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

I'm trying to install MooseX::Declare under Cygwin. I downloaded, built and installed Perl 5.12.1 /usr/local. When I try to install MooseX::Declare I get problems with it's dependency Devel::Declare. This is the error I see:

Checking if your kit is complete... Looks good Note (probably harmless): No library found for -lCheck Writing Makefile for Devel::Declare cp lib/Devel/Declare/Context/Simple.pm blib/lib/Devel/Declare/Context/ +Simple.pm cp lib/Devel/Declare.pm blib/lib/Devel/Declare.pm cp lib/Devel/Declare/MethodInstaller/Simple.pm blib/lib/Devel/Declare/ +MethodInstaller/Simple.pm /usr/local/bin/perl.exe "-Iinc" /usr/local/lib/perl5/5.12.1/ExtUtils/x +subpp -typemap /usr/local/lib/perl5/5.12.1/ExtUtils/typemap Declare +.xs > Declare.xsc && mv Declare.xsc Declare.c gcc -c -I/usr/local/lib/perl5/site_perl/5.12.1/cygwin-thread-multi-64 +int/B/Hooks/OP/Check/Install -DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ + -fno-strict-aliasing -pipe -DUSEIMPORTLIB -O3 -DVERSION=\"0.006000 +\" -DXS_VERSION=\"0.006000\" "-I/usr/local/lib/perl5/5.12.1/cygwin-t +hread-multi-64int/CORE" Declare.c Running Mkbootstrap for Devel::Declare () chmod 644 Declare.bs rm -f blib/arch/auto/Devel/Declare/Declare.dll g++ --shared -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,- +-stack,8388608 -Wl,--enable-auto-image-base -L/usr/local/lib Declare. +o -o blib/arch/auto/Devel/Declare/Declare.dll \ /usr/local/lib/perl5/5.12.1/cygwin-thread-multi-64int/CORE/c +ygperl5_12_1.dll \ Declare.o:Declare.c:(.text+0x6624): undefined reference to `_hook_op_c +heck' Declare.o:Declare.c:(.text+0x663a): undefined reference to `_hook_op_c +heck' collect2: ld returned 1 exit status make: *** [blib/arch/auto/Devel/Declare/Declare.dll] Error 1 FLORA/Devel-Declare-0.006000.tar.gz /usr/bin/make -- NOT OK Running make test Can't test without successful make Running make install Make had returned bad status, install seems impossible

I googled around and found this bug. Great, its fixed! However, perldoc perllocal says this:

Sat Aug 14 06:39:37 2010: "Module" ExtUtils::Depends · "installed into: /usr/local/lib/perl5/site_perl/5.12.1" · "LINKTYPE: dynamic" · "VERSION: 0.302" · "EXE_FILES: "

which appears to be the lastest version. I looked at the git repository and it appears the fix is fact in this version. So, now what?

One other thing may be relevant...prior to installing Perl 5.12.1 I had installed Perl 5.13 and attempted to fetch MooseX::Declare, but had some other issues and decided to try the safe approach. Possibly something from this earlier attempt is interfering with the 5.12?

EDIT: As syphilis pointed out, I didn't really say what my problem is. The problem is that I'm getting this error despite the fact that I have the version of ExtUtils::Depends with the bug fix in it.

Replies are listed 'Best First'.
Re: Error with ExtUtils::Depends under Cygwin
by syphilis (Archbishop) on Aug 15, 2010 at 01:29 UTC
    Thanks for clarifying things. I've just built Devel::Declare on Cygwin (perl-5.10.1) without any problems.

    You got:
    Checking if your kit is complete... Looks good Note (probably harmless): No library found for -lCheck Writing Makefile for Devel::Declare
    I didn't get that "probably harmless" warning - it's no doubt *not* harmless.
    The "-lCheck" is the link to auto/B/Hooks/OP/Check/Check.dll, and that's your (missing) link that will resolve the errors you got. Could you run 'make realclean', followed by 'perl Makefile.PL' and then open the generated Makefile. What's contained in the EXTRALIBS and LDLOADLIBS entries in that file ? It should be the same entry in both, and it needs to be:
    EXTRALIBS = -L/path/to/Check_dll -lCheck LDLOADLIBS = -L/path/to/Check_dll -lCheck
    where /path/to/Check_dll is the folder that contains Check.dll. I don't know what that will be for you ... perhaps something like:
    /usr/lib/perl5/site_perl/5.12/i686-cygwin/auto/B/Hooks/OP/Check
    Once the Makefile is corrected, you should be able to run 'make test' and 'make install' successfully.

    That's a hack, not a proper solution - but I've no intention of trying to work out a proper solution where (the monstrosity that goes by the name of) Module::Install is involved in the build process.

    Cheers,
    Rob

      Thanks syphilis, that did the trick!

      I found the check library in:

      /usr/local/lib/perl5/site_perl/5.12.1/cygwin-thread-multi-64int/auto/B +/Hooks/OP/Check

      The Makefile had no EXTRALIBS or LDLOADLIBS settings, so I added them per your suggestion and the module built and installed correctly. Interestingly, I also found this line in the Makefile:

      # LIBS => q[-L/usr/local/lib/perl5/site_perl/5.12.1/cygwin-thread- +multi-64int/auto/B/Hooks/OP/Check -lCheck]
      ...so at some point it did know where the library was, but didn't actually use it. I tried to install MooseX::Declare again and got the same failure when it got to Devel::Declare, which I resolved the same way. Afterwards the install completed without problems. Not sure if the underlying problem is a bug in the tool chain, a bug in Cygwin, or just some strangeness with my system, but everything seems to be working now.

        Not sure if the underlying problem is a bug in the tool chain, a bug in Cygwin, or just some strangeness with my system, but everything seems to be working now

        Probably none of the above. I suspect it's the version of ExtUtils::MakeMaker that's responsible. The version of EU::MM that shipped with my Cygwin's perl (5.10.1) is 6.55_02. I don't think that's an official release of EU::MM. It's more likely to be one that the Cygwin folk have put together to cater for shortcomings in the official version - such as the refusal to accept 'dll' as a file extension against which linking can occur.

        There seems to be an (overly) ultra-conservative approach to fixing EU::MM and I know that ActiveState release their own renditions of EU::MM with ActivePerl. Looks like Cygwin might be doing the same. When you build perl from source you, of course, get to use only the official (crippled) version of EU::MM.

        If you can locate and install this 6.55_02 version, you'll probably be better off.

        UPDATE: Looks like Cygwin also provide their own build of ExtUtils::Depends, so it's also possible that the solution to your problem lies in there

        Cheers,
        Rob
Re: Error with ExtUtils::Depends under Cygwin
by syphilis (Archbishop) on Aug 14, 2010 at 14:37 UTC
    Hi,

    You've told us that there was a problem installing Devel::Declare (for which you've found a fix) .... and that perldoc perllocal reports that you've installed ExtUtils-Depends-0.302.

    But what's your question ? (Sorry if I'm being stupid.)

    Cheers,
    Rob

      Sorry, I guess I wasn't clear. The fix I found, which seems to be for exactly the problem I am experiencing, is not working for me - Devel::Declare install still fails with the same error. I guess I could reopen the ticket or something, but I don't want to waste the developer's time if its something wrong with my setup, or something obvious I'm doing wrong which seems likely given my lack of knowledge. I guess I'm looking for suggestions of other things to try. I don't understand how these modules work well enough to proceed on my own.