by foolonthehill  

UPDATE: Please note Michael's comment below - this post is now out of date, as they have moved to gibhub permenantly. The latest branch should also not require all of the steps required below (particularly to do with Perl).

My previous post appears to have garnered a fair bit of interest from those running a local Squeezebox Server on their Pi, and there was a particular demand for the .deb package that I compiled based on my own compiled system. So, with 7.8 being released and my understanding of the SBS system continuing to improve, I think it's about time that I updated my tutorial and generated a proper .deb from source...

I'm going to assume that if, you have got this far, then you have realised that the official package from Logitech will not work on stock Raspbian, even though "ARM" is stated as a target system. If you want more background on why, then please take a look back at my previous post, but, essentially, the ARM binaries in the official package expect the (slower) "soft-float" armel architecture, while Raspbian now runs a "hard-float" environment.

I'm also going to assume at this point that you have a fully updated Raspbian-based system, which should include Perl 5.14.2 by default. If you have not had LogitechMediaServer (squeezeboxserver) installed previously, or don't have a good compiling environment, then you may additionally need to add more packages first to get the compile to work:

$ sudo apt-get install libstdc++6-4.7-dev gcc-4.7
  1. Then, onto the main event, we cd to a sensible build location (somewhere like ~/build or /usr/local/build) and checkout the full source tree from SVN:
    $ mkdir -p ~/build/squeezebox $ cd ~/build/squeezebox $ svn co http://svn.slimdevices.com/repos/slim/7.8/trunk
  2. If you don't use any swap, now might be a good time to add some, at least temporarily:
    $ sudo dd if=/dev/zero of=/mnt/[somewhere]/swap_extra bs=8M count=128 $ sudo /bin/ln -s /mnt/[somewhere]/swap_extra /var/swap_extra $ sudo mkswap /var/swap_extra $ sudo swapon /var/swap_extra
  3. The source includes a number of helper build scripts, including one which will very helpfully package up the compiled binaries into a RPM or .deb archive. But first, we need to compile the binaries for our specialist system, for which there are also a number of helper scripts.
    The first of these is the CPAN buildme.sh script, which unfortunately is not set up to deal with the version of Perl (5.14.2) that seems to be included in my version of Raspbian. We need to let the script know where the Perl binary lies, which can be done using the patch below:
    --- vendor/CPAN/buildme.sh (revision 34107) +++ vendor/CPAN/buildme.sh (working copy) @@ -142,6 +142,11 @@ PERL_514=$HOME/perl5/perlbrew/perls/perl-5.14.1/bin/perl5.14.1 fi +# Path to Perl 5.14.2 +if [ -x "/usr/bin/perl5.14.2" ]; then + PERL_514=/usr/bin/perl5.14.2 +fi + if [ $PERL_514 ]; then echo "Building with Perl 5.14 at $PERL_514" fi
    You can edit the file by hand, or download the patch from here (md5) and apply it with:
    trunk$ patch -p0 -i CPAN_buildme.sh.patch
  4. And then we start actually building...
    trunk$ cd vendor/CPAN trunk/vendor/CPAN$ ./buildme.sh Building with Perl 5.14 at /usr/bin/perl5.14.2 Sub-Uplevel-0.22 Sub-Uplevel-0.22/MANIFEST Sub-Uplevel-0.22/META.yml Sub-Uplevel-0.22/MANIFEST.SKIP Sub-Uplevel-0.22/Todo Sub-Uplevel-0.22/README ... auto/YAML/ auto/YAML/XS/ auto/YAML/XS/LibYAML/ auto/YAML/XS/LibYAML/LibYAML.so sent 9144874 bytes received 631 bytes 6097003.33 bytes/sec total size is 9140723 speedup is 1.00
  5. This will definitely take some time (hours...), so leave it running overnight if possible. But once it is complete, you will have a full folder of CPAN libraries in the build/arch/5.14 subfolder, which we copy out to the server folder as our new gnueabihf architecture.
    trunk/vendor/CPAN$ cp -r build/arch/5.14/arm-linux-gnueabihf-thread-multi-64int ../../server/CPAN/arch/5.14/
  6. This should actually be sufficient to get LMS up and running, but if you would like to get all the additional external binaries compiled too (for SoX/Apple Lossless support etc) you will need to run the helper-scripts and copy the binaries for the other vendor subfolders:
    trunk/vendor/CPAN$ cd ../alac_decoder trunk/vendor/alac_decoder$ chmod +x build.sh trunk/vendor/alac_decoder$ ./build.sh Makefile build gcc -c -ggdb -O3 -W -Wall alac.c -o alac.o alac.c:278:2: warning: #warning using generic count leading zeroes. You may wish to write one for your CPU / compiler [-Wcpp] gcc -c -ggdb -O3 -W -Wall demux.c -o demux.o demux.c: In function 'read_chunk_ftyp': demux.c:53:14: warning: variable 'minor_ver' set but not used [-Wunused-but-set-variable] demux.c: In function 'read_chunk_hdlr': demux.c:110:24: warning: variable 'compsubtype' set but not used [-Wunused-but-set-variable] demux.c:110:14: warning: variable 'comptype' set but not used [-Wunused-but-set-variable] demux.c: In function 'read_chunk_stbl': demux.c:367:21: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' [-Wformat] demux.c:367:21: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' [-Wformat] gcc -c -ggdb -O3 -W -Wall main.c -o main.o gcc -c -ggdb -O3 -W -Wall stream.c -o stream.o gcc -c -ggdb -O3 -W -Wall wavwriter.c -o wavwriter.o gcc -o alac alac.o demux.o main.o stream.o wavwriter.o trunk/vendor/alac_decoder$ cp alac ../../server/Bin/arm-linux/
    trunk/vendor/alac_decoder$cd ../faad2 trunk/vendor/faad2$ ./buildme-linux.sh Most log mesages sent to trunk/vendor/faad2/config.log... only 'errors' displayed here Untarring... Configuring... Running make Running make install alac.c:329:2: warning: #warning using generic count leading zeroes. You may wish to write one for your CPU / compiler [-Wcpp] tar: Removing leading `/' from member names trunk/vendor/faad2/faad2-build-armv6l-34107/ trunk/vendor/faad2/faad2-build-armv6l-34107/lib/ trunk/vendor/faad2/faad2-build-armv6l-34107/lib/libfaad.la trunk/vendor/faad2/faad2-build-armv6l-34107/lib/libfaad.a trunk/vendor/faad2/faad2-build-armv6l-34107/lib/libmp4ff.a trunk/vendor/faad2/faad2-build-armv6l-34107/include/ trunk/vendor/faad2/faad2-build-armv6l-34107/include/faad.h trunk/vendor/faad2/faad2-build-armv6l-34107/include/mp4ffint.h trunk/vendor/faad2/faad2-build-armv6l-34107/include/mp4ff.h trunk/vendor/faad2/faad2-build-armv6l-34107/include/neaacdec.h trunk/vendor/faad2/faad2-build-armv6l-34107/bin/ trunk/vendor/faad2/faad2-build-armv6l-34107/bin/faad trunk/vendor/faad2/faad2-build-armv6l-34107/share/ trunk/vendor/faad2/faad2-build-armv6l-34107/share/man/ trunk/vendor/faad2/faad2-build-armv6l-34107/share/man/manm/ trunk/vendor/faad2/faad2-build-armv6l-34107/share/man/manm/faad.man trunk/vendor/faad2$ cp $(tar zxvf faad2-build-armv6l-34107.tgz --wildcards *bin/faad) ../../server/Bin/arm-linux/
    trunk/vendor/faad2$cd ../flac trunk/vendor/flac$ ./buildme-linux.sh Most log mesages sent to trunk/vendor/flac/config.log... only 'errors' displayed here Untarring libogg-1.1.3.tar.gz... Configuring... Running make... Untarring... Configuring... Running make ... trunk/vendor/flac/flac-build-armv6l-34107/share/doc/flac-1.2.1/html/documentation_tools_flac.html trunk/vendor/flac/flac-build-armv6l-34107/share/doc/flac-1.2.1/html/flac.css trunk/vendor/flac/flac-build-armv6l-34107/share/doc/flac-1.2.1/html/comparison.html trunk/vendor/flac/flac-build-armv6l-34107/share/aclocal/ trunk/vendor/flac/flac-build-armv6l-34107/share/aclocal/libFLAC.m4 trunk/vendor/flac$ cp $(tar zxvf flac-build-armv6l-34107.tgz --wildcards *bin/flac) ../../server/Bin/arm-linux/
    trunk/vendor/flac$cd ../shine-fixed trunk/vendor/shine-fixed$ make gcc -shared -Wl,-soname,libshine-fxp.so.1 -o libshine-fxp.so.1.0.0 L3SubBand.o L3bitstrea.o L3loop.o L3mdct.o Layer3.o bitstream.o formatbits.o huffman.o reservoir.o tables.o -lc -lm ar rcs libshine-fxp.la L3SubBand.o L3bitstrea.o L3loop.o L3mdct.o Layer3.o bitstream.o formatbits.o huffman.o reservoir.o tables.o gcc -fno-exceptions -Wall -O2 -fsigned-char -I. -o shineenc L3SubBand.o L3bitstrea.o L3loop.o L3mdct.o Layer3.o Main.o bitstream.o formatbits.o huffman.o reservoir.o tables.o wave.o -lm libshine-fxp.la trunk/vendor/shine-fixed$ cp shineenc ../../server/Bin/arm-linux/
    trunk/vendor/shine-fixed$ cd ../sox trunk/vendor/sox$ ./buildme-linux.sh Most log mesages sent to trunk/vendor/sox/config.log... only 'errors' displayed here Untarring libogg-1.1.4.tar.gz... Configuring... Running make... Untarring libvorbis-1.2.3.tar.gz... Configuring... Running make os.h:173:12: warning: 'vorbis_ftoi' defined but not used [-Wunused-function] os.h:173:12: warning: 'vorbis_ftoi' defined but not used [-Wunused-function] ... trunk/vendor/sox/sox-build-armv6l-34107/share/man/man1/rec.1 trunk/vendor/sox/sox-build-armv6l-34107/share/man/man1/play.1 trunk/vendor/sox/sox-build-armv6l-34107/share/man/man1/soxi.1 trunk/vendor/sox/$ cp $(tar zxvf sox-build-armv6l-34107.tgz --wildcards *bin/sox) ../../server/Bin/arm-linux/
    trunk/vendor/wavpack$cd ../wavpack trunk/vendor/wavpack$ ./build.sh wavpack-4.50.1/ wavpack-4.50.1/config.guess wavpack-4.50.1/src/ wavpack-4.50.1/src/extra2.c wavpack-4.50.1/src/wputils.c ... test -z "trunk/vendor/wavpack/build/lib/pkgconfig" || /bin/mkdir -p "trunk/vendor/wavpack/build/lib/pkgconfig" /usr/bin/install -c -m 644 'wavpack.pc' 'trunk/vendor/wavpack/build/lib/pkgconfig/wavpack.pc' make[2]: Leaving directory `trunk/vendor/wavpack/wavpack-4.50.1' make[1]: Leaving directory `trunk/vendor/wavpack/wavpack-4.50.1' trunk/vendor/wavpack $ cp wvunpack ../../server/Bin/arm-linux/
  7. There is one more step that needs fixing before we package up the new software, which is required to make sure that the server finds the newly created libraries/binaries. The assumption used at launch is that all ARM platforms use interchangable binaries, even though there are a wide range of arch strings: we simply add an exception where the arch string contains 'gnueabihf' by applying the following patch (md5):
    --- server/Slim/bootstrap.pm (revision 34107) +++ server/Slim/bootstrap.pm (working copy) @@ -114,7 +114,12 @@ # Some ARM platforms use different arch strings, just assume any arm*linux system # can run our binaries, this will fail for some people running invalid versions of Perl # but that's OK, they'd be broken anyway. - if ( $arch =~ /^arm.*linux/ ) { + + # With an exception first for hard-float ARM, which needs its own binaries + if ( $arch =~ /^arm.*linux-gnueabihf/ ) { + $arch = 'arm-linux-gnueabihf-thread-multi'; + $arch .= '-64int' if $is64bitint; + } elsif ( $arch =~ /^arm.*linux/ ) { $arch = 'arm-linux-gnueabi-thread-multi'; $arch .= '-64int' if $is64bitint; }
    trunk/vendor/wavpack$ cd ../.. trunk$ patch -p0 -i bootstrap.pm.patch
  8. Finally, we need to build the .deb package before installation:
    trunk/vendor/wavpack$ cd ../../platforms trunk/platforms$ ./buildme.pl --build debian --buildDir ../DEBIAN/build --sourceDir .. --destDir ../DEBIAN/deb --releaseType nightly --fakeroot INFO: Required variables passed in. Moving forward. INFO: $buildDir -> ../DEBIAN/build INFO: $destDir -> ../DEBIAN/deb INFO: $sourceDir -> .. INFO: $version -> 7.8.0 INFO: $squeezeCenterStartupScript -> ../server/slimserver.pl INFO: $releaseType -> release INFO: Build Directory (../DEBIAN/build) was created... INFO: Dest Directory (../DEBIAN/deb) was created... INFO: Making copy of server source (.. -> ../DEBIAN/build) INFO: Last Revision number is: 33961 INFO: Building package for Debian Release... ... dh_builddeb dpkg-deb --build debian/logitechmediaserver .. dpkg-deb: building package `logitechmediaserver' in `../logitechmediaserver_7.8.0_all.deb'. dpkg-buildpackage: binary only upload (no source included)
  9. So, we install the package and hopefully everything will be working happily:
    trunk/platforms$ cd ../DEBIAN/deb/ trunk//DEBIAN/deb $ sudo dpkg -i logitechmediaserver_7.8.0_all.deb Selecting previously unselected package logitechmediaserver. (Reading database ... 48713 files and directories currently installed.) Unpacking logitechmediaserver (from logitechmediaserver_7.8.0_all.deb) ... Setting up logitechmediaserver (7.8.0) ... changed ownership of `/var/lib/squeezeboxserver/Plugins' from root:root to squeezeboxserver:nogroup Making sure that Logitech Media Server is not running first: start-stop-daemon: warning: failed to kill 11950: No such process No process in pidfile '/var/run/logitechmediaserver.pid' found running; none killed. Starting Logitech Media Server.
    If you find any dependency issues, you may need to get them using apt:
    trunk/DEBIAN/deb$ sudo apt-get -f install

