If compiling with a non-default compiler like egcs, make sure that /usr/include is not in the include path, neither should /usr/lib be explicitly listed. Mahogany has been compiled with egcs and gcc-2.8.x on both, libc5 and glibc2 systems.