Like every other website on the planet, SmallNetBuilder uses cookies. Our cookies track login status, but we only allow admins to log in anyway, so those don't apply to you. Any other cookies you pick up during your visit come from advertisers, which we don't control.
If you continue to use the site, you agree to tolerate our use of cookies. Thank you!

Wi-Fi Router Charts

Click for Wi-Fi Router Charts

Mesh System Charts

Click for Wi-Fi Mesh System Charts

Building mt-daapd

As I said, the mt-daapd build is somewhat more involved. But don't worry, we'll get through it.

From the mt-daapd directory, execute the following command:

./configure --host=arm-linux --prefix=$BASE
LIBS="-lgdbm -lid3tag -lz" ac_cv_func_setpgrp_void=yes

(Note that the above command is entered on one line with a space between $BASE and LIBS.)

This deserves a bit of explanation. The host and the prefix options we've seen before. The LIBS options is specific to this package. For whatever reason, the stock build was listing the libraries before the .o files during the link phase, causing the link to fail with undefined references.

Investigation of the configure script showed an option, LIBS, that could be used to add extra libraries to the link. So I'm using it here to add back in our libraries. It's a hack, but it saves us from having to make modifications to the configure script itself.

The other new option, ac_cv_func_setpgrp_void is also a bit of a hack. When I first ran the configure script I was getting an error from a specific portion that wanted to run a test program to determine the behavior of a particular function. Of course, with cross-compilation we can't compile and run programs locally. By setting this variable at configure time, we're essentially telling the script that we've already run this particular test and have the answer. This required me to manually determine the correct answer to this test and pass it along on the command line.

NOTE!NOTE: From my experience, this is a common problem when doing cross-compilation and using Autoconf. The authors of a package often don't have a chance to build for a different architecture so the configure script is just not quite correct for a cross-compile . This technique, while a bit ugly, will at least allow you to complete the configuration process.

After running the above command, we'll still have to fix a couple of things before we can do our build. First, in order to simplify our installation, we're going to remove the shared libraries that we just built. When the shared libraries are removed, the link will occur against the static versions. This keeps us from having to add additional libraries that no other process is likely to use. If you find other processes that need these libraries, you can skip this step and add the libraries to your system. Execute the following command from the mt-daapd directory:

rm -f ../lib/*.so*

Next, due to the way that the arm-compiler deals with structures and unions, we'll have to make a code change. By default, the arm compiler pads out structures and unions to 16 bit boundaries. Normally this wouldn't cause a problem, but in our case, structures are read and written directly to the network. The iTunes program on the other side of the network connection doesn't have the padding, resulting in a garbled conversation. The file we'll have to change is src/mDNSClientAPI.h, and the change we'll make is to add an __attribute__ ((packed)) compiler directive to the existing definition.

The following types also need to have the packed attribute added:

  • mDNSOpaque16
  • mDNSOpaque32
  • mDNSOpaque128
  • mDNSAddr
  • rdataSRV
  • rdataMX

After the change, my definition of mDNSOpaque16 looks like this:

typedef union { mDNSu8 b[2]; mDNSu16 NotAnInteger; }
__attribute__ ((packed)) mDNSOpaque16;

(Again, entered as one line, no space between the } and __ .)

The special compilation attribute falls between the right brace and the typedef name. I passed these changes on to the author of mt-daapd , but the changes may or may not get applied since they are fairly specific to the gcc arm compiler.

After adding these attributes, a "make install" will finish up the build and deposit the result in ../sbin/. Finally strip the resultant binary to reduce its size:

$STRIP ../sbin/mt-daapd

and we're done! On to the install!

Support Us!

If you like what we do and want to thank us, just buy something on Amazon. We'll get a small commission on anything you buy. Thanks!

Don't Miss These

  • 1
  • 2