Upgraded build system and fixed gcc compilation