Same issue here, BUILD_PNG=OFF worked fine, I just wanted to point out that it is important to install libpng12-dev first