about to give up on GCC, Perl compilation attempt

Discuss various NAS app here for installation guideline, general usage, knowledge exchange and wishlists.

about to give up on GCC, Perl compilation attempt

Postby michaeldaly600 » Wed Feb 01, 2012 9:34 am

I am seeking advice on whether to continue trying....I am trying to compile swish-e, an indexing program. This requires Perl but the ipkg version of Perl failed to install the required additional Perl modules.

I am not going to describe this in detail

I am seeking advice from the forum on whether to continue trying with this approach, as its consumed a lot of my spare time, for the past month. I don't know why this is proving to be so difficult, but admittedly, my skills compared with others here would be somewhat rudimentary.

I set about attempting to compile a new version of Perl, and eventually completed 'make install' but the only function I can get out of this new perl is the perl -v command.

So I contacted the Perl Monks who advised me to upgrade gcc (I have the ipkg version...4.2.3). This required installation of certain dependencies, setting paths, setting library paths and copying .o eg crti.o files to a different directory.

However the GCC compilation has failed too. This was after 5 hours of 'make' running. There was an error.

I note that you can install debian via ipkg.

Can anyone advise?
Thanks
MD600
michaeldaly600
Starting out
 
Posts: 14
Joined: Fri Sep 30, 2011 5:23 am
NAS Model: SS-439 Pro

Re: about to give up on GCC, Perl compilation attempt

Postby pnap888 » Wed Feb 01, 2012 12:19 pm

what was the last error message?
pnap888
New here
 
Posts: 3
Joined: Wed Feb 01, 2012 12:06 pm
NAS Model: SS-439 Pro

Re: about to give up on GCC, Perl compilation attempt

Postby michaeldaly600 » Wed Feb 01, 2012 3:04 pm

hi pnap888!
This is where it starts to go wrong...libtools mentions something about object name conflicts in archive:
Code: Select all
libtool: link: rm -f  .libs/libstdc++.la.lnkscript
libtool: link: (cd ".libs" && rm -f "libstdc++.so.6" && ln -s "libstdc++.so.6.0.16" "libstdc++.so.6")
libtool: link: (cd ".libs" && rm -f "libstdc++.so" && ln -s "libstdc++.so.6.0.16" "libstdc++.so")
libtool: link: (cd .libs/libstdc++.lax/libsupc++convenience.a && ar x "/misc/gcc_install/armv5tel-unknown-linux-gnueabi/libstdc++-v3/src/../libsupc++/.libs/libsupc++convenience.a")
libtool: link: object name conflicts in archive: .libs/libstdc++.lax/libsupc++convenience.a//misc/gcc_install/armv5tel-unknown-linux-gnueabi/libstdc++-v3/src/../libsupc++/.libs/libsupc++convenience.a
make[4]: *** [libstdc++.la] Error 1
make[4]: Leaving directory `/share/MD0_DATA/misc/gcc_install/armv5tel-unknown-linux-gnueabi/libstdc++-v3/src'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/share/MD0_DATA/misc/gcc_install/armv5tel-unknown-linux-gnueabi/libstdc++-v3'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/share/MD0_DATA/misc/gcc_install/armv5tel-unknown-linux-gnueabi/libstdc++-v3'
make[1]: *** [all-target-libstdc++-v3] Error 2
make[1]: Leaving directory `/share/MD0_DATA/misc/gcc_install'
make: *** [all] Error 2

