Installing CPAN on OpenWRT

Wiki.TerraBase.info
Jump to navigation Jump to search

https://metacpan.org/pod/App::cpanminus

It's dependency free*(can bootstrap itself), requires zero configuration, and stands alone. When running, it requires only 10MB of RAM.

*Dependency Free* is very misleading as the following perl modules need to be installed;

opkg install perlbase-extutils perlbase-perlio perlbase-if perlbase-universal perlbase-getopt perlbase-data perlbase-pod perlbase-test perlbase-encoding perlbase-perlio perlbase-json-pp perlbase-english perl-test-harness make curl tar wget (the full WGET executable must be installed as the one built into BusyBox does not have the necessary capability, the same for TAR comes up in other situations, so may as well install it here).

...and gave up trying to find all of the perlbase- modules and just installed all of them: opkg list | grep perlbase-| awk '{print $1}' | xargs opkg install

Also: opkg install perl-test-warn and opkg install perl-test-harness --force-overwrite (from https://github.com/Entware/Entware-ng/wiki/Self-installation-of-perl-modules)

curl -L https://cpanmin.us | perl - Test::More

curl -L https://cpanmin.us | perl - ExtUtils::CBuilder

curl -L https://cpanmin.us | perl - ExtUtils::MakeMaker

curl -L https://cpanmin.us | perl - App::cpanminus

perl-test-harness = perlbase-test perlbase-tap


Net::SSLeay

Download perl-dev from Entware: https://bin.entware.net/armv7sf-k3.2/perl-dev_5.28.1-5_armv7-3.2.ipk

Header files from Entware: http://pkg.entware.net/binaries/armv7/include/include.tar.gz

Issue with

/usr/bin/ld: cannot find -lssl

/usr/bin/ld: cannot find -lcrypto

Solutions that don't work

ln -s /usr/lib/libcrypto.so.1.1 /usr/lib/libcrypto.so

ln -s /usr/lib/libssl.so.1.1 /usr/lib/libssl.so


export LDFLAGS="-Wl,-rpath=/lib -Wl,--dynamic-linker=/lib/ld-musl-armhf.so.1 -L/lib"

export CFLAGS="-O2 -pipe -march=armv7-a -mtune=cortex-a9 -fno-caller-saves -mfloat-abi=soft "

Missing items

libcrypto.so

libssl.so

openssl.so

And if it is all solved

opkg install openssl-util gcc

cpanm -v -i Net::SSLeay

Manual Installation of CPAN

Download CPAN Module: CPAN-2.28.tar.gz

perl Makefile.PL

make

make test

make install

Script for listing installed perl modules

#!/usr/bin/perl -w

use ExtUtils::Installed;

my $inst    = ExtUtils::Installed->new();

my @modules = $inst->modules();

foreach $module (@modules){

     print $module . "\n";

}

MailScanner

Log::Log4perl

Term::ReadLine::Perl

YAML

cpan Archive::Tar Archive::Zip bignum Carp Compress::Zlib Compress::Raw::Zlib Convert::BinHex Convert::TNEF Data::Dumper Date::Parse DBD::SQLite DBI Digest::HMAC Digest::MD5 Digest::SHA1 DirHandle ExtUtils::MakeMaker Fcntl File::Basename File::Copy File::Path File::Spec File::Temp FileHandle Filesys::Df Getopt::Long Inline::C IO IO::File IO::Pipe IO::Stringy HTML::Entities HTML::Parser HTML::Tagset HTML::TokeParser Mail::Field Mail::Header Mail::IMAPClient Mail::Internet Math::BigInt Math::BigRat MIME::Base64 MIME::Decoder MIME::Decoder::UU MIME::Head MIME::Parser MIME::QuotedPrint MIME::Tools MIME::WordDecoder Net::CIDR Net::DNS Net::IP OLE::Storage_Lite Pod::Escapes Pod::Simple POSIX Scalar::Util Socket Storable Test::Harness Test::Pod Test::Simple Time::HiRes Time::localtime Sys::Hostname::Long Sys::SigAction Sys::Syslog Env Mail::SpamAssassin bignum Data::Dump DB_File DBD::SQLite DBI Digest Encode::Detect Error ExtUtils::CBuilder ExtUtils::ParseXS Getopt::Long Inline IO::String IO::Zlib IP::Country Mail::SPF Mail::SPF::Query Module::Build Net::CIDR::Lite Net::DNS Net::LDAP Net::DNS::Resolver::Programmable NetAddr::IP Parse::RecDescent Test::Harness Test::Manifest Text::Balanced URI version IO::Compress::Bzip2 Sendmail::PMilter Mail::SpamAssassin::Plugin::Rule2XSBody Mail::SpamAssassin::Plugin::DCC Mail::SpamAssassin::Plugin::Pyzor Mail::SpamAssassin Mail::ClamAV