Part of the issue was missing library path to png library. Other part was missing iconv passed to linker.