build: Fix linking to shared libraries