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

Hi all,
I'm using perl 5.8.4 on solaris with OS 5.10.
I wrote the simplest C++ class (only has one method that returns the number 23).
created the .xs file using h2xs and updated the Makefile.PL according, created the Makefile,
compiled my files,
installed the new created module and I'm getting :
"Can't locate TamarLog.pm in..."

Does someone have any experience with similar situations?

Thanks,
Tomer.
  • Comment on Creating my own perl module from c++ code

Replies are listed 'Best First'.
Re: Creating my own perl module from c++ code
by moritz (Cardinal) on Jul 22, 2009 at 08:20 UTC
    Can you use it from the build tree, for example when you run perl -Ilib -MTamarLog -e e?

    You should test the various stages one by one, ie first that it compiles, then that it runs from the build tree, and only if that works look towards installing.

      Well I have an update,
      I noticed that the "make install" didn't put the TamarLog.pm in the correct place.
      I put it in one of the @INC directories. and then I get a new and improved error:
      "ld.so.1: perl: fatal: relocation error: file /usr/perl5/site_perl/5.8.4/sun4-solaris-64int/auto/TamarLog/TamarLog.so: symbol __1c2n6FI_pv_: referenced symbol not foun"

      The thing is that this exact same process worked fine on a Win32 machine.
      First of all thanks for your help,
      I tried running it as you said:
      root > perl -I./lib/ -MTamarLog -e 'my $x = new TamarLog(); print $x->PrintError("YESH\n");'
      ld.so.1: perl: fatal: relocation error: file /usr/perl5/site_perl/5.8.4/sun4-solaris-64int/auto/TamarLog/TamarLog.so: symbol __1c2n6FI_pv_: referenced symbol not found
      Killed

      any idea?
        Well, in your build directory, ./lib is the directory where you may (but don't have to) work on your Perl sources. It's not the directory where the finished products are placed - neither the Perl modules, nor the C libraries. They are in subdirectories in blib. Try, after running 'make':
        perl -Iblib/lib -Iblib/arch -MTamarLog -e '...'
        But, assuming you have test files, should have succeeded, as this is what 'make test' does as well.