Comments on whether this works, whether you have used the .deb package and where I've made errors are much appreciated! But if you just want the .deb package, you can find it at the attachments below...


Comment from: Robert Pincus [Visitor]
Robert Pincus

Hi - Just wanted to say thanks a lot for putting this together. It works like a dream on my model B with a network disk as the music storage. I was quite pleased to be able to see all the steps that go into the package.

04/11/13 @ 03:24
Comment from: Jesper Skov [Visitor]  
Jesper Skov

The .deb worked on my Cubieboard2 with Linaro out of the box.
Thank you so much for providing it!

11/12/13 @ 19:03
Comment from: bearsh [Visitor]

Thanks a lot for the .deb and also the instructions! it worked out of the box on cubian (debian for cubiebord)

18/12/13 @ 08:41
Comment from: Steve Foster [Visitor]
Steve Foster

Thank you. Excellent guide :)

04/03/14 @ 10:04
Comment from: Lulu Belle [Visitor]
Lulu Belle

The installation with .deb worked on my Cubietruck with Cubian out of the box.

Thank you so much for providing it!

25/03/14 @ 10:29
Comment from: Michael [Visitor]

Please no longer use the old svn.slimdevices.com site. We’ve moved to github.com/Logitech a while ago. There you should find updated buildme scripts which would support recent Perl versions. See https://github.com/Logitech/slimserver-vendor

