[Mono-dev] undefined reference to `libiconv'

Jeffrey Stedfast fejj at novell.com
Wed Apr 27 07:34:39 EDT 2011


On 04/26/2011 10:54 PM, Makoto KISHIMOTO wrote:
> Hello,
>
> In my FreeBSD Box, mono trunk build failed.
> The following is build log.
>
> $ gmake
> gmake  all-recursive
> gmake[1]: Entering directory `/export/home/ksmakoto/Mono/BUILD'
>
> (snip)
>
> gmake[2]: Leaving directory `/export/home/ksmakoto/Mono/BUILD/libgc'
> Making all in eglib
> gmake[2]: Entering directory `/export/home/ksmakoto/Mono/BUILD/eglib'
> gmake  all-recursive
> gmake[3]: Entering directory `/export/home/ksmakoto/Mono/BUILD/eglib'
> Making all in m4
> gmake[4]: Entering directory `/export/home/ksmakoto/Mono/BUILD/eglib/m4'
> gmake[4]: Nothing to be done for `all'.
> gmake[4]: Leaving directory `/export/home/ksmakoto/Mono/BUILD/eglib/m4'
> Making all in src
> gmake[4]: Entering directory `/export/home/ksmakoto/Mono/BUILD/eglib/src'
> gmake[4]: Nothing to be done for `all'.
> gmake[4]: Leaving directory `/export/home/ksmakoto/Mono/BUILD/eglib/src'
> Making all in test
> gmake[4]: Entering directory `/export/home/ksmakoto/Mono/BUILD/eglib/test'
> ./doltlibtool --tag=CC   --mode=link gcc -Wall -D_FORTIFY_SOURCE=2 -I../../../mono/eglib/test/../src -I../src -DDRIVER_NAME=\"EGlib\" -g -O2 -g -D_GNU_SOURCE  -Wl,-export-dynamic -o test-eglib test_eglib-test.o test_eglib-driver.o test_eglib-hashtable.o test_eglib-string-util.o test_eglib-string.o test_eglib-slist.o test_eglib-sizes.o test_eglib-ptrarray.o test_eglib-list.o test_eglib-array.o test_eglib-fake.o test_eglib-path.o test_eglib-queue.o test_eglib-shell.o test_eglib-spawn.o test_eglib-timer.o test_eglib-file.o test_eglib-pattern.o test_eglib-dir.o test_eglib-markup.o test_eglib-unicode.o test_eglib-utf8.o test_eglib-endian.o test_eglib-module.o test_eglib-memory.o ../src/libeglib.la -lm
> libtool: link: gcc -Wall -D_FORTIFY_SOURCE=2 -I../../../mono/eglib/test/../src -I../src -DDRIVER_NAME=\"EGlib\" -g -O2 -g -D_GNU_SOURCE -Wl,-export-dynamic -o test-eglib test_eglib-test.o test_eglib-driver.o test_eglib-hashtable.o test_eglib-string-util.o test_eglib-string.o test_eglib-slist.o test_eglib-sizes.o test_eglib-ptrarray.o test_eglib-list.o test_eglib-array.o test_eglib-fake.o test_eglib-path.o test_eglib-queue.o test_eglib-shell.o test_eglib-spawn.o test_eglib-timer.o test_eglib-file.o test_eglib-pattern.o test_eglib-dir.o test_eglib-markup.o test_eglib-unicode.o test_eglib-utf8.o test_eglib-endian.o test_eglib-module.o test_eglib-memory.o  ../src/.libs/libeglib.a -lm
> ./src/.libs/libeglib.a(libeglib_la-gunicode.o)(.text+0x5b6): In function `monoeg_g_get_charset':
> ./../../mono/eglib/src/gunicode.c:362: undefined reference to `locale_charset'

Looks like configure detected that your system had localcharset.h which 
should have prototyped a function called locale_charset() which we use 
to get the user's locale charset.

You might be able to fix this by commenting out the #define 
HAVE_LOCALCHARSET_H in config.h

Alternatively, it looks like it might be a part of libiconv (solution 
below).

> ./src/.libs/libeglib.a(libeglib_la-giconv.o)(.text+0x4c): In function `monoeg_g_iconv':
> ./../../mono/eglib/src/giconv.c:177: undefined reference to `libiconv'
> ./src/.libs/libeglib.a(libeglib_la-giconv.o)(.text+0x18f): In function `monoeg_g_iconv_close':
> ./../../mono/eglib/src/giconv.c:158: undefined reference to `libiconv_close'
> ./src/.libs/libeglib.a(libeglib_la-giconv.o)(.text+0x8c6): In function `monoeg_g_iconv_open':
> ./../../mono/eglib/src/giconv.c:132: undefined reference to `libiconv_open'

These errors suggest that configure detected that you had libiconv 
installed, so it tried to use it but apparently thought it was part of 
your libc because I do not see a -liconv in the link line.

I fixed an issue similar to this yesterday, maybe your version of mono 
from git is older than my fix (commit = 
1deef5a760b37cf1e42a60110981d0f752d84d9d ). You can either try updating 
from git or add $(LIBICONV) right after each ($GLIB_LIBS) in the 
Makefile.am files and then rebuild.

Hope that helps,

Jeff



More information about the Mono-devel-list mailing list