Sunday, 25 December 2011

Installling git on dlink323

I am working to install git on my NAS, a dlink323 model

I have been spending some time already several months ago installing fun-plug, following detailed instructions from a web site that I lost track since then. Seems that NAS-tweaks.net would be doing the job today.

git does not come pre-compiled for this platform. Therefore, I had to download and compile git source code

Here are the steps I have been following. Hope that will help some of you.

Step 1: download all packages coming with fun_plug

cd /mnt/HD_a2/
mkdir working
cd working
rsync -av --delete inreto.de::dns323/fun-plug/0.5/packages .

(see also this)


Step 2: download git source code

cd /mnt/HD_a2/working
mkdir git
cd git
wget http://git-core.googlecode.com/files/git-1.7.7.5.tar.gz
tar -xzf git-1.7.7.5.tar.gz

Step 3: install packages required for compiling

we'll need: make, gcc, kernel-headers, binutils, openssl, uclibc, libiconv, expat, gettext:
cd /mnt/HD_a2/working/packages
funpkg -i make*
funpkg -i gcc*
funpkg -i kernel-headers*
funpkg -i binutils*
funpkg -i openssl*
funpkg -i uclibc*
funpkg -i libiconv*
funpkg -i expat*
funpkg -i gettext*
funpkg -i tcl*
funpkg -i tar*

additional packages required
wget http://inreto.de/dns323/fun-plug/0.5/extra-packages/All/curl-7.19.4-1.tgz
funpkg -i curl*

wget http://inreto.de/dns323/fun-plug/0.5/extra-packages/All/perl-5.10-2.tgz
funpkg -i perl*

see here for installing python ... This one takes some times ...
Note that I had to move my tmp folder to an other location. default tmp location is running in RAM disk, and seems to be too small ...
mv tmp/. /mnt/HD_a2/working/tmp;rmdir tmp;ln -s /mnt/HD_a2/working/tmp tmp


Step 4: some customization
4.1. edit Makefile
go to line 821, and add:
ifeq ($(uname_S),Linux)
NO_STRLCPY = YesPlease
NO_MKSTEMPS = YesPlease
HAVE_PATHS_H = YesPlease
NO_NSEC = YesPlease
NEEDS_LIBICONV = YesPlease
endif

4.2. symlinks to perl & python
cd /usr/bin
ln -s /ffp/bin/perl perl
ln -s /ffp/bin/python python

4.3. make
./configure --prefix=/ffp
make
make install



My diary was as follow:

The first big issue was in resolving "error trying to exec `as': execvp: No such file or directory"
after some google-research, i managed to find where as is ... you have to instazll glibc or binutils (not sure which one resolved that issue)

The next big issue was after running make, and waiting a quite long time to get it built. I obviously encountered several errors, the first one was a compile error with ST_CTIME_NSEC macro in read-cache.c.

CC read-cache.o
read-cache.c: In function 'fill_stat_cache_info':
read-cache.c:73: error: 'struct stat' has no member named 'st_ctimespec'
read-cache.c:74: error: 'struct stat' has no member named 'st_mtimespec'
read-cache.c: In function 'read_index_from':
read-cache.c:1333: error: 'struct stat' has no member named 'st_mtimespec'
read-cache.c: In function 'write_index':
read-cache.c:1638: error: 'struct stat' has no member named 'st_mtimespec'
make: *** [read-cache.o] Error 1

Solution was to change NO_NSEC option in Makefile


Also met an error in utf8.c wrt libiconv options. Installing libiconv did resolve this error


Conclusion
I have been writing this page while doing the job, and may have missed some steps. Leave a comment if you have issues. I'm not an expert, but will share my experience on this... Enjoy !

2 comments:

  1. Hi Philippe,

    thanks for the very nice tutorial, helped me a lot with my Git on NAS installation!

    Greetings,
    Martin

    ReplyDelete
  2. Hi Philippe,
    thank you it worked smoothly.

    I made a package and then install it with funpkg:

    mkdir /ffp/tmp/git/build
    DESTDIR=/ffp/tmp/git/build/ make install
    cd ../build
    tar czf git-1.7.7.5.tgz ffp
    mv git-1.7.7.5.tgz /ffp/pkg/additional/
    cd /ffp/pkg/additional/
    funpkg -i git-1.7.7.5.tgz

    git --version

    cd -
    cd ..
    rm -rf git-1.7.7.5.tar.gz build/

    Cheers
    Stefano

    ReplyDelete