Fix build for linking with shared library