I was trying to build cargo-instruments, to analyse a Rust program for various leaks, but was plagued by an odd problem:

undefined symbols for architecture x86_64:
“_libiconv”, referenced from:
_git_path_iconv in libgit2.a blah blah blah

I traced it down to a conflict between the Rust git2 package and libiconv. Seems like the git code has a hard-coded path to the iconv headers, expecting them to be in /opt/local/lib, which is where MacPorts had stored its version of the iconv library.

By temporarily renaming /opt/local/lib/*iconv* (libiconv.2.dylib, libiconv.a and the libiconv.dylib symlink), I was able to build successfully.