[GRASS-user] compilation problems with libiconv

Glynn Clements glynn at gclements.plus.com
Tue Jan 16 12:55:25 EST 2007


Frank Broniewski wrote:

> I am having some problems compiling grass 6.2.1. There seems to be some issue 
> with iconv on my ubuntu 6.06 system.

> /home/frank/download/grass/grass-6.2.1/dist.i686-pc-linux-gnu/lib/libgrass_driver.so: 
> undefined reference to `libiconv'
> collect2: ld gab 1 als Ende-Status zurück
> make[1]: *** 
> [/home/frank/download/grass/grass-6.2.1/dist.i686-pc-linux-gnu/etc/mon.list] 
> Fehler 1
> make[1]: Verlasse 
> Verzeichnis '/home/frank/download/grass/grass-6.2.1/display/d.mon/pgms'
> 
> iconv is installed in /usr/local/bin, /usr/local/lib and /usr/local/include.
> 
> Does anybody have a idea what the issue might be? Looking into google and the 
> newsgroups didn't bring anything useful for me so I considered writing this 
> email.

I strongly suspect that the problem is due to having two incompatible
iconv implementations on your system. Note that GNU libc has iconv
built in, so there shouldn't be any reason to have a separate iconv
implementation installed.

Depending upon the implementation, iconv_open(), iconv(), and
iconv_close() can be either functions or macros. If they are macros,
the actual functions will be called libiconv_open(), libiconv() and
libiconv_close(). If you end up using the headers from a version which
uses macros along with a library from a version which doesn't use
macros, you will get the above error. The implementation in GNU libc
doesn't use macros.

The configure script first checks for iconv() with no additional
libraries. It only checks for additional libraries and or libiconv()
if the first check fails. If you have GNU libc, the first check will
succeed, and no additional libraries will be requested (i.e. it won't
add -liconv when linking).

However, when compiling, the "#include <iconv.h>" will pick up the
version in /usr/local/include, which defines iconv() etc as macros
which call libiconv() etc, but as you aren't linking against libiconv,
those functions won't be found.

If you're determined to use a stand-alone libiconv, you will need to
manually edit the definition of ICONVLIB in include/Make/Platform.make
to:

	ICONVLIB            = -L/usr/local/lib -liconv

after running configure but before compiling.

But I recommend that you simply remove the separate libiconv
implementation from your system. It doesn't provide any functionality
beyond that already provided by GNU libc.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-user mailing list