| « rbpitch Is Here! |
Earlier today, I got an email in the pulseaudio-discuss mailing list from a nice-sounding guy looking for help compiling PulseAudio on a rather challenging platform. He has some specific requirements that are rather odd, but despite my trying to break through some of the problems making the requirements what they are, I conceded that his “box in a box in a box” solution may be the best available, for performance reasons. I decided at that point that I would help him.
Follow up:
Ace Suares, the guy who wrote the email, is trying to build a LTSP platform using a fairly modern server, and a series of very old thin clients, for use in a grade school environment. The school is very poor, and needs to use Free Software combined with very inexpensive LTSP clients to afford a computer lab scenario. If my instincts are correct, Suares & Co. resides in the Netherlands Antilles. His blog, which contains helpful information documenting the steps of his rather unique setup, has the TLD of .AN, which denotes “University of Netherlands Antilles” according to IANA.
I decided to take it upon myself to compile PulseAudio for this strange platform, called “DamnSmallLinux (Not)". It’s basically a rebuild of DamnSmallLinux, but with slightly larger footprint and a 2.6 Linux kernel instead of a 2.4 kernel. Ace and I are both using the latest available DSL-N as of today, which is DSL-N-01 RC4, running Linux 2.6.12.
Fortunately for my sanity (and Ace’s), he only needs the PulseAudio client libraries on the DSL(N) platform; his PulseAudio daemon(s) will run outside of that.
Unfortunately for my sanity, the PulseAudio build system amalgamates the configuration and build of both the daemon and the client. This is a severe limitation that I hope will soon be fixed, so that just the client libraries can be compiled easily with a configure switch. This eliminates many potential build issues and dependencies specific to the daemon. I will look into implementing such a switch soon, as it would have saved me about an hour of screwing around with ltdl and the PulseAudio daemon sources.
The purpose of this blog post, now, is to document:
(a) My steps through the quagmire of building PulseAudio on such a stripped-down platform as DSL-N;
(b) The steps you (the reader) can take to install the PulseAudio client libs I’ve built on your own DSL-N instance (and possibly also a regular DSL instance, but YMMV);
© The juicy link to the .dsl file I’ve packaged up for you, which conveniently happens to be exactly what Ace needs ;p
(d) Instructions for getting this to work on your platform.
So, I’m delving in now; either put on your hardhat, skip to the part you care about, or leave ;)
NB: If you’re just here for the .dsl binary of the pulseaudio client library, headers and builtin frontend programs, skip to the bottom of this blog post.
(a) Building PulseAudio (without hacking PulseAudio to compile only the client) on DSL(N):
1. Download and install the DSL Modules gcc1-with-libs, flex-bison-libtool, and libc6-dev from ibiblio’s MyDSL repo. You’ll have to use the builtin DSL browser.
2. Compile and install GNU gettext. This is fairly straightforward; you download the latest stable tarball from GNU ftp and do the standard ./configure –prefix=/usr && make && sudo make install.
3. Compile and install Perl 5.10.0 or later. This is needed for intltool. The configuration script for this is called Configure instead of configure; it asks you about 100 questions about your system. You can accept most of the defaults, but you want this to overwrite the DSL-shipped (outdated) perl, so any paths referencing /usr/local need to be plain old /usr instead. The other options are safe as defaults, though you may want to enable a threaded Perl as I did, because that saves you several steps. Follow the instructions printed after you finish running Configure.
4. Grab the XML::Parser tarball distribution from CPAN. To build, run perl Makefile.pl && make && sudo make install.
5. If XML::Parser fails to build, grab expat 2.0 or later from sourceforge and build that. Another straightforward configure-based build.
6. All required PulseAudio libraries must be fetched and built from source, because none come preinstalled on DSL or DSL(N). All libraries not marked as (optional) on this PulseAudio.org wiki page must be installed before you proceed. The page also has links to each required library’s download page. Fortunately, the required libraries do not have any second-level dependencies that must also be built.
7. Download and compile intltool and libtool. You need fairly recent versions of these; the latest stable as of December 08 works with PulseAudio 0.9.13.
8. Now comes the interesting part. With PulseAudio 0.9.13, it initializes the rlimits (resource limits) by initializing a static table of function pointers. If it fails to find a single RLIMIT that it uses, it #errors out. Fortunately, Lennart fixed this in git, and now uses dynamic array indexing to allow for certain rlimits to be unavailable. RLIMIT_NPROC is unavailable on DSL due to a lack of kernel support for it; therefore, PulseAudio 0.9.13 cannot build on the system without making major changes.
I was now faced with two options: I could either backport the dynamic table initialization (and the code that later uses the table) to the i++ regime, which tolerates a lack of any given rlimit; or, I could use the latest git version of pulseaudio. Faced with time pressure and the realization that the daemon won’t be used anyway, I went with the latter choice.
9. Check out the latest GIT version of pulseaudio. If you’re reading this article much later than December 08, you may be faced with a whole host of new problems related to the newness or brokenness of the latest GIT build, compared to the versions of stuff available in DSL-N. Consequently, you may want to sync to the particular build I’ve used, because I had success with that build. The commit ID is “f826ded33d079ea7aead78c811f742cee98214e8″. You can sync to this commit by running
git clone git://0pointer.de/pulseaudio.git
git checkout f826ded33d079ea7aead78c811f742cee98214e8
10. The configure should go smoothly with the options –prefix=/usr –sysconfdir=/etc –localstatedir=/var. However, the build will fail without source changes.
There seems to be a bug in libtool where, even if you specify -dlopen force on the command line to load preloaded symbols even if there aren’t any, it still errors out by not defining the external symbol lt_preloaded_symbols. So at link-time you get errors. Details here.
My hack was that, in each translation unit that defines const lt_preloaded_symbols, I commented that out and define it instead as
const lt_dlsymlist lt_preloaded_symbols[] = { { 0, 0 } };
This gives an empty set of lt_preloaded_symbols, which appears to satisfy the compiler. Even if it breaks things at runtime; I don’t have time to debug this right now; the daemon isn’t being used, and the client library doesn’t use ltdl.
The second problem you’ll encounter is that some of the tests use pthread_setaffinity_np – that’s np for non portable. It appears that our DSL(N) still uses LinuxThreads instead of NPTL, which does not support this non-portable pthread call.
The configure script also has no way to disable the tests (bad form #2 on configure modularity, PulseAudio!) so you either need to hack out the tests, or comment out all uses of pthread_setaffinity_np. This is fairly straightforward.
11. You should now have a successful build of pulseaudio – the whole distribution – on DSL(N). make install.
To build the .dsl file that includes headers, libs and binaries (except the broken pulseaudio daemon which segfaults), I executed
tar cvzf ~/pulseaudio-clients-headers-libs_0.9.13+git.dsl /usr/lib/libpulse* /usr/bin/pac* /usr/bin/padsp /usr/bin/paplay /usr/bin/parec /usr/bin/pasuspender /usr/bin/pax11publish /usr/lib/gdbm* /usr/lib/libsndfile* /etc/pulse/client.conf /usr/include/pulse/ /usr/libpkgconfig/libpulse*
Installing this .dsl file on a vanilla install or live boot of DSL(N) enables paplay to play sound.
Now, on to (b), using the fruits of my labor:
1. Boot a DSL instance and ensure that you have access to the public Internet within the instance. Otherwise, you’ll need another way to get the .dsl file into your instance.
2. Come to this blog with the browser and download the DSL file. Or you can run
wget http://tiyukquellmalz.org/pulseaudio-clients-headers-libs_0.9.13+git-december-05-08.dsl in the console.
3. Click “MyDSL” on the DSL(N) instance’s desktop.
4. Click “Load Local MyDSL Extension” in the window that pops up.
5. Navigate to your downloaded .dsl file.
6. Now the files are installed. In a console, you should edit /etc/pulse/client.conf. Change the default-server line to point to the IP address of a server running a PulseAudio daemon – version 0.9.11 or later, unless you want to get errors. This PulseAudio wiki page describes the full possibilities of what you can set the default server to, as well as various ways of setting it.
Done! Now you can:
(a) Run paplay on something like /usr/share/sounds/gaim/redalert.wav, to verify that sound is working.
(b) Compile PulseAudio-using programs from source, because the pkgconfig file and headers are available.
© Attempt to use padsp (which LD_PRELOADs the provided libpulsedsp.so) to enable OSS3 applications to play using the pulseaudio client libraries.
(d) Install the ALSA-pulse plugin (not included) to enable ALSA applications to play using the provided pulseaudio client libraries. You already have all the dependencies installed; you just need to build alsa-plugins.
(e) Drop in binaries of other programs that use the PulseAudio client libraries.
All of the other client-frontend programs that come with pulseaudio are shipped – pacmd, pactl, parec, and so on.
Once again, the link to the DSL package, as promised, is http://tiyukquellmalz.org/pulseaudio-clients-headers-libs_0.9.13+git-december-05-08.dsl. Have lots of fun!
Leave a comment or drop me email if you have questions. I’m also on IRC a lot, chat.freenode.net:{6667,8000} #pulseaudio.
-Sean
This post has 1 feedback awaiting moderation...