http://www.perlmonks.org?node_id=1126648

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

Hi all, we currently have some servers where there are lots of software that has been custom compiled (perl, apache, mod_perl etc). Each time everything is compiled from source.

I'm experimenting and trying to learn to see if there's a better way to do this in future, but getting stuck on packaging Perl, and maybe I'm trying to do something that doesn't make sense.

Currently we compile Perl into /opt/perl and everything runs fine. I was thinking, maybe I could package this into an RPM (using checkinstall), and then install via rpm -ivh or yum whenever we want to provision a new server in future.

So I'm starting with a new virtualised box in vagrant. Compiling perl, and make install via checkinstall, so it packages it all up. This all looks fine, perl runs, its version 5.14.2 it creates a custom perl rpm.

I try and reproduce the steps (installing a fresh duplicate virtualbox) but instead of compiling perl, install the rpm I've just made.

Here, I get some dependency errors...

rpm -ivh perl-custom-5.14.2-1.x86_64.rpm

error: Failed dependencies: perl(DBD::SQLite) is needed by perl-custom-5.14.2-1.x86_64
perl(DBIx::Simple) is needed by perl-custom-5.14.2-1.x86_64
perl(FCGI) is needed by perl-custom-5.14.2-1.x86_64
perl(Mac::BuildTools) is needed by perl-custom-5.14.2-1.x86_64
perl(Mac::InternetConfig) is needed by perl-custom-5.14.2-1.x86_64
perl(Tk) is needed by perl-custom-5.14.2-1.x86_64
perl(Tk::Pod) is needed by perl-custom-5.14.2-1.x86_64
perl(Your::Module::Here) is needed by perl-custom-5.14.2-1.x86_64

This is confusing me. When I compile and run Perl, it doesn't complain about missing depencies like perl(DBD::SQLite)

However, installing the rpm it does. Where did those dependencies appear from ?

Am I going about this the wrong way anyway, and shouldn't try to create an rpm as it will conflict with other stuff (eg there is another perl 5.10.1 on there, but we currently run alongside it fine) ?

(This is on a Centos 6.5 install inside Vagrant/virtualbox)
Edit: rpm -qpR perl-custom-5.14.2-1.x86_64.rpm shows lots of dependencies including the missing ones, but I'm wondering why they get added in there in the first place

Replies are listed 'Best First'.
Re: Create an RPM for custom compiled Perl ?
by flexvault (Monsignor) on May 14, 2015 at 21:10 UTC

    Welcome Gib,

    I have never built a RPM on *nix, but I have multiple Perls on all of my *nix boxes. I compile the source in my home directory, and specify to install it into '/usr/opt/perl.5.xx.xx', and then I come up with names that I use to generate symbolic links, i.e.

    ln -s /usr/opt/perl5.14.2/bin/perl /usr/local/bin/perl.14.2 ln -s /usr/opt/perl5.14.2/bin/perl /usr/local/bin/myperl ln -s /usr/opt/perl5.14.2/bin/perl /usr/local/bin/vmperl . . .

    When I build a new Linux server, I just 'tar -c' the '/usr/opt/' directory and the linked Perl*, and then ftp the tar file to the new system. (Note: I do not touch the standard Perl shipped with the Linux distribution.) Then using 'tar -x' I install all my Perl versions on the new Linux server. One advantage is that all CPAN requirements will be on the new server. I have done this between Linux distributions successfully, but I may just have been lucky.

    If you need specifics, ask away! It just might help another admin in the future. If you need to get the RPM, another monk will have to help.

    Regards...Ed

    "Well done is better than well said." - Benjamin Franklin

Re: Create an RPM for custom compiled Perl ?
by thomas895 (Deacon) on May 15, 2015 at 01:31 UTC

    Check your .spec files to make sure you haven't declared the offending packages as dependencies, or that any dependencies that you declare in your spec file don't depend on those packages. If they do, you may want to specify that your RPM provides these.

    -Thomas
    "Excuse me for butting in, but I'm interrupt-driven..."
Re: Create an RPM for custom compiled Perl ?
by Plankton (Vicar) on May 14, 2015 at 22:02 UTC
    Do you have a yum repo where these dependencies might reside? What happens if you execute:
    $ sudo yum install perl-custom-5.14.2-1.x86_64.rpm
Re: Create an RPM for custom compiled Perl ?
by codiac (Beadle) on May 16, 2015 at 11:34 UTC

    At the end of rpm build scripts are run to automatically add requires and provides that aren't explicit, it happens for a lot of languages. If you think it's wrong the you can tweak your spec file to override these scripts or specifically exclude things you know if will get wrong.

    https://fedoraproject.org/wiki/EPEL:Packaging_Autoprovides_and_Requires_Filtering#Perl

    In this case you'd want to use the __requires_exclude filter.

    P.S. if you are compiling your own perl simply to get a newer perl you might look at software collections, which includes perl 5.16 http://wiki.centos.org/AdditionalResources/Repositories/SCL