Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Do you know where your variables are?
 
PerlMonks  

problem finding symbol in XS-created .so

by geoffleach (Beadle)
on May 24, 2010 at 17:12 UTC ( #841428=perlquestion: print w/ replies, xml ) Need Help??
geoffleach has asked for the wisdom of the Perl Monks concerning the following question:

I'm attempting to diagnose a problem with Audio::TagLib, which is basically a collection of XS interfaces to the taglib library. The test script:
use Audio::TagLib; $id3 = Audio::TagLib::FileRef->new( 't.mp3' );
fails with the message:
Can't locate object method "new" via package "Audio::TagLib::FileRef" at MP3test.pl

I've stepped through XSLoader, and it appears to be working correctly. The xs binary is installed: /usr/local/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi/ auto/Audio/TagLib/TagLib.so The .bs is there as well. It's empty. This appears to be correct. nm TagLib.so finds T XS_TagLib__FileRef_new.

I'm using 5.10.0. The dist uses ExtUtils::MakeMaker, and that's up to date.

Any suggestions on how to diagnose the problem?

Thanks.

Comment on problem finding symbol in XS-created .so
Select or Download Code
Re: problem finding symbol in XS-created .so
by chuckbutler (Priest) on May 24, 2010 at 21:57 UTC

    chmod permissions set for execute on the .so file? Just wondering.

    Good luck. -c

      -r-xr-xr-x 1 root root, alas. Thanks.
Re: problem finding symbol in XS-created .so
by Anonymous Monk on May 25, 2010 at 07:06 UTC
    Any suggestions on how to diagnose the problem?

    Start from scratch, try with http://search.cpan.org/CPAN/authors/id/D/DO/DONGXU/Audio-TagLib-1.50_01.tar.gz.

    Something is going wrong with the XS generation, some file is not being included....all the test failures are about methods/symbols like new not being found.

    Seeing how ppport.h is version 3.06, and the latest available is Devel-PPPort-3.19_02, you should update that first and run perl ppport.h. This has a good chance of fixing the problem ( or revealing the real problem), since apparently Audio-TagLib works for the author with perl5.8.7 (which I infer from the authors ppport.h).

      Alas, no joy. No change in the behaviour.

      Both 1.50_01 (which I'm working with) and 1.43 have the same problem.

      Thanks.

Re: problem finding symbol in XS-created .so
by syphilis (Canon) on May 25, 2010 at 09:34 UTC
    $id3 = Audio::TagLib::FileRef->new( 't.mp3' );

    But fileref.xs defines functions (such as new) that are in package "TagLib::FileRef", *not* package "Audio::TagLib::FileRef". What happens if you recode that line to:
    $id3 = TagLib::FileRef->new( 't.mp3' );
    Cheers,
    Rob
      Can't locate TagLib/FileRef.pm in @INC ...
        No ... you still use Audio::TagLib; (Update: not use Audio::TagLib::FileRef as I had first written) but, instead of $id3 = Audio::TagLib::FileRef->new( 't.mp3' );
        you have $id3 = TagLib::FileRef->new( 't.mp3' );

        I don't really know whether that will work - I'd probably rather try changing the package name in fileref.xs to "Audio::TagLib::FileRef", but I don't know whether that will work, either :-)
        The module looks to me like a dog's breakfast

        I'll see if I can get anywhere with it on Windows and get back. In the meantime, just try anything you can think of.

        Cheers,
        Rob
      It also defines a fix for that
      sub xs_c { my $cmd = shift->SUPER::xs_c(@_); $cmd .= << 'END'; sed -i -e 's/newXSproto("TagLib/newXSproto("Audio::TagLib/g' $*.c sed -i -e 's/XS(boot_TagLib)/XS(boot_Audio__TagLib)/g' $*.c END return $cmd; }
        I'm sory, but I have no idea how this code relates to my problem.
Re: problem finding symbol in XS-created .so
by ikegami (Pope) on May 25, 2010 at 17:49 UTC

    In the .c file generated from the .xs files,

    (void)newXSproto_portable("TagLib::FileRef::new", XS_TagLib__FileRef_n +ew, file, ";$$$");

    should be

    (void)newXSproto_portable("Audio::TagLib::FileRef::new", XS_TagLib__Fi +leRef_new, file, ";$$$");

    This is because every MODULE= and PACKAGE= directive is wrong.

    Replace every instance of
    MODULE = TagLib
    with
    MODULE = Audio::TagLib

    Replace every instance of
    PACKAGE = TagLib::...
    with
    PACKAGE = Audio::TagLib::...

      The changes suggested have resolved the problem.

      Many thanks

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://841428]
Approved by lostjimmy
Front-paged by Argel
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2014-04-18 06:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (462 votes), past polls