Dominik Süß

fighting computers since 1999

Nix build linking issues


I recently tried to build https://github.com/intel/xpumanager but it consistently failed with linking errors.

When debugging, I tried replacing the thin archives (e.g. utility/table/libtable.a) with the specific file they resolve to (e.g. utility/table/libtable.a.p/libtable.o). This fixed the issue but I couldn't figure out why.

Eventually, I stumbled upon the GCC LTO Docs which state that:

By default, object files generated with LTO support contain only GIMPLE bytecode. Such objects are called “slim”, and they require that tools like ar and nm understand symbol tables of LTO sections. For most targets these tools have been extended to use the plugin infrastructure, so GCC can support “slim” objects consisting of the intermediate code alone.

Turns out, nix gcc uses standard binutils by default which don't support this. Disabling LTO fixed the issue but I'll still have to find out which solution nix prefers before I can upstream this package