Fix various build errors on Linux