Fix linker bugs in the build with some linux distros