Installing CPAN on OpenWRT
Jump to navigation Jump to search

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

curl -L | perl - Test::More

curl -L | perl - ExtUtils::CBuilder

curl -L | perl - ExtUtils::MakeMaker

curl -L | perl - App::cpanminus

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


Download perl-dev from Entware:

Header files from Entware:

Issue with

/usr/bin/ld: cannot find -lssl

/usr/bin/ld: cannot find -lcrypto

Solutions that don't work

ln -s /usr/lib/ /usr/lib/

ln -s /usr/lib/ /usr/lib/

export LDFLAGS="-Wl,-rpath=/lib -Wl,--dynamic-linker=/lib/ -L/lib"

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

Missing items

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 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";






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