So here is the (?long awaited) advice on howto compile perl, at least perl 5.14.2 on a QNAP 219P+. This was written *after* installation was completed, so I can't predict that it will all behave as expected. Any comments are welcome!
Step 1. Here are some preliminaries before you begin the install.
There were installation errors generated when installing the Archive::Extract Module (ie /Archive/Extract.pm), so I ended up replacing all the existing decompression utilities. You may not have to replace all of these, but certainly bunzip2 and unzip need replacing. Always use the prefix=/opt prefix (either with 'configure' or with 'make' ie whatever the installation notes specify)
1.1 for bunzip2
the shorcut found in /mnt/ext/usr/bin/bunzip2 was a shortcut to /bin/bzip2, which was bzip2 version 1.0.4; this was indicated when you run bunzip as I understand bzip2 is the same as bunzip2 and the current version, 1.0.6, was found already installed as /opt/bin/bzip2-bzip2 (nb a hypenated filename) so it was just a matter of repointing the /mnt/ext/usr/bin/bunzip2 shorcut from /bin/bzip2 to /opt/bin/bzip2-bzip2 which as I said is the current version of bzip2, ie version 1.0.6
- Code: Select all
/mnt/ext/usr/bin/bunzip2 -> /opt/bin/bzip2-bzip2
(running bzip2-bzip2 indicates the correct version of 1.0.6)
1.2 for gzip
/bin/gzip was a shortcut to busybox
-->need to replace it, so download the gzip binary
- Code: Select all
cd /share/MD0_DATA/misc
wget http://ftp.gnu.org/gnu/gzip/gzip-1.4.tar.gz
tar zxvf gzip-1.4.tar.gz
cd gzip-1.4.tar.gz
./configure --prefix=/opt
make
make install
1.3 replace 'tar'
there was a complete version of tar, but it was an old one, version 1.22, located in /bin/tar, so update to latest version (1.26):
- Code: Select all
cd /share/MD0_DATA/misc
wget http://mirror.aarnet.edu.au/pub/gnu/tar/tar-latest.tar.gz
(note: it may be worth 'su'ing to another user prior to downloading and untarring...see below)
./configure gave error msg:
- Code: Select all
checking whether mknod can create fifo without root privileges... configure: error: in `/share/MD0_DATA/misc/tar-1.26':
configure: error: you should not run configure as root (set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check)
See `config.log' for more details.
I tried setting: FORCE_UNSAFE_CONFIGURE=1 in the environment but this did not work (just type it then check by typing 'set' at the command line)
But adding this did not work so I first added a new user, via the 'adduser' command
I then found I could not su to the new user, so I had to add 'su' via: ipkg install su
so I untarred the tar-1.26 again. If downloaded as root, change permission recursively on the extracted folder to 777
- Code: Select all
chmod -R 0777 /share/MD0_DATA/misc/tar-1.26
then run
- Code: Select all
./configure --prefix=/opt
it completed!
then su back to root ie
- Code: Select all
su -
then run 'make'
then run 'make test' with finishing output, which didn't seem to affect things:
- Code: Select all
ERROR: 107 tests were run,
1 failed unexpectedly.
14 tests were skipped.
## -------------------------- ##
## testsuite.log was created. ##
## -------------------------- ##
Please send `tests/testsuite.log' and all information you think might help:
To: <bug-tar@gnu.org>
Subject: [GNU tar 1.26] testsuite: 61 failed
then 'make install'
1.4. unzip definitely needed replacing, to overcome a test error in 'Archive::Extract' module
- Code: Select all
wget http://downloads.sourceforge.net/infozip/unzip60.tar.gz
unpack etc
It was confusing whether you needed to copy the files in the /unix subdir, to the parent dir...after doing this, I realised that perhaps you dont as the installation script below seems to allow for files being in a subdir, e.g. unix/Makefile
The ref. is
http://www.linuxfromscratch.org/blfs/vi ... unzip.htmlnote that the file specifies unix/Makefile rather than just Makefile)
Installation of UnZip (enter line by line or put all into a .sh file then run it)
(
http://www.linuxfromscratch.org/blfs/vi ... unzip.html )
- Code: Select all
case `uname -m` in
i?86)
sed -i -e 's/DASM"/DASM -DNO_LCHMOD"/' unix/Makefile
make -f unix/Makefile linux
;;
*)
sed -i -e 's/CFLAGS="-O -Wall/& -DNO_LCHMOD/' unix/Makefile
make -f unix/Makefile linux_noasm
;;
esac
To test the results, issue:
- Code: Select all
make check.
Now, as the root user:
- Code: Select all
make prefix=/opt install
Step 2 Another preliminary ('why' will become clear, below in Step 8 )
via ipkg, install
gnupg --> note that the link is /opt/bin/gpg2
patch -->link is /opt/bin/patch
applypatch --> I could not find this utility
Step 3Ensure you have added the PATH settings as specified above for the GCC install, in Optware.sh, and that they are currently active. In particular, if /opt/include is not in the current PATH, you see the
- Code: Select all
No error definitions found at Errno_pm.PL line ...
whereby the line in question in Errno_pm.PL references 'errno.h'. Its in /opt/include. 'set' will confirm PATH settings.
Step 4 Change your root login (ie 'admin's) $HOME directory. /root is on the RAM drive, with very limited space (eg 32 Megs), and this may stuff up your CPAN as you download more and more modules.
References I used for this section:
http://www.perlmonks.org/?node_id=953639http://www.physionet.org/physiotools/cygwin/ currently $HOME is in /root:
- Code: Select all
cd $HOME
[~] #
[~] # pwd
/root
So to change the location of $HOME:
- Code: Select all
~] # cp -Rfv /root /share/MD0_DATA/new_home
-->this gives a verbose output and forcefully copies all of /root's contents, recursively, to a new dir called 'new_home'
This should copy everything including the various .bash files, eg /root/.bash_profile, and from the point of view of this exercise, cpan's MyConfig.pm (this is originally found in /root/.cpan/CPAN/MyConfig.pm)
(NB you don't need to mkdir /share/MD0_DATA/new_home )
You can then run the following command to temporarily relocate $HOME, for the current session:
- Code: Select all
export HOME=/share/MD0_DATA/new_home
so whilst still in the same session:
- Code: Select all
cd $HOME
should now place you in:
/share/MD0_DATA/new_home
To make it permanent, add the line immed below to /opt/Optware.sh:
- Code: Select all
/bin/echo "export HOME=/share/MD0_DATA/new_home" >> /etc/profile
After doing this, if necessary you can either reboot the qnap to reload the new profile, or refresh the current profile via running:
- Code: Select all
source /etc/profile
note that checking the env. variables (via running 'set') shows that HISTFILE remains in /root:
- Code: Select all
HISTFILE=/root/.bash_history
(I am not worried about this)
Step 5Begin your perl installation. I installed version 5.14.2 as it was the latest stable as at Feb 2012
Command:
- Code: Select all
./Configure -Dcc=gcc -Dprefix=/opt -Dusethreads
(this bills a threaded PERL, NOT using the defaults, but using GCC as the compiler, with destination prefix being /opt (ie installed under /opt)
- Code: Select all
Installation prefix to use? (~name ok) [/opt]
>>/opt is as specified in the configure line above
- Code: Select all
Pathname for the site-specific library files? (~name ok)
[/opt/lib/perl5/site_/5.14.2]
>>I accepted this
- Code: Select all
Use which C compiler? [gcc]
>>gcc is as specified in the configure line above
- Code: Select all
Directories to use for library searches? [/usr/local/lib /lib /usr/lib]
>> do not accept the above, but type in:
- Code: Select all
/lib /usr/lib /usr/local/lib /opt/lib /opt/arm-none-linux-gnueabi/lib
for the following do not accept the default; enter the following:
- Code: Select all
What optimizer/debugger flag should be used? [-O2] -g
>>ie I used the -g flag (the symbolic debugger) rather than the -O flag
- Code: Select all
Pathname where the private library files will reside? (~name ok)
[/opt/lib/perl5/5.14.2]
>>I accepted this
Otherwise I accepted all defaults
then 'make'
then 'make test' ... this took one to two hours. Then go to step 5
Note: if you get an 'out of memory' error...first check where $HOME is. If $HOME is still in /root, that is the cause. Refer back to Step 4.
Step 5 Test problems - 'make test' showed failures as follows. I will deal with each of these in following steps.
- Code: Select all
Failed 3 tests out of 2028, 99.85% okay.
../cpan/Archive-Extract/t/01_Archive-Extract.t
op/magic.t
porting/manifest.t
### Since not all tests were successful, you may want to run some of
### them individually and examine any diagnostic messages they produce.
### See the INSTALL document's section on "make test".
### You have a good chance to get more information by running
### ./perl harness
### in the 't' directory since most (>=80%) of the tests succeeded.
### You may have to set your dynamic library search path,
### LD_LIBRARY_PATH, to point to the build directory:
### setenv LD_LIBRARY_PATH `pwd`; cd t; ./perl harness
### LD_LIBRARY_PATH=`pwd`; export LD_LIBRARY_PATH; cd t; ./perl harness
### export LD_LIBRARY_PATH=`pwd`; cd t; ./perl harness
### for csh-style shells, like tcsh; or for traditional/modern
### Bourne-style shells, like bash, ksh, and zsh, respectively.
u=44.41 s=6.40 cu=4031.88 cs=149.57 scripts=2028 tests=452654
Step 6This refers to the porting/manifest.t errors
I was advised by the learned Perl Monks (
http://www.perlmonks.org) to check the MANIFEST file:
- Code: Select all
./MANIFEST:
cpan/Archive-Extract/t/src/y.tar.bz2 Archive::Extract tests
#cpan/Archive-Extract/t/src/y.tar.gz Archive::Extract tests <--- line 38...y.tar.gz is missing.
cpan/Archive-Extract/t/src/y.tar.xz Archive::Extract tests
cpan/Archive-Extract/t/src/y.tbz Archive::Extract tests
cpan/Archive-Extract/t/src/y.tgz Archive::Extract tests
so I deleted line 38 and the test passed; commenting out the line was not enough. When I say the 'test passed', it was via:
- Code: Select all
cd /share/MD0_DATA/misc/perl-5.14.2/t
/perl harness ./porting/manifest.t
I am not sure if anything more needs to be done here, but anyway, the test passes
Step 7.This refers to management of the op/magic.t error
- Code: Select all
./op/magic.t (Wstat: 0 Tests: 87 Failed: 1)
Failed test: 83
Files=1, Tests=87, 4 wallclock secs ( 0.33 usr 0.01 sys + 0.41 cusr 0.25 csy s = 1.00
CPU)
Result: FAIL
This can be fixed by changing the 'ps' symlink from default /bin/busybox link to an updated and downloaded busybox version (refer to the gcc compilation above)
Then test again via:
- Code: Select all
./perl harness ./op/magic.t
I am not aware of anything else needing to be done
Step 8On the command line run:
- Code: Select all
cpan
then:
- Code: Select all
cpan [1]> o conf
just make sure nothing is listed under /root after issuing the following commands, and that the paths are correct. Change them if necessary. For a more verbose configuration walk through, type:
- Code: Select all
cpan[1]> o conf init
- Code: Select all
$CPAN::Config options from /share/MD0_Data/new_home/.cpan/CPAN/MyConfig.pm:
commit [Commit changes to disk]
defaults [Reload defaults from disk]
help [Short help about 'o conf' usage]
init [Interactive setting of all options]
applypatch []
auto_commit [1]
build_cache [100]
build_dir [/share/MD0_DATA/new_home/.cpan/build_dir]
build_dir_reuse [1]
build_requires_install_policy [yes]
bzip2 [/opt/bin/bzip2]
cache_metadata [1]
check_sigs [0]
colorize_debug undef
colorize_output [0]
colorize_print undef
colorize_warn undef
commandnumber_in_prompt [1]
commands_quote undef
connect_to_internet_ok [1]
cpan_home [/share/MD0_DATA/new_home/.cpan]
curl undef
dontload_hash undef
dontload_list undef
ftp undef
ftp_passive [1]
ftp_proxy []
ftpstats_period undef
ftpstats_size undef
getcwd [cwd]
gpg [/opt/bin/gpg2]
gzip [/opt/bin/gzip]
halt_on_failure [0]
histfile [/share/MD0_DATA/new_home/.cpan/histfile]
histsize [100]
http_proxy []
inactivity_timeout [0]
index_expire [1]
inhibit_startup_message [0]
keep_source_where [/share/MD0_DATA/new_home/.cpan/sources]
load_module_verbosity [none]
lynx undef
make [/opt/bin/make]
make_arg []
make_install_arg []
make_install_make_command [/opt/bin/make]
makepl_arg [PREFIX=/opt]
mbuild_arg []
mbuild_install_arg []
mbuild_install_build_command [./Build]
mbuildpl_arg [--install_base /opt]
ncftp undef
ncftpget undef
no_proxy []
pager [/bin/more]
password undef
patch [/opt/bin/patch]
patches_dir undef
perl5lib_verbosity [none]
prefer_external_tar [1]
prefer_installer [MB]
prefs_dir [/share/MD0_DATA/new_home/.cpan/prefs]
prerequisites_policy [follow]
proxy_pass undef
proxy_user undef
randomize_urllist undef
scan_cache [atstart]
shell [/bin/sh]
show_unparsable_versions [0]
show_upload_date [0]
show_zero_versions [0]
tar [/opt/bin/tar]
tar_verbosity [none]
term_is_latin [1]
term_ornaments [1]
test_report [0]
trust_test_report_history [0]
unzip [/usr/bin/unzip]
urllist
0 [http://cpan.mirrors.ilisys.com.au/]
1 [http://mirror.internode.on.net/pub/cpan/]
2 [http://cpan.mirror.aussiehq.net.au/]
use_sqlite [0]
username undef
version_timeout [15]
wait_list undef
wget [/usr/bin/wget]
yaml_load_code [0]
yaml_module [YAML]
I understand that setting the following options will direct cpan to install modules in the specified location:
- Code: Select all
makepl_arg [PREFIX=/opt]
mbuildpl_arg [--install_base /opt]
(but I found that cpan installed eg YAML in /opt/lib/perl5/site_/5.14.2, which was the directory specified during 'configure')
Step 9This step refers to the Archive::Extract problem
- Code: Select all
cd /share/MD0_DATA/misc/perl-5.14.2/t
./perl harness /share/MD0_DATA/misc/perl-5.14.2/cpan/Archive-Extract/t/01_Archive-Extract.t
/share/MD0_DATA/misc/perl-5.14.2/cpan/Archive-Extract/t/01_Archive-Extract.t .. 1/? # Old bunzip2 detected, skipping .tbz test
Key 'archive' (01_Archive-Extract.t) is of invalid type for 'Archive::Extract::new' provided by ANON at /share/MD0_DATA/misc/perl-5.14.2/cpan/Archive-
Extract/t/01_Archive-Extract.t line 241
# Failed test ' Object created based on 'tgz''
So I kept getting the error related to 'Object created based on 'tgz'' until I replaced 'unzip' as in Step 1.4, then running the test was ok. So if you have already done as specified in Steps 1.1 to Steps 1.4, you need just invoke 'cpan' then 'install Archive::Extract' (which installs the latest version) and you should see the following:
- Code: Select all
cpan[1]> install Archive::Extract
Going to read '/share/MD0_DATA/.cpan/Metadata'
Database was generated on Thu, 16 Feb 2012 11:10:54 GMT
Running install for module 'Archive::Extract'
Running make for B/BI/BINGOS/Archive-Extract-0.58.tar.gz
Checksum for /share/MD0_DATA/.cpan/sources/authors/id/B/BI/BINGOS/Archive-Extract-0.58.tar.gz ok
Scanning cache /share/MD0_DATA/.cpan/build_dir for sizes
............................................................................DONE
'YAML' not installed, will not store persistent state
CPAN.pm: Going to build B/BI/BINGOS/Archive-Extract-0.58.tar.gz
Checking if your kit is complete...
Looks good
Writing Makefile for Archive::Extract
Writing MYMETA.yml
cp lib/Archive/Extract.pm blib/lib/Archive/Extract.pm
BINGOS/Archive-Extract-0.58.tar.gz
/share/MD0_DATA/.qpkg/Optware/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 /share/MD0_DATA/.qpkg/Optware/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/01_Archive-Extract.t .. ok
All tests successful.
Files=1, Tests=1584, 12 wallclock secs ( 1.30 usr 0.06 sys + 7.96 cusr 2.63 csys = 11.95 CPU)
Result: PASS
BINGOS/Archive-Extract-0.58.tar.gz
/share/MD0_DATA/.qpkg/Optware/bin/make test -- OK
Running make install
Installing /share/MD0_DATA/lib/perl5/5.14.2/Archive/Extract.pm
Appending installation info to /share/MD0_DATA/lib/perl5/5.14.2/armv5tel-linux-thread-multi/perllocal.pod
BINGOS/Archive-Extract-0.58.tar.gz
/opt/bin/make install -- OK
Step 10to check the path of the Archive::Extract module (& others):
Ref:
http://www.symkat.com/find-a-perl-modules-path- Code: Select all
perl -MArchive::Extract -e'print $INC{"Archive/Extract.pm"} . "\n"'
/opt/lib/perl5/5.14.2/Archive/Extract.pm
[~] # perldoc -l Archive::Extract
/opt/lib/perl5/5.14.2/Archive/Extract.pm