Compiler an linker fixes for popular distros

Fixes several compiler and linker problems in Ubuntu and related distros (Mint, Trisquel) and g++ 4.6/4.7.