Fix compilation errors and warnings on Linux