no such file to load -- iconv

After upgrading from Ruby 1.8.7 patch-level 174 to patch-level 249, I noticed I couldn't run Rails anymore. After some investigating, I found out it was the iconv library (used for text conversions). Ruby apparently couldn't locate it (require 'iconv' failed). I was stumped, since it never had had this problem before.

The solution was to simply give the configuration script the location to my iconv installation (please note I'm running OS X Snow Leopard).

./configure --enable-shared --enable-pthread CFLAGS=-D_XOPEN_SOURCE=1 --with-iconv-dir="/usr/local"

Make sure to provide the correct path to your iconv installation. After compiling, require 'iconv' returned true. Huzzah!

Filed in Web.