Statically Linking PipeWire

I recently helped Tuple solve an interesting problem. They’re working on a Linux version of their pair programming tool, and they want to make it a fully static executable so that they can ship the same build everywhere.

Alright no big deal, just link any dependencies statically and use musl. Easy, right?

Unfortunately, it’s not quite that easy. Tuple needs to talk to PipeWire for screen capture, and PipeWire makes heavy use of dlopen, so statically linking it isn’t an option…or is it?

To solve this, I’ve open sourced a build.zig configuration that generates a static build of PipeWire. The rest of this post elaborates on why this is challenging, why solving it is possible, and how my solution works.

37 Likes