Saturday, April 13, 2024

Hidden dependencies in Linux binaries.

I have recently released an open source tool called sotrace. It maps out the .so dependencies for a binary or library, and presents them in a nice graph.

When I run it on my lean, mean, simple test program that runs a Vulkan Compute shader, I get this graph of dynamically linked libraries.

So tidy!

Because I also wanted run-time loaded dependencies, I added a mode where you can run sotool on a process-id instead. Running it on a process of the exact same binary, I gaze into the chasm of complexity with despair:

Sweet Mother of Isaac Newton! What is this abomination?

This runs a compute kernel on a GPU, with no graphics output at all. Why is X11 pulled in? And even some wayland stuff? Ugh. This is what I've come to see as hidden dependencies. My program depends on them, even though it does not link against them.

Meanwhile, when I use CUDA instead of Vulkan, I get serenity back. CUDA FTW!

And for completeness, when I run the OpenCL version of my compute kernel:

So, if you are a developer on Linux, give it a try and be amazed at what you dredge up. Let me know your findings!

"Yours Truly, Bram, fighting complexity wherever he finds it.