[pulseaudio-discuss] PA now compiles on OS X

Kim Lester kim at dfusion.com.au
Sun Jul 19 11:16:55 PDT 2009


Well I decided to take the plunge over the weekend. It was either that  
or paint a room at home :-)
I spent part of the weekend porting PA to OS X and discovered much.

PA now compiles on OS X
And what a bugger that was!

Now don't get your hopes to high and bear in mind I'd never seen PA  
before friday and I've still never seen it running on anything yet. It  
just happened to be something of interest as I want a low-latency  
cross platform rtp server on my mac (I was too lazy to boot my linux  
box and Darwin Streaming Server was too easy ;-) )

I have some draft instructions for doing a clean install and build as  
well as several patched/new files. I'll sort them out in a few days.
The build should be consistent and repeatable on other systems.

I discovered that my superficial aversion to autoconf etc and libtool  
is somewhat justified but I am getting my head around them after  
avoiding them for years.

I also discovered some new rude words to say in Apple's general  
direction....
Most of my software development has been on Linux and Solaris. I've  
never had to write any significant system software on Darwin.
So whilst this may be old news to many of you, I've just found out  
many of Darwin's non-posix/standard quirks.

The challenges included:
	* All the POSIX semaphore functions are supported EXCEPT anonymous  
semaphores via sem_init().  Guess what PA uses %&*#@#!!
		So I've added a new sempahore-osx.c to handle that.
	* Darwin doesn't support the POSIX clock_get*() functions. Guess what  
PA sues *%$#)*
		So I've written high resolution clock_get*() equivalent functions.
	* PA scripts use preload etc to load modules - but Darwin treats  
shared libs and modules (bundles) as different species, so preload  
breaks. &%(#**&@#@!
	* linking in Apple frameworks

Anyhow you get the idea :-)

I don't claim the result does anything useful, but - hey - at least it  
runs a bit :-)
Because it doesn't load all the modules at startup (for now anyway)  
here is my command line and some debug. Notes below.

./pulseaudio --load="module-sine-source" --load="module-null-sink"  -- 
load="module-cli-protocol-tcp"  --log-level=debug --log-target=stderr

