http://www.perlmonks.org?node_id=1010898


in reply to Investigating Devel::Pragma's broken install on Cygwin, need help to fix it. ExtUtils::Depends possibly guilty??

The hook_op_annotation.h file is not found by g++

I don't think it needs to find that file - the build just needs to link to /usr/lib/perl5/site_perl/5.14/i686-cygwin-threads-64int/auto/B/Hooks/OP/Annotation/libAnnotation.a.
I can see that the location of that file was spelt out with:
-L/usr/lib/perl5/site_perl/5.14/i686-cygwin-threads-64int/auto/B/Hooks +/OP/Annotation
But the crucial -lAnnotation is missing. What happened to it ?
Did the 'perl Makefile.PL' step warn of "no library found for -lAnnotation" ?
If it did, then the build process won't even try to link to that file. Otherwise, it's probably a case of ExtUtils-Depends forgetting to put the -lAnnotation in.

Try opening the generated Makefile, find the 2 separate lines beginning EXTRALIBS and LDLOADLIBS, add (by hand) the -lAnnotation at the end of each of those 2 lines, then run 'make' again.

That ghastly hack will work with any luck .... assuming that /usr/lib/perl5/site_perl/5.14/i686-cygwin-threads-64int/auto/B/Hooks/OP/Annotation/libAnotation.a (which should have been installed as part of B::Hooks::OP::Annotation) exists.
Another snag might be that the order in which -lCheck and -lAnnotation are specified in those 2 lines is important.

Sorry - too many dependencies for me to actually try this out for myself.

Cheers,
Rob

Replies are listed 'Best First'.
Re^2: Investigating Devel::Pragma's broken install on Cygwin, need help to fix it. ExtUtils::Depends possibly guilty??
by mascip (Pilgrim) on Dec 30, 2012 at 12:14 UTC

    Indeed! I should have mentioned this: -lAnnotation was not found.

    I must say, there is no *.a file nor libAnnotation* file, neither in the built distro, nor in the *.tar.gz archive. Is it created by the Makefile?

    There are no line beginning with EXTRALIBS or LDLOADLIBS. The only place i find them in is here:

    # --- MakeMaker dynamic_lib section: # This section creates the dynamically loadable $(INST_DYNAMIC) # from $(OBJECT) and possibly $(MYEXTLIB). ARMAYBE = : OTHERLDFLAGS = INST_DYNAMIC_DEP = INST_DYNAMIC_FIX = $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR +)$(DFSEP).exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(PERL_ARCHIVE_AFTER) + $(INST_DYNAMIC_DEP) $(RM_F) $@ $(LD) $(LDDLFLAGS) $(LDFROM) $(OTHERLDFLAGS) -o $@ $(MYEXTLIB) + \ $(PERL_ARCHIVE) $(LDLOADLIBS) $(PERL_ARCHIVE_AFTER) $(EXPORT_LIS +T) \ $(INST_DYNAMIC_FIX) $(CHMOD) $(PERM_RWX) $@ # --- MakeMaker static section: ## $(INST_PM) has been moved to the all: target. ## It remains here for awhile to allow for old usage: "make static" static :: $(FIRST_MAKEFILE) $(INST_STATIC) $(NOECHO) $(NOOP) # --- MakeMaker static_lib section: $(INST_STATIC) : $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DFSEP).exi +sts $(RM_RF) $@ $(FULL_AR) $(AR_STATIC_ARGS) $@ $(OBJECT) && $(RANLIB) $@ $(CHMOD) $(PERM_RWX) $@ $(NOECHO) $(ECHO) "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)/extralibs.l +d
    which i don't understand.

    And neither -lCheck nor -lAnnotation are mentioned in the Makefile.

    It feels like we're getting closer to the bug :-)

      When you installed B::Hooks::OP::Annotation, you would have built and installed (among other things) a file named:

      /usr/lib/perl5/site_perl/5.14/i686-cygwin-threads-64int/auto/B/Hooks/OP/Annotation/Annotation.dll.

      Devel::Pragma assumes that /usr/lib/perl5/site_perl/5.14/i686-cygwin-threads-64int/auto/B/Hooks/OP/Annotation/libAnnotation.a would also have been built and installed ... but I *now* think that didn't happen.
      So, one option is to build an import lib named libAnnotation.a (in the same directory as Annotation.dll).
      You can do this by cd'ing to the directory that contains Annotation.dll and running:
      gendef Annotation.dll dlltool --kill-at --input-def Annotation.def --output-lib libAnnotatio +n.a
      (At least that's what I would run on MS Windows with MinGW, and I think it would be the same command for Cygwin.)
      You probably already have dlltool (my Cygwin does) and there's a gendef package available for Cygwin if you don't already have it.

      You then need to repeat the same procedure for B::Hooks::OP::Check - ie create a libCheck.a for the Check.dll that was built and installed when you installed B::Hooks::OP::Check.

      With any luck, Devel::Pragma will then build straight out of the box for you. Then there's the fun of working out what the bug is, and whose responsibility it is.
      Welcome to the wonderful world of ExtUtils::Depends.

      Cheers,
      Rob

        Two weeks and two computer crashes later (on my other computer), here i am. My reasons for using Windows have been re-assessed, and i will simply stop and go back to Linux.

        I have made a bit more effort to install Devel::Pragma though, in case it will help someone with the same problem.

        First, gendef was not installed on my computer and i wasn't told during B::Hooks::OP::Annotation installation. Whose reponsibility was it to tell me? Can i/should i send a bug report somewhere?

        So, i installed it and did what you said. Now the "libAnnotation.a bug" is fixed! Thank you!

        But i encounter a new obstacle: chmod doesn't always work in Cygwin. It is explained here, as well as a way to fix it: http://cygwin.com/faq/faq-nochunks.html#faq.using.chmod.

        But for people like me who don't know these technicalities, there are 3-4 pages documentation that you have to read, if you want to fix chmod. I just don't have the time now, as i'm going back to Linux. I think that this kind of information should be included in this page: http://search.cpan.org/~rjbs/perl-5.16.2/README.cygwin
        I have sent a draft paragraph and send it to this page's authors.

        Thanks, building the two lib_.a files for Annotation and Check fixed this issue for me and I can build Method::Signatures now.

        Out of interest, (and I know you've mentioned the wonderful world of ExtUtils::Depends, but I'll ask anyway :) why?

        From reading about dlltool it sounds like this is building an interface library for the exported functions from the real dll. Is this just a missing artefact from the the B::Hooks::OP::_ builds on cygwin then? .a files don't appear to be common to the perl modules I have on my system, most just have a .dll.
        Thank you so much for posting this! I was battling the same problem and stumbled across this post and it really saved the day. I was finally able to install Method::Signatures in Cygwin Perl 5.14.