Gave up porting to linux. Got rid of the mess.