Tuesday, July 17, 2012

Finally, the How-To for forked-daapd on CentOS 6.2 64 Bit

FYI, I have superseded this post - I got very frustrated with recompiling the whole kit and caboodle every time I did an update just to have this running.  So, I opted for the mt-daapd server, and it was easier to install, less external dependencies, and still did everything I needed it to.  Try this post before continuing on!

Okay, I'm finally getting to the point of writing up how I finally got forked-daapd installed on my CentOS 6.2 64 Bit media server. It was a pain, but it works.

My process was : try to configure, compile, and install. If it failed, deal with the problem and repeat.

Simple process, but there was a LOT that was problematic.

First, the dependencies (you will need the rpmfusion repository configured) :

yum install gcc glibc-devel avahi-devel ffmpeg-devel libplist-devel taglib-devel flac-devel libunistring-devel java libgcrypt-devel mxml-devel libevent-devel alsa-lib-devel gettext-devel libconfuse-devel gperf zlib-devel ant ant-antlr ant-apache-bcel ant-junit ant-trax antlr tcl-devel git

You will note that we need a stringtemplate RPM as well (hard to find, so I slapped a copy at http://svn.silverhawk.net/files/stringtemplate-3.2.1-3.jpp6.noarch.rpm). I needed to search a bit for one, as it's not in the regular distro, but grab that one.

This should get ALMOST everything. Note that sqlite has to be recompiled. In order to satisfy dependencies, I rebuilt that into an RPM to replace what was there (this one has the option required for forked-daapd). A few others were not found, so I slapped them together, building a number of these RPM's. Currently, the source RPM's are available here :

http://svn.silverhawk.net/files/antlr3-3.1.1-10.el6.src.rpm
http://svn.silverhawk.net/files/libantlr3c-3.1.3-0.2.src.rpm
http://svn.silverhawk.net/files/sqlite-3.6.20-2.el6.src.rpm

You will also want to install the -devel packages for each one once you've built good system packages. You can seamlessly replace any sqlite packages. Note that upgrades might not work with the custom sqlite, but it's easy to grab the source RPM for the upgraded sqlite, add the param, and then upgrade it manually, then the system should update again.

Once those dependencies are installed, you must toss in mxml (available from http://svn.silverhawk.net/files/mxml-2.7.tar (after compiling and installing, copy the mxml.pc file into the appropriate location, mine was /usr/share/pkgconfig/), and then libavl (available from http://alioth.debian.org/~jblache/forked-daapd/libavl_0.3.5.tar.gz) :

  1. Edit the make file, and Comment out "CFLAGS ?= -O2 -fomit-frame-pointer -pipe -mcpu=i686 -w"
  2. Add a new CFLAGS Line :
    CFLAGS = -fPIC -O2 -fomit-frame-pointer -pipe -Wall -g
  3. Replace all "$(LIBRARIES)" variables with "$(LIBRARY)" due to a bug.
  4. Save and Close
  5. Build and install :
    gmake -f GNUmakefile ; gmake -f GNUmakefile install
Now, open the forked-daapd source code, but grab a specific version (you might need to install git if you didn't get it installed earlier) specific for the iTunes 10.5.x functionality (otherwise it will time out) :
  1. mkdir tmp
  2. cd tmp/
  3. git clone https://github.com/CBGoodBuddy/forked-daapd.git
  4. cd forked-daapd
  5. git checkout itunes_v10_5
  6. autoreconf -i
  7. ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-flac --enable-musepack --enable-itunes
  8. make
  9. make install
To run the app, first modify your configuration (/etc/forked-daapd.conf), and then add a user :
useradd -s /sbin/nologin -M -r -d /var/cache/forked-daapd -c "iTunes service account" daapd

9 comments:

  1. If you get an error about :

    filescanner_ffmpeg.c:204: warning: "AVMetadata" is deprecated
    filescanner_ffmpeg.c: In function "extract_metadata_core":
    filescanner_ffmpeg.c:206: warning: "AVMetadataTag" is deprecated
    filescanner_ffmpeg.c:225: warning: "av_metadata_get" is deprecated (declared at /usr/include/ffmpeg/libavformat/avformat.h:251)
    filescanner_ffmpeg.c: In function "scan_metadata_ffmpeg":
    filescanner_ffmpeg.c:312: warning: "av_open_input_file" is deprecated (declared at /usr/include/ffmpeg/libavformat/avformat.h:1480)
    filescanner_ffmpeg.c:320: warning: "av_find_stream_info" is deprecated (declared at /usr/include/ffmpeg/libavformat/avformat.h:1526)
    filescanner_ffmpeg.c:325: warning: "av_close_input_file" is deprecated (declared at /usr/include/ffmpeg/libavformat/avformat.h:1706)
    filescanner_ffmpeg.c:347: error: "CODEC_TYPE_VIDEO" undeclared (first use in this function)
    filescanner_ffmpeg.c:347: error: (Each undeclared identifier is reported only once
    filescanner_ffmpeg.c:347: error: for each function it appears in.)
    filescanner_ffmpeg.c:358: error: \u2018CODEC_TYPE_AUDIO" undeclared (first use in this function)
    filescanner_ffmpeg.c:375: warning: "av_close_input_file" is deprecated (declared at /usr/include/ffmpeg/libavformat/avformat.h:1706)
    filescanner_ffmpeg.c:397: warning: "av_get_bits_per_sample_format" is deprecated (declared at /usr/include/ffmpeg/libavcodec/avcodec.h:4529)
    filescanner_ffmpeg.c:545: warning: "av_metadata_conv" is deprecated (declared at /usr/include/ffmpeg/libavformat/avformat.h:268)
    filescanner_ffmpeg.c:576: warning: "av_close_input_file" is deprecated (declared at /usr/include/ffmpeg/libavformat/avformat.h:1706)

    Then you probably have an old version of forked-daapd - try something more recent (e.g. 0.18 had the patch for this). It's a result of the ffmpeg-devel libraries being newer than the forked-daapd code you have.

    ReplyDelete
  2. Also, if you have iptables running between you and the client, the rules are :

    # forked-daapd iTunes media server
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 3689 -j ACCEPT
    -A INPUT -m state --state NEW -m udp -p udp --dport 40306 -j ACCEPT
    -A INPUT -m state --state NEW -m udp -p udp --dport 39294 -j ACCEPT

    ReplyDelete
  3. Also, just to quote from a previous post :

    Hey, folks; I was setting up forked-daapd in CentOS 6.2 (64 Bit), and ran into a few problems. One of the most recent was that the libantlr3c was not being used (headers were found). I found that if I add a --enable-64bit to the configure line (I used an RPM spec file), it will create it for 64 bit, which is really what I needed. I realized this when it kept failing to configure the forked-daapd with an error about libantlr3 and a missing function, and when I looked in the config.log for the error, the linker was ignoring the 32 bit libraries. (If you haven't enabled 64 bit, it is 32 by default, and you would have to use a 32 bit compiler by default if you wanted to). So, there is another quick hack.

    ReplyDelete
  4. once I build the new sqlite, how do I install it as there is already an sqlite installed in /usr. Yum only knows about the version that is already there. If we put a different version there than yum knows about, doesn't that break package management?

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. The files listed stringtemplate, antlr, libantlr, and sqlite are missing from your site. Livable seems to be gone from the other site, too. Have these anywhere?

    ReplyDelete
  7. After searching for the files at rpm.pbone.net I am only left with trying to find a working version of http://alioth.debian.org/~jblache/forked-daapd/libavl_0.3.5.tar.gz
    Anybody?

    Otherwise during configure I get
    checking avl.h usability... no
    checking avl.h presence... no
    checking for avl.h... no
    configure: error: avl.h not found

    ReplyDelete
  8. Sorry about the migration. I've changed my links. I don't have the debian link, but the rest are good.

    Once you have the new sqllite RPM, you can force remove it using a "-e rpm name --force". Then you can reinstall.

    ReplyDelete
  9. Note, I just gave up on forked-daad after the umpteenth recompile of everything after a security patch. I opted for mt-daapd. It has fewer dependencies, and works just as well.

    ReplyDelete