Here are some porting tips, contributed to the Metapkg project.
  1. When including <sys/mman.h>, you need to include <sys/types.h> first. (See this mailing list item from gnome.org.)