FreeBSD and WITH_ICONV

I’ve put WITH_ICONV=yes in my /etc/src.conf file on a few VMs running stable/9, and yes, I got burned. My beloved server named enterprise running stable/9 was also affected. :-/

By enabling WITH_ICONV, certain iconv related functions will be compiled and placed in libc. This didn’t shown any ill side effects until early August when updating ports such as devel/glib and devel/bzr failed with complaints such as:

msgfmt -o po/da.mo po/da.po
po/da.po:66:7: invalid multibyte sequence

At first it would seem msgfmt is less forgiving or downright confused when linked with an iconv enabled libc. Not to worry, a dermal regenerator is available.

Solution

Remove

WITH_ICONV=yes
WITH_LIBICONV_COMPAT=yes

from both /etc/make.conf and /etc/src.conf.

Update your source tree, recompile world and kernel, install the new world and kernel, remove /usr/include/iconv.h as it will not be removed by make delete-old, update your ports tree, and reinstall all ports depending on devel/gettext and converters/libiconv.