then it chokes along for a while longer mentioning 'no such file or directory' or 'no input file' and finally ends with:
Code: Select all
<./libdecnumber/dpd -I../libdecnumber    /misc/gcc-4.6.2/gcc/cfglayout.c -o cfglayout.o
/misc/gcc-4.6.2/gcc/cfglayout.c:21:20: fatal error: config.h: No such file or directory
compilation terminated.
[/misc/gcc_install] # /misc
-sh: /misc: is a directory
<5tel-unknown-linux-gnueabi/sys-include    -c   -g -O2 -gtoggle -DIN_GCC   -W -Wall -Wwrite-strings -Wcas
xgcc: fatal error: no input files
compilation terminated.
<4.6.2/gcc/../include -I/misc/gcc-4.6.2/gcc/../libcpp/include  -I/misc/gcc-4.6.2/gcc/../libdecnumber -I/mis
xgcc: fatal error: no input files
compilation terminated.
<c/../libdecnumber -I/misc/gcc-4.6.2/gcc/../libdecnumber/dpd -I../libdecnumber    /misc/gcc-4.6.2/gcc/cfgrtl.c -o cfgrtl
/misc/gcc-4.6.2/gcc/cfgrtl.c:40:20: fatal error: config.h: No such file or directory
compilation terminated.
[/misc/gcc_install] # /misc/gcc_install/./prev-gcc/xgcc -B/misc/gcc_install/./pr
xgcc: fatal error: no input files
compilation terminated.
[/misc/gcc_install] #

**************************************************************************************
I tried to install a newer version of libtool, bec this was the error above, I tried both 2.2 and 2.4.2 versions, with default install into the prefix=/opt dir, but both ended during 'make' with the msg that 'dlopen_LTX_get_vtable' was undeclared ...referencing a line in the libltdlS.c file:

