NSLU2-Linux
view · edit · print · history

After installing perl, the next thing that most people want to do is run CPAN.

Bootstrapping CPAN has been an adventure for them (er, us), generally requiring a process of iterative fixups.

Here is an attempt to document what it takes to make it work. This is based on optware perl 5.8.8-20. It's probably not perfect, because I'm not starting with a freshly-unslung slug. Hopefully, someone who has one will test this out, and will update this note.

First, patience, patience, and more patience. It can take hours!

make sure /opt/bin & /opt/sbin are first in your path - you don't want the busybox versions of many commands.

I have the following ipkg packages installed. This probably isn't the minimal subset, and I may have removed a few too many. If anyone starts with a freshly unslung box, a minimal list would be useful....

Note that many of these, especially unslung-devel, have dependencies that load more packages -- including perl!.

 
binutils
expat
glib
grep
gzip
less
libc6-unslung
libdb
libgcc
libxml2
lynx
man
ncftp
ncursesw
openssh
openssl-dev
readline
sqlite
tz
unslung-devel
unslung-feeds
update-modules
which
zlib

After installing the packages, run this shell command to setup links to the development tools that match what CPAN expects:

 
for F in /opt/armeb/bin/armv5b-softfloat-linux-* ; do 
    CMD="`basename $F`"
    ABV="`echo $CMD | sed -e's/^armv5b-softfloat-linux-//'`"
    if ! [ -x "/opt/bin/$CMD" ]; then 
	ln -sf $F "/opt/bin/$CMD"
    fi
    if ! [ -x "/opt/bin/$ABV" ]; then 
	ln -sf $F "/opt/bin/$ABV"
    fi
done

This is necessary because the perl build saves the /opt/bin paths in Config::, but the crosstools are installed in /opt/armeb/bin.

The perl kit also doesn't include /opt/lib in CPAN's library search path. This will prevent modules that link against libraries such as -lcrypto from working. A simple test case is Crypt::OpenSSL?::RSA. To fix this, apply the following patches:

 
sed -i.bak -e"/^\\s*tie\\s\\s*%Config,\\s*'Config',\\s*{/,/}/s|^\\(\\s*libpth\\s*=>\\s*\\)'/lib'|\\1'/opt/lib /lib'|" /opt/lib/perl5/5.8.8/armv5b-linux/Config.pm
sed -i.bak -e's|/home/slug/optware/nslu2/staging/opt/lib|/opt/lib|g' -e"s|^libpth='/lib'$|libpth='/opt/lib /lib'|" /opt/lib/perl5/5.8.8/armv5b-linux/Config_heavy.pl

You will also have to set some o conf options in CPAN, as shown below. The exact syntax of the prompts varies depending on which version of CPAN is installed.

export CPAN_RUN_SHELL_TEST_WITHOUT_EXPECT=1

run cpan

 
'''o conf init'''

Make sure to specify the /opt/bin versions of utilities:
Where is your gzip program? [/opt/bin/gzip]
Where is your tar program? [/bin/tar] /opt/bin/tar
Where is your unzip program? [/usr/bin/unzip]
Where is your make program? [/opt/bin/make]
Where is your lynx program? []/opt/bin/lynx
Where is your wget program? [/usr/bin/wget] /opt/bin/wget
Where is your ncftpget program? []/opt/bin/ncftpget
Where is your ncftp program? []/opt/bin/ncftp
Where is your ftp program? [/bin/ftp] /opt/bin/ftp
Where is your gpg program? []
What is your favorite pager program? [more] less
What is your favorite shell? [/bin/sh] /opt/bin/bash

Makefile.PL [] LDDLFLAGS="-shared -L/opt/lib"
make [] CCCDLFLAGS="-fexpensive-optimizations -fomit-frame-pointer -I/opt/include"
>><<

The gpg program is used for verifying signature on kits. The gpgme ipkg may supply a suitable utility, but I haven't tried it.

o conf comit

I suggest setting the default for dependencies to "follow".

CPAN can be a bit cranky - some versions work, and others won't install. You can try updating, or stick with the bootstrap version.

You need to break the CPAN install into two pieces to avoid a recursive dependency chain involving Test::Harness:

install CPAN

install Bundle::CPAN

This will take forever - but note that it will prompt for network configuration and various tests, so you can't ignore it.

I had three errors at the end of the first pass of the install:

Module::Build Scalar::Util Archive::Tar

However, the install did a second pass, and they were gone.

quit CPAN -- this can take a VERY long time after it prints "Lockfile removed." On the order of an hour. If you type 'free' in another window, you'll see free memory slowly increasing as CPAN unwinds. This isn't monotonic, so don't panic if you see it spike down. ps will show cpan in D+ (waiting for IO).

Next, re-run o conf init, as there are probably new variables after the update. The make parameters in makepl_arg should include LDDLFLAGS="-shared -L/opt/lib"; this will find optware shared libraries when linking. make_arg should include CCCDLFLAGS="-fexpensive-optimizations -fomit-frame-pointer -I/opt/include"this will find the optware #include libraries. Also, the build paramters in mbuild_arg should include '''--extra_linker_flags -L/opt/lib'

At this point, Crypt::OpenSSL?::RSA should install.

install CPAN::SQLite? -- this is a good test (it has several dependencies) and it can speed up future installs. You may run out of memory in the DBI tests; force install DBI, force make DBD::SQLite?, install DBD::SQLite?, install CPAN::SQLite? will work-around this.

FWIW, here is my options file - please be sure to pick your own mirrors!

/opt/lib/perl5/5.8.8/CPAN/Config.pm

 
# This is CPAN.pm's systemwide configuration file. This file provides
# defaults for users, and the values can be changed in a per-user
# configuration file. The user-config file is being looked for as
# /root/.cpan/CPAN/MyConfig.pm.

$CPAN::Config = {
  'applypatch' => q[],
  'auto_commit' => q[1],
  'build_cache' => q[200],
  'build_dir' => q[/root/.cpan/build],
  'build_dir_reuse' => q[1],
  'build_requires_install_policy' => q[ask/yes],
  'bzip2' => q[/opt/bin/bzip2],
  'cache_metadata' => q[1],
  'check_sigs' => q[0],
  'colorize_debug' => q[black on_cyan],
  'colorize_output' => q[1],
  'colorize_print' => q[black on_white],
  'colorize_warn' => q[bold red on_white],
  'commandnumber_in_prompt' => q[1],
  'connect_to_internet_ok' => q[1],
  'cpan_home' => q[/root/.cpan],
  'curl' => q[/opt/bin/curl],
  'dontload_hash' => {  },
  'ftp' => q[/opt/bin/ftp],
  'ftp_passive' => q[1],
  'ftp_proxy' => q[],
  'getcwd' => q[cwd],
  'gpg' => q[],
  'gzip' => q[/opt/bin/gzip],
  'halt_on_failure' => q[0],
  'histfile' => q[/root/.cpan/histfile],
  'histsize' => q[100],
  'http_proxy' => q[],
  'inactivity_timeout' => q[0],
  'index_expire' => q[2],
  'inhibit_startup_message' => q[0],
  'keep_source_where' => q[/root/.cpan/sources],
  'load_module_verbosity' => q[v],
  'lynx' => q[/opt/bin/lynx],
  'make' => q[/opt/bin/make],
  'make_arg' => q[CCCDLFLAGS="-fexpensive-optimizations -fomit-frame-pointer -I/opt/include"],
  'make_install_arg' => q[UNINST=1],
  'make_install_make_command' => q[/opt/bin/make],
  'makepl_arg' => q[LDDLFLAGS="-shared -L/opt/lib"],
  'mbuild_arg' => q[--extra_linker_flags -L/opt/lib],
  'mbuild_install_arg' => q[--uninst 1],
  'mbuild_install_build_command' => q[./Build],
  'mbuildpl_arg' => q[],
  'ncftp' => q[/opt/bin/ncftp],
  'ncftpget' => q[/opt/bin/ncftpget],
  'no_proxy' => q[],
  'pager' => q[less],
  'patch' => q[/opt/bin/patch],
  'perl5lib_verbosity' => q[v],
  'prefer_installer' => q[MB],
  'prefs_dir' => q[/root/.cpan/prefs],
  'prerequisites_policy' => q[follow],
  'scan_cache' => q[atstart],
  'shell' => q[/opt/bin/bash],
  'show_unparsable_versions' => q[0],
  'show_upload_date' => q[0],
  'show_zero_versions' => q[0],
  'tar' => q[/opt/bin/tar],
  'tar_verbosity' => q[v],
  'term_is_latin' => q[1],
  'term_ornaments' => q[1],
  'test_report' => q[0],
  'trust_test_report_history' => q[0],
  'unzip' => q[/usr/bin/unzip],
  'urllist' => [q[ftp://mirror.cc.columbia.edu/pub/software/cpan/], q[ftp://mirror.rit.edu/CPAN/], q[ftp://mirrors1.kernel.org/pub/CPAN/], q[ftp://mirrors2.kernel.org/pub/CPAN/], q[http://www.perl.com/CPAN/], q[ftp://carroll.cac.psu.edu/pub/CPAN/], q[ftp://cpan.netnitco.net/pub/mirrors/CPAN/], q[ftp://cpan.pair.com/pub/CPAN/]],
  'use_sqlite' => q[0],
  'wget' => q[/opt/bin/wget],
  'yaml_load_code' => q[0],
  'yaml_module' => q[YAML],
};
1;
__END__

view · edit · print · history · Last edited by tlhackque.
Originally by tlhackque.
Page last modified on July 27, 2009, at 09:22 PM