I also get this exact compile issue. I tried originally on Ubuntu 14.04, then 16.04, and now 16.10 all 64bit.
All compile fine on the 3.3.5a branch, but all end up with this issue on main.
I am gathering through what little I could find on the issue is zlib is not linking correctly or something of that nature?
Cmake is not my strongest suit, so it isn't something I went into any indepth research on.