Makefile.PL and Shared Libraries 
Author Message
 Makefile.PL and Shared Libraries

I'm writing an XSUB that wraps a shared library on Solaris 2.6.  I can
get my code to compile, but when I run my test script, I get an error
like this:

1..1
ok 1
ld.so.1: perl: fatal: relocation error:
file /home/myuser/perlbld/lib/site_perl/5.005/sun4-solaris-
thread/auto/MyModule/MyModule.so: symbol myModuleCreateMsg: referenced
symbol not found
Killed

myModuleCreateMsg is a C routine in my shared library; clearly, perl
isn't finding it.

My Makefile.PL looks like this:

use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
    'NAME'      => 'MyModule',
    'VERSION_FROM' => 'MyModule.pm', # finds $VERSION
    'LIBS'      => ['-lmysharedlib -lsharedutil'],   # e.g., '-lm'
    'DEFINE'    => '',     # e.g., '-DHAVE_SOMETHING'
    linkext => {'LINKTYPE' => 'dynamic'},

    'INC'       => '-I.. -I../sharedlibdir',     # e.g., '-
I/usr/include/other'
);

Running ldd suggests that I'm not getting the shared library to link to
my XSUB's .so correctly (nothing gets listed).

Can someone suggest how to change my Makefile.PL so that I get the
correct linkage on Solaris?

Thanks,
Rob Thorne
AOL

-----
My Opinions Are My Own.  Who Else Would Have Them?

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Mon, 24 Jun 2002 03:00:00 GMT  
 Makefile.PL and Shared Libraries
[Posted and e-mailed.]

) ld.so.1: perl: fatal: relocation error:
) file /home/myuser/perlbld/lib/site_perl/5.005/sun4-solaris-
) thread/auto/MyModule/MyModule.so: symbol myModuleCreateMsg: referenced
) symbol not found
[...]
) myModuleCreateMsg is a C routine in my shared library; clearly, perl
) isn't finding it.
)
) My Makefile.PL looks like this:
[...]
)     'LIBS'      => ['-lmysharedlib -lsharedutil'],   # e.g., '-lm'
[...]
)     'INC'       => '-I.. -I../sharedlibdir',     # e.g., '-

I think the best option is:
  * Set the enviroment variable LD_RUN_PATH to the absolute
    path of F<../sharedlibdir> before you _build_ your module.
    [It doesn't need to be set when you _run_ your module.]

Or you can move your shared lib into a place like /lib.

Other possiblities that _might_ work:
  * Add "-L../sharedlibdir" to the 'LIBS' line.
  * Set the environment variable LD_LIBARY_PATH to the absolute
    path of F<../sharedlibdir> before you _run_ your module.
--
Tye McQueen    Nothing is obvious unless you are overlooking something
         http://www.metronet.com/~tye/ (scripts, links, nothing fancy)



Mon, 24 Jun 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Makefile corrupted after running perl Makefile.PL.

2. 'FIXIN' in Makefile.PL generated Makefile

3. Makefile.PL and changing tags in .pl and .pm files

4. Embeding perl in C++ shared library

5. Shared libraries on IRIX?

6. multi-threaded shared library -> single threaded perl

7. Shared Libraries

8. Shared library conflict

9. Modules using shared libraries

10. 5.001 under OSF1/3.0 with shared libraries?

11. error in loading shared Libraries

12. Can not find the shared library libperl.so while executing a C-program using Perl-interpreter

 

 
Powered by phpBB® Forum Software