snoofkin
snoofkin

Reputation: 8895

How to manually install XS modules?

Correct me if i'm wrong, but XS and Dynaloader based modules are those who use C/C++ shared objects (.so) and which are not PP (Pure Perl)?

Now assuming I have a machine, which does not have web-connectivity whatsoever (Solaris 10) and I want, for instance, to install Crypt::OpenSSL::AES (XS based module), copying the AES.pm file to the relevant path in @INC wont do any good since my system does not have libssl installed.

My second and most important question is, how do I install such modules when I don't have CPAN? my approach is:

  1. first get libssl for my platform, compile it, but where should I put that shard object file so that perl can find it?
  2. when I have libssl installed and compiled and located where it should be, is it enough now to just copy the AES.pm to the relevant path in @INC, or do I need to configure / make it?

Upvotes: 7

Views: 1560

Answers (2)

Matteo
Matteo

Reputation: 14930

  1. If you don't have root access I would install in ${HOME}/lib. Just make sure that the linker can find it, either the directory should be in you LD_LIBRARY_PATH environment variable, or better point EU::MM to the library and include files.

  2. No, the module also have a part in C which has to be compiled.

To install

Download the distribution tarball: http://search.cpan.org/CPAN/authors/id/T/TT/TTAR/Crypt-OpenSSL-AES-0.02.tar.gz

Then follow the steps in the README file under INSTALLATION

perl Makefile.PL INC="-I $HOME/include" LIBS="-L $HOME/lib"
make
make test
make install

This will make sure that the module is correctly build, tested and installed.

Upvotes: 6

LeoNerd
LeoNerd

Reputation: 8532

CPAN itself is part of the base perl install. It will always be available.

If you can't use the cpan shell to talk to the internet and fetch modules, you can at least grab the tarball from the CPAN website, put it on the target machine, untar it, then run

$ cpan .

from inside the unpacked directory. This will run the CPAN installer for that distribution. Of course if it finds missing dependencies, you'll have to fetch those yourself recursively using the same technique.

Upvotes: 7

Related Questions