Beware Nvprune

This is a tale of caution, since I thought nvprune to be like strip for device code, but that was not the case.

I started looking into nvprune as an option to generate smaller sized distributions.
Unfortunately, nvprune does not work on binaries nor shared libraries, so using it on static libraries seems like your only hope.
Since neither g++ nor nvcc where doing a really good job at generating smaller binaries, nvprune sort of helped to fill the gap.

Nvprune will be nice enough to generate a library with the same size on your desktop/notebook as it does on a Jetson Nano with Jetpack.
The problem is, would you try to use the x86 pruned library to cross-compile, you shall fail miserably with bad reloc symbols upon compilation (and random segfaults at runtime if you where to remove those).
On the other hand, if you decide to nvprune on the Nano and then use that library for cross compilation, you will be safe from all evil and have a more decently sized running binary.

I post this in the hopes that it may be of use to other folks until Nvidia provides some smaller platform specific libraries or either open-sources their code.


Thanks for your sharing.

nvprune is useful when there are multiple arch in a file and then you want to remove some of the arch.
And it cannot work on executable binaries since the final executable offsets are fixed and cannot be changed in code.