It's been a couple of days I am pulling my hair trying to get a legacy Perl script working as cgi within an apache2 server. It requires Crypt::OpenSSL::AES. From the Apache error logs:
Can't locate Crypt/OpenSSL/AES.pm in @INC
The easiest would have been if a ubuntu package could install it with me, but I am unable to locate any package with the proper files. The following returns nothing:
apt-file search AES.pm
As a regular user, I have installed cpan and used it to install perl modules, so that Crypt::OpenSSL::AES is installed under my user directory at /home/user/.cpan/build/Crypt-OpenSSL-AES-0.02-H74J64/lib
. Unfortunately, whether I manually copy AES.pm to its proper location (/usr/local/lib/perl/5.10.1/...
as per @INC) or I add the PERL5LIB env variable within the apache2 configuration files (SetEnv PERL5LIB /home/user/.cpan/build/Crypt-OpenSSL-AES-0.02-H74J64/lib
), the error logs now show that there is a missing shared object:
Can't locate loadable object for module Crypt::OpenSSL::AES in @INC
The error mesage is subtly different from the first one (I didn't notice it at first): now it does find AES.pm, but there is another dependency on an unspecified "loadable object" and I have no clue which one. Openssl is installed on my system.
So:
Generally, what is the proper way (on a Linux-ubuntu system) to install perl modules to work with an apache2 server? (I searched and there are many answers to this question, but it still doesn't work).
Specifically, how can I properly satisfy my cgi perl application's dependency on Crypt::OpenSSL::AES?
I solved my problem:
Installing the package
Debian and Ubuntu
CentOS or Fedora
Compiling the module manually
Usually there are *-dev packages in the Ubuntu repository, for developers and administrators to build other software. So the packages to merely run the program can get smaller in size.
You should look at http://debian.pkgs.cpan.org/. It provides a way for you to generate your own .deb files from CPAN packages. You could try to just shotgun their pre-packaged ones, but just be very aware that they could break due to differences between the Debian machines they were built for and whatever version of Ubuntu you are using: "There be Dragon's Here."
How about creating package with
dh-make-perl
(https://wiki.debian.org/PerlFAQ)? A bit too late, but it might help to someone.