03/10/14 @ 07:34
Comment from: foolonthehill [Member]


Many thanks for your comment - I will update the post accordingly.


03/10/14 @ 13:32
Comment from: Will [Visitor]  

Thanks very much for the deb. Installed it on latest version of raspbmc and all seems to run well. Unfortunately the logitechmediaservice doesn’t start at boot, I have to start the service from command line after the system has booted.
Struggling to troubleshoot the issue due to my lack of Linux knowledge and can’t find a solution on google.
Do you have any suggestions as to how I may resolve the issue?
Thanks very much

01/01/15 @ 23:52
Comment from: St. Gothian [Visitor]
St. Gothian

I just installed with .deb on my Banana Pi running Bananian. Works brilliantly.
Thank you very much indeed!

31/01/15 @ 11:08
Comment from: Andrew [Visitor]

After much searching for a simple way to install LMS on my raspberry pi 2, I decided to try your .deb file and it worked! Thanks!

Hope you will create a new deb file if you update to 7.8.1 or 7.9 (when it is stable).

25/02/15 @ 12:17
Comment from: Pete Kane [Visitor]  
Pete Kane

Hi there and thanks for your efforts, I’ve been using your deb for a year or so now and it works perfectly, having some time on my hands I thought I’d try and compile it myself, when I’ve shelled into the pi to check on the progress It sometimes is waiting for confirmation to overwrite a file so if I hadn’t checked it wouldn’t have proceeded is there a way to say always overwrite ?

14/07/15 @ 14:03

Form is loading...