Fix the build process: do not link unused libraries