build: fix linking with --enable-static-build