libtool: link: rm -f libltdl/.libs/libltdl.nm libltdl/.libs/libltdl.nmS libltdl/.libs/libltdl.nmT
sort: +2: No such file or directory
libtool: link: (cd libltdl/.libs && gcc -g -O2 -c -fno-builtin -fPIC -DPIC "libltdlS.c")
libltdlS.c:22: error: 'dlopen_LTX_get_vtable' undeclared here (not in a function)
make[2]: *** [libltdl/libltdl.la] Error 1
make[2]: Leaving directory `/share/MD0_DATA/misc/libtool-2.2'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/share/MD0_DATA/misc/libtool-2.2'
michaeldaly600
Starting out
 
Posts: 14
Joined: Fri Sep 30, 2011 5:23 am
NAS Model: SS-439 Pro

Re: about to give up on GCC, Perl compilation attempt

Postby pnap888 » Sat Feb 04, 2012 1:32 pm

some of the default qnap linux binaries have their limitations, e.g. don't allow all the current run options (-g, -o etc), because they are out of date or are part of the default /bin/busybox binary (i.e. rather than being the full independent linux binary). I am talking about the binaries in e.g. /bin/ or /usr/bin/, some of which are there completely but many of which are shortcuts to busybox (version 1.1 I think)

I suggest:
1. See if there are any clues at the compilation stop points...that may point to a binary problem.
2. Download and install the linux core utilities; put a link to their location in your PATH *before* the existing paths
3. Where binaries are problematic that link to busybox and a single replacement is not available, download and install a second busybox base as described in:
viewtopic.php?p=13917
then change the link from the existing busybox to this second busybox base
4. some of the dependencies, such as libtool, as installed via ipkg, may themselves have their problems (eg due to unforeseen problems that arose during cross compilation). Replace them if suspicion suggests a fault!

Unfortunately you may find this to be a long and iterative process!
Let us know how you go!
Rgds,
888
pnap888
New here
 
Posts: 3
Joined: Wed Feb 01, 2012 12:06 pm
NAS Model: SS-439 Pro

Re: about to give up on GCC, Perl compilation attempt

Postby michaeldaly600 » Fri Feb 10, 2012 12:00 pm

Thanks '888...this approach seems to have done the trick, at least in compiling GCC, as follows.

Step 1. Install core utilities and GCC dependencies. Install the latest version of busybox (to supplement, not replace, the existing qnap supplied busybox binary!)

find, link, sort, install are linked to the busybox binary but caused problems during compilation of gcc &/or libtool.
edit: add /bin/sed to this list

So download the GNU core utilities and, within the PATH setting, ensure the PATH entry for the core utilities *precedes* the existing PATH entry for existing utility shorcuts to the existing qnap supplied busybox. See below for this. For download refer http://www.gnu.org/software/coreutils (an alt. way may be to install via ipkg)
edit: I installed a full version of 'sed' via ipkg install sed (an alt. may be to link it to the updated busybox as in Step 2)

Reference on howto:
viewtopic.php?p=13917
wget http://ipkg.nslu2-linux.org/feeds/optwa ... -1_arm.ipk
* Rename the downloaded file to busybox-base_1.10.3-1_arm.ipk.tar.gz
* Extract the file - it creates its own /data/opt/bin directories and sits there
* Browse into the extracted folder and then extract the data.tar.gz file

* Copy the file busybox-base_1.10.3-1_arm.ipk\data\opt\bin\busybox to your Qnap (for example to /share/Public)
Note: the file is > 500kb in size.
Code: Select all
cp /share/MD0_DATA/misc/opt/bin/busybox /share/MD0_DATA/misc/

(/misc is a dir I created under /share/MD0_DATA/)

(I then deleted the extracted busybox in /share/MD0_DATA/misc/opt/bin/busybox, and the associated created subdirs /misc/opt/bin/busybox, so that the only new busybox was /misc/busybox )


Step 2. 'find' is special
Unlike link, sort and install, 'find' is not amongst the core utilities, but caused problems during the gcc compile.
To overcome it, link 'find' to the new busybox:
Code: Select all
/mnt/ext/usr/bin/find
is the existing link to
Code: Select all
/bin/busybox

change this to be a link to the new busybox ie /share/MD0_DATA/misc/busybox

If any other of the busybox linked utilities obstruct the compile process, do the same


Step 3. Modify PATH

http://wiki.qnap.com/wiki/Install_Optware_IPKG contains info on how to modify the PATH

The relevant bit in my Optware.sh file is:
Code: Select all
# adding Ipkg apps into system path ...
   /bin/cat /etc/profile | /bin/grep "PATH" | /bin/grep "/opt/bin" 1>>/dev/null 2>>/dev/null
   #[ $? -ne 0 ] && /bin/echo "export PATH=$PATH":/opt/bin:/opt/sbin >> /etc/profile
        # Bug fix for following: put IPKG first, per http://forum.qnap.com/viewtopic.php?f=124&t=15663
   # was [ $? -ne 0 ] && /bin/echo "export PATH=$PATH":/opt/bin:/opt/sbin >> /etc/profile
   #
   # modify the line below to include other paths for compilation:
   #[ $? -ne 0 ] && /bin/echo "export PATH=/opt/bin:/opt/sbin:\$PATH" >> /etc/profile
    [ $? -ne 0 ] && /bin/echo "export PATH=/opt/core_utils_qnap/bin:/opt/include:/opt/arm-none-linux-gnueabi/bin:/opt/bin:/opt/sbin:\$PATH" >> /etc/profile


After doing this, you can manually run both these 'export PATH' commands then load these into the current profile via the command:
Code: Select all
source /etc/profile

Notes about this:
/opt/core_utils_qnap/bin is where I installed my GNU linux core utilities. This is not hard to do
/opt/include contains I think kernel related files which are needed for certain installations
/opt/arm-none-linux-gnueabi/bin is a bin file

/opt is the standard shortcut

Step 4. Modify Library Path via /etc/ld.so.conf:
Add the following to optware.sh....there are a no. of references in this forum to a contribution from Lukas Oesterreicher. He adds the respective libraries to the /etc/ld.so.conf file.

Code: Select all
   # Added by Lukas Oesterreicher to enable finding any /opt libraries
            /bin/echo "/opt/lib" >> /etc/ld.so.conf
            /bin/echo "/opt/local/lib" >> /etc/ld.so.conf
            # uncomment line below only if you have libc-dev installed and need the libraries
            #/bin/echo "/opt/i686-unknown-linux-gnu/lib" >> /etc/ld.so.conf
      # in ts-219p there was a lib in /opt/arm-none-linux-gnueabi/lib/, so also add:
       /bin/echo  /opt/arm-none-linux-gnueabi/lib/  >> /etc/ld.so.conf
            /sbin/ldconfig


You can add these lines manually to ld.so.conf and execute /sbin/ldconfig if you dont want to reboot the device. So this is the contents of /etc/ld.so.conf:
Code: Select all
/lib
/usr/lib
/usr/local/lib
/opt/lib
/opt/arm-none-linux-gnueabi/lib


Running
Code: Select all
   /sbin/ldconfig -p

will print the libraries loaded. ldconfig complained that /lib and /usr/lib were being loaded twice, ie
Path `/lib' given more than once
Path `/usr/lib' given more than once

These 2 libraries were listed in /etc/ld.so.conf along with the added ones above; removing those 2 library entries from ld.so.conf and running ldconfig -v or ldconfig -p showed that the 2 libraries were still loaded so thy must load via some other utility.

Despite doing all this, during the gcc install there was an error msg that crti.o could not be found by the existing version of gcc. crti.o was located in the
/opt/arm-none-linux-gnueabi/lib directory, which was specified above, along with crtn.o and crt1.o. The problem seems to be
that the existing gcc only searches certain directories (which I presume are specified when it was compiled, and the problem arises as the existing gcc was cross compiled and installed as an ipkg binary). You can find which dirs gcc looks in for library files via:
Code: Select all
   [~] # gcc -print-search-dirs
[b]install: [/b]/share/MD0_DATA/.qpkg/Optware/bin/../lib/gcc/arm-none-linux-gnueabi/4.2.3/
[b]programs: [/b]=/share/MD0_DATA/.qpkg/Optware/bin/../libexec/gcc/arm-none-linux-gnueabi/4.2.3/:/share/MD0_DATA/.qpkg/Optware/bin/../libexec/
gcc/:/usr/libexec/gcc/arm-none-linux-gnueabi/4.2.3/:/usr/libexec/gcc/arm-none-linux-gnueabi/:/usr/lib/gcc/arm-none-linux-gnueabi/4.2.3/:/usr/lib/gcc/arm-none-linux-gnueabi/:/share/MD0_DATA/.qpkg/Optware/bin/../lib/gcc/arm-none-linux-gnueabi/4.2.3/../../../../arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi/4.2.3/:/share/MD0_DATA/.qpkg/Optware/bin/../lib/gcc/arm-none-linux-gnueabi/4.2.3/../../../../arm-none-linux-gnueabi/bin/
[b]libraries: [/b]=/share/MD0_DATA/.qpkg/Optware/bin/../lib/gcc/arm-none-linux-gnueabi/4.2.3/:/share/MD0_DATA/.qpkg/Optware/bin/../lib/gcc/:/usr/lib/gcc/arm-none-linux-gnueabi/4.2.3/:/share/MD0_DATA/.qpkg/Optware/bin/../lib/gcc/arm-none-linux-gnueabi/4.2.3/../../../../arm-none-linux-gnueabi/lib/arm-none-linux-gnueabi/4.2.3/:/share/MD0_DATA/.qpkg/Optware/bin/../lib/gcc/arm-none-linux-gnueabi/4.2.3/../../../../arm-none-linux-gnueabi/lib/:/share/MD0_DATA/.qpkg/Optware/bin/../lib/gcc/arm-none-linux-gnueabi/4.2.3/../../../arm-none-linux-gnueabi/4.2.3/:/share/MD0_DATA/.qpkg/Optware/bin/../lib/gcc/arm-none-linux-gnueabi/4.2.3/../../../:/lib/arm-none-linux-gnueabi/4.2.3/:/lib/:/usr/lib/arm-none-linux-gnueabi/4.2.3/:/usr/lib/


This shows which libraries are searched.

To get around this, go to step 5.

Step 5. Copy the crti.o, crt1.o and crtn.o files to a library location where the existing gcc version will look for them. Otherwise compilation stops. YOu can see from the output of gcc -print-search-dirs where the libraries are searched.
--> copy all the c*.o files:
Code: Select all
cp /share/MD0_DATA/.qpkg/Optware/arm-none-linux-gnueabi/lib/c*.o /usr/lib


I tried to use LD_LIBRARY_PATH, specifying the /opt/arm-none-linux-gnueabi/lib path, instead of doing it this way but it did not help.

On my qnap, copying the c*.o files to /lib, well, they disappeared after a reboot. I have not rebooted since trying the /usr/lib copy. Obviously /share/MD0_DATA/.qpkg/Optware/bin/ is an option also.

step 6. Install an updated version of libtool and gcc dependencies
You should be able to compile libtool 2.4.2 after doing the above. I updated to the latest version of automake prior to completing the libtools install:
Code: Select all
wget http://ftp.gnu.org/gnu/automake/automake-1.11.3.tar.gz

I had to delete the /opt/bin/automake and /opt/bin/aclocal files to overcome 'no such file or directory' messages, for 'make' to complete

Ditto the GCC dependencies building GCC 4.6.2 requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+

There was an error with the MPFR 'make check', but make install completed. Apparently it is normal to have errors during make check:
Code: Select all
   mpn_get_d wrong on 2^n
   bit      0
   exp      0
   want_bit 0
   sign     0
   n        =0x1
   nsize    1
   want     =[00 00 00 00 00 00 F0 3F] 1
   got      =[00 00 10 00 00 00 00 00] 5.1806537865363093631e-318
Aborted



Step 7. Configure GCC
download a new version of gcc, eg I was using 4.6.2, then unpack it and create an install directory, as you cannot install successfully from the default directory:
Code: Select all
   mkdir /share/MD0_DATA/misc/gcc_install/

cd into that dir, then:
Code: Select all
   /share/MD0_DATA/misc/gcc-4.6.2/configure --enable-languages=c,c++ --prefix=/opt


I found I needed to restrict languages to c and c++ as compiling for the java languages seemed to greatly slowed down the compilation process. If no specified, gcc is compiled for all languages including java.

The following options did not help:
Code: Select all
--with-sysroot=/opt
--with-headers=/opt/include - instead, specify /opt/include in PATH
(see step 2)


Step 8. Make (no other options needed)
NB I discovered if 'make' failed, you could try to correct the error then run 'make' again. This beats running 'make clean', or even reconfiguring, then having to run 'make' all over again. 'Make' took about 10 hours to run.

what did not help (the following did not help the crti.o etc problem):
Code: Select all
make CC="gcc -B/opt/arm-none-linux-gnueabi/lib"
make CC="gcc -L/opt/arm-none-linux-gnueabi/lib"


If you do install for java, this error occurs:
Code: Select all
looks like java lib error durng 'make':
/misc/gcc_install/armv5tel-unknown-linux-gnueabi/libjava/.libs/lt-gcj-dbtool: /opt/lib/libgcc_s.so.1: version `GCC_4.3.0' not found (required by /misc/gcc_install/armv5tel-unknown-linux-gnueabi/libjava/.libs/libgcj.so.12)

and the solution is--->
Code: Select all
mv  /opt/lib/libgcc_s.so.1  /opt/lib/xlibgcc_s.so.1.old
cp /misc/gcc_install/gcc/libgcc_s.so.1 /opt/lib


Another error when including java in the compilation was 'no space left on device':
Code: Select all
Posix-threads.lo -MD -MP -MF .deps/posix-threads.Tpo -c /misc/gcc-4.6.2/libjava/posix-threads.cc -o posix-threads.o
>/dev/null 2>&1
here=`pwd`; cd /misc/gcc-4.6.2/libjava/classpath/lib; \
find gnu java javax org sun -name .svn -prune -o -name '*.class' -print | \
/misc/gcc_install/armv5tel-unknown-linux-gnueabi/libjava/scripts/jar -cfM@ $here/libgcj-4.6.2.jar
cp: writing `/tmp/jarNQwJqj/files/javax/naming/InitialContext.class': No space left on device
make[3]: *** [libgcj-4.6.2.jar] Error 1
make[3]: Leaving directory `/share/MD0_DATA/misc/gcc_install/armv5tel-unknown-linux-gnueabi/libjava'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/share/MD0_DATA/misc/gcc_install/armv5tel-unknown-linux-gnueabi/libjava'
make[1]: *** [all-target-libjava] Error 2
make[1]: Leaving directory `/share/MD0_DATA/misc/gcc_install'
make: *** [all] Error 2


Solution was in:
viewtopic.php?p=221317
(but this may not be needed if skipping the java language install)
viewtopic.php?p=146403 --> try to move the /tmp folder to a location on the disk:
Code: Select all
mkdir -p /share/Public/temp
   cp -af /tmp/* /share/Public/temp
   mount -o bind /share/Public/temp /tmp


And when finished do:
umount /tmp
cp -af /share/Public/temp/* /tmp

Step 9. Make Install (no other options needed)

When installing for java, I got this error, and did not get to the bottom of it:
Code: Select all
   -gnueabi/lib/ -isystem /opt/armv5tel-unknown-linux-gnueabi/include -isystem
/opt/armv5tel-unknown-linux-gnueabi/sys-include    -shared -nostdlib /lib/crti.o /misc/gcc_install/./gcc/crtbeginS.o
.libs/libjvm.la.lnkscript  -L/misc/gcc_install/armv5tel-unknown-linux-gnueabi/libjava/.libs
-L/misc/gcc_install/armv5tel-unknown-linux-gnueabi/libstdc++-v3/src/.libs
-L/misc/gcc_install/armv5tel-unknown-linux-gnueabi/libstdc++-v3/src -L/opt/lib -lgcj
-L/misc/gcc_install/armv5tel-unknown-linux-gnueabi/libjava
-L/misc/gcc_install/armv5tel-unknown-linux-gnueabi/libjava/../libstdc++-v3/src/.libs -lstdc++ -lm -lpthread -lrt -ldl
-L/misc/gcc_install/./gcc -lc -lgcc_s /misc/gcc_install/./gcc/crtendS.o /lib/crtn.o  -Wl,-Bsymbolic-functions   -Wl,-soname
-Wl,libjvm.so -o .libs/libjvm.so
xgcc: error: /lib/crti.o: No such file or directory
xgcc: error: /lib/crtn.o: No such file or directory
libtool: install: error: relink `libjvm.la' with the above command before installing it
make[4]: *** [install-dbexecLTLIBRARIES] Error 1


Thats it for GCC!
Onto Perl now!
Last edited by michaeldaly600 on Fri Feb 17, 2012 8:30 pm, edited 1 time in total.
michaeldaly600
Starting out
 
Posts: 14
Joined: Fri Sep 30, 2011 5:23 am
NAS Model: SS-439 Pro

Re: about to give up on GCC, Perl compilation attempt

Postby questorian » Fri Feb 17, 2012 5:47 am

And...Success?

I need to get a real Perl working too...hopefully 5.12, or 5.14...

Any pointers useful
questorian
New here
 
Posts: 5
Joined: Fri Jul 10, 2009 8:44 pm
NAS Model: TS-109/209 Pro II

Re: about to give up on GCC, Perl compilation attempt

Postby michaeldaly600 » Fri Feb 17, 2012 8:20 pm

Hi questorian, yes I think I've got it just now, for perl 5.14.2 which is the latest stable.
There were some errors on test with several modules, the Archive::Extract module in particular, that were difficult to troubleshoot but which I think have now been resolved. I give thanks to the PerlMonks.
Most of the work involves replacing the wonky binary functions that are supplied via busybox, with the full versions.
Please give me 24 hours to write this up
Compused
michaeldaly600
Starting out
 
Posts: 14
Joined: Fri Sep 30, 2011 5:23 am
NAS Model: SS-439 Pro

Re: about to give up on GCC, Perl compilation attempt

Postby michaeldaly600 » Mon Feb 27, 2012 7:33 pm

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.html
note 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 3

Ensure 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=953639
http://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 5
Begin 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 6
This 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 8
On 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 9

This 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 10

to 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
michaeldaly600
Starting out
 
Posts: 14
Joined: Fri Sep 30, 2011 5:23 am
NAS Model: SS-439 Pro


Return to App Center Software Discussion (QPKG)

Who is online

Users browsing this forum: Riisen and 4 guests