it would be nice if you could explicitly add which libiconv lisaem is expecting
anyone using macports is going to trip over this
I'm not directly using any iconv, I'm using wxWidgets, which in turn will make calls against whatever libiconv its configure script decided to link against. That decision shouldn't be changed between compiling wxWidgets and LisaEm, but I can't control for that. That's the point of a cross platform GUI framework and statically linking it - not having to specify such things. I'm expecting a mostly vanilla os, though yes, on elder macos such as 10.5-10.7 I do use ports and on newer ones I use brew - but this is mostly for updating tools, and less for libs to be used by LisaEm.
Infact, I go out of my way to specify builtin in the wxWidgets scripts for things like png, jpg, tiff, etc. just to avoid such situations. It's not that my system doesn't have libjpg or whatever, but more I don't want have to depend on that version when distributing binaries.
Since you're building for yourself, it doesn't matter if it's static or dynamic wxWdigets, but then that copy of LisaEm can't be moved to another system that has a different setup.
In your case, I think the issue is that wxWidget's configure decided to pick up a specific libiconv that LisaEm's build script did not see or have in it's library path, causing the issue, or somehow wx-config did not pass the appropriate -L -l flags which then build.sh passed to gcc/ld. Possibly because port inserts its own paths first, etc., and I'm sure brew does things like that too.
You can fix this by forcing wxWidgets to use a specific iconv like so by changing the script/build-wx3.1.2-modern-macos.sh to pass these:
../configure --help | grep -i iconv
--with-libiconv use libiconv (character conversion)
--with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib
And hopefully wx-config --libs might then give the right libs and fix the issue.
I can add those in the next push/rc, but I'll first have to ensure they work on all systems - or insert logic to detect which to use, which is painful.
There's some discussion here:
https://wiki.wxwidgets.org/Distributing_WxWidgets_Applications-Distributing_WxMac_Programs - (but this is from a very old wxWidgets version in that discussion as unicode is now mandated in wx3.x, but he runs into the same kind of issues.)