FindIconv: Problem on macOS with mac ports
When mac ports installs libiconv, it does so with different symbols than those used by libiconv when present as a system library (eg. libiconv_open
instead of iconv_open
). Apparently, that's by design and won't change.
That's in addition to the macOS provided version of libiconv, which does have the usual symbols.
When something uses CMake to find libiconv on a system which has both, CMake will find the mac port version first, but won't notice it doesn't have the unmodified symbols, so things fail to build or link. See for instance https://github.com/rust-lang/git2-rs/issues/830 or https://trac.macports.org/ticket/61222.
It'd be good if CMake dealt with the renamed symbols so that linking against the mac ports library with libiconv_open
and friends worked, or skipped that library because it doesn't have the expected symbols, kept on searching, and found the system library, which does.