How to manually install XS modules?

Correct me if I am wrong, but modules based on XS and Dynaloader are those who use common C / C ++ objects (.so) and which are not PP (Pure Perl)?

Now suppose I have a machine that does not have a web connection at all (Solaris 10), and I want to install, for example, Crypt::OpenSSL::AES (XS-based module) by copying the AES.pm file to the appropriate path @INC will not do anything good, since my system is not installed libssl.

My second and most important question: how to install such modules when I do not have CPAN? my approach:

  • get libssl for my platform first, compile it, but where should I put this shard object file so that it can find it?
  • When I have libssl installed and compiled and located where it should be, is it enough now just to copy AES.pm to the appropriate path in @INC, or do I need to configure / do it?
+6
source share
2 answers
  • If you do not have root access, I would set it to ${HOME}/lib . Just make sure that the linker can find it, either the directory must be in your environment variable LD_LIBRARY_PATH , or it is better to specify EU :: MM in the library and include the files .

  • No, the module also has a part in C that needs to be compiled.

to install

Download the tarball distribution: 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 in the INSTALL section

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

This will ensure the correct assembly, testing and installation of the module.

+6
source

CPAN itself is part of the basic perl installation. He will always be available.

If you cannot use the cpan shell to communicate with the Internet and receive modules, you can at least grab the tarball from the CPAN site, put it on the target machine, deploy it, and then run

 $ cpan . 

from the unpacked directory. This will launch the CPAN installer for this distribution. Of course, if he finds the missing dependencies, you will have to extract them recursively using the same technique.

+6
source

Source: https://habr.com/ru/post/919980/


All Articles