=============
I: core-util.c: Failed to acquire high-priority scheduling: Permission  
denied
I: main.c: This is PulseAudio 0.9.16-test2-4-g7e450-dirty
D: main.c: Compilation host: i386-apple-darwin9.7.0
D: main.c: Compilation CFLAGS: -g -O0 -I/opt/local/include -Wall -W - 
Wextra -pipe -Wno-long-long -Winline -Wundef -Wformat=2 -Wsign-compare  
-Wformat-security -Wmissing-include-dirs -Wformat-nonliteral -Wold- 
style-definition -Wpointer-arith -Winit-self -Wdeclaration-after- 
statement -Wfloat-equal -Wmissing-prototypes -Wstrict-prototypes - 
Wredundant-decls -Wmissing-declarations -Wmissing-noreturn -Wshadow - 
Wendif-labels -Wcast-align -Wstrict-aliasing=2 -Wwrite-strings -Wno- 
unused-parameter -ffast-math -Wp,-D_FORTIFY_SOURCE=2 -fno-common
D: main.c: Running on host: Darwin i386 9.7.0 Darwin Kernel Version  
9.7.0: Tue Mar 31 22:52:17 PDT 2009; root:xnu-1228.12.14~1/RELEASE_I386
D: main.c: Found 2 CPUs.
I: main.c: Page size is 4096 bytes
D: main.c: Compiled with Valgrind support: no
D: main.c: Running in valgrind mode: no
D: main.c: Optimized build: no
D: main.c: All asserts enabled.
I: main.c: Machine ID is Big-Mac.local.
I: main.c: Using runtime directory /Users/kim/.pulse/Big- 
Mac.local:runtime.
I: main.c: Using state directory /Users/kim/.pulse.
I: main.c: Running in system mode: no
W: pid.c: Stale PID file, overwriting.
I: main.c: Fresh high-resolution timers available! Bon appetit!
D: memblock.c: Using shared memory pool with 1024 slots of size 64.0  
KiB each, total size is 64.0 MiB, maximum usable slot size is 65496
I: source.c: Created source 0 "sine_input" with sample spec float32le  
1ch 44100Hz and channel map mono
I: source.c:     device.description = "Sine source at 440 Hz"
I: source.c:     device.class = "abstract"
I: source.c:     sine.hz = "440"
I: source.c:     device.icon_name = "audio-input-microphone"
D: module-sine-source.c: Thread starting up
I: module.c: Loaded "module-sine-source" (index: #0; argument: "").
I: sink.c: Created sink 0 "null" with sample spec s16le 2ch 44100Hz  
and channel map front-left,front-right
I: sink.c:     device.description = "Null Output"
I: sink.c:     device.class = "abstract"
I: sink.c:     device.icon_name = "audio-card"
I: source.c: Created source 1 "null.monitor" with sample spec s16le  
2ch 44100Hz and channel map front-left,front-right
I: source.c:     device.description = "Monitor of Null Output"
I: source.c:     device.class = "monitor"
I: source.c:     device.icon_name = "audio-input-microphone"
D: module-null-sink.c: Thread starting up
I: module.c: Loaded "module-null-sink" (index: #1; argument: "").
W: socket-util.c: IP_TOS failed: Invalid argument
I: module.c: Loaded "module-cli-protocol-tcp" (index: #2; argument: "").
I: main.c: Daemon startup complete.

=============
  telnet localhost 4712

various commands work (stat, info,dump etc)
=============
./pulseaudio --dump-modules

module-always-sink                      Always keeps at least one sink  
loaded even if it's a null one
module-always-sink.so                   Always keeps at least one sink  
loaded even if it's a null one
module-augment-properties               Augment the property sets of  
streams with additional static information
module-augment-properties.so            Augment the property sets of  
streams with additional static information

[...snip...]


module-simple-protocol-tcp              Simple protocol (TCP sockets)
module-simple-protocol-tcp.so           Simple protocol (TCP sockets)
module-simple-protocol-unix             Simple protocol (UNIX sockets)
module-simple-protocol-unix.so          Simple protocol (UNIX sockets)
module-sine                             Sine wave generator
module-sine-source                      Sine wave generator source
module-sine-source.so                   Sine wave generator source
module-sine.so                          Sine wave generator
module-stream-restore                   Automatically restore the  
volume/mute/device state of streams
module-stream-restore.so                Automatically restore the  
volume/mute/device state of streams
module-suspend-on-idle                  When a sink/source is idle for  
too long, suspend it
module-suspend-on-idle.so               When a sink/source is idle for  
too long, suspend it
E: modinfo.c: Failed to open module "/Users/kim/software/pulseaudio/ 
src/.libs/module-tunnel": file not found
module-tunnel-sink                      Tunnel module for sinks
module-tunnel-sink.so                   Tunnel module for sinks
module-tunnel-source                    Tunnel module for sources
module-tunnel-source.so                 Tunnel module for sources
module-volume-restore                   Compatibility module
module-volume-restore.so                Compatibility module
module-x11-bell                         X11 bell interceptor
module-x11-bell.so                      X11 bell interceptor
module-x11-cork-request                 Synthesize X11 media key  
events when cork/uncork is requested
module-x11-cork-request.so              Synthesize X11 media key  
events when cork/uncork is requested
module-x11-publish                      X11 credential publisher
module-x11-publish.so                   X11 credential publisher
module-x11-xsmp                         X11 session management
module-x11-xsmp.so                      X11 session management

==============
Notes

1) Failed to acquire high-priority scheduling: Permission denied  --  
goes away if you run it as root etc.
2) Cannot load "module-cli" because of a bug (maybe with glib_io_new)  
- anyhow we enter an infinite loop and then death.
	possibly caused by failing to (re)open STDIN as the terminal device.  
Probably reads EOF or bad fd.
	How
3) Yes I can see the modules are listed twice .... :-)


cheers

Kim




More information about the pulseaudio-discuss mailing list