The simplest way is to pass the —target flag with the musl target; that should work unless you’re also including C code, and then it may Just Work or may need you to do something special.
I've been using `nethogs` for this for a long time, and it is already in most Linux repos and can be installed quickly.