Re: [code] Small quirk in Makefile for FreeBSD

From: Wolfgang Jenkner <wjenkner.att.inode.at>
Date: Sat, 26 Mar 2016 15:57:11 +0100

On Thu, Mar 24 2016, Mitchell wrote:

> On Sat, 27 Feb 2016, Martin \"eto\" Misuth wrote:
>
>>
>> As far as I know iconv is part of FreeBSD base some time now - that means no
>> package provides it (unless it's some port add-on override) and all
>> applications should use system version.

Yes, but glib-2.0 is linked to libiconv on FreeBSD, please see

https://svnweb.freebsd.org/ports?view=revision&revision=344586

$ ldd /usr/local/lib/libglib-2.0.so
/usr/local/lib/libglib-2.0.so:
        libiconv.so.2 => /usr/local/lib/libiconv.so.2 (0x800ed4000)
        libpcre.so.1 => /usr/local/lib/libpcre.so.1 (0x8011ce000)
        libintl.so.8 => /usr/local/lib/libintl.so.8 (0x801444000)
        libthr.so.3 => /lib/libthr.so.3 (0x80164f000)
        libc.so.7 => /lib/libc.so.7 (0x800821000)

> Sorry for the delay, but I had some time to look into this this
> morning. I think the reason why iconv isn't explicitly linked on GTK
> on *BSD is because I'm expecting `pkg-config --libs gtk+-2.0` to
> include `-liconv` in its output. I presume on your machine the above
> command does not output `-liconv` somewhere?

No, -liconv is only part of Libs.private in glib-2.0.pc, cf.

https://git.gnome.org/browse/glib/tree/glib-2.0.pc.in

IIUC, compiling textadept.c correctly includes iconv.h from libiconv
(because the compilation flags include -I/usr/local/include somewhere),
which, among other things, contains

#define iconv_open libiconv_open

but the problem is that the latter symbol isn't re-exported from glib

$ nm /usr/local/lib/libglib-2.0.so | grep iconv
0000000000030000 T g_convert_with_iconv
000000000002ffe0 T g_iconv
000000000002fff0 T g_iconv_close
000000000002fe90 T g_iconv_open
                 U libiconv
                 U libiconv_close
                 U libiconv_open

hence the error message from the linker

/usr/bin/ld: undefined reference to symbol `libiconv_open' (try adding -liconv)

Wolfgang

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Sat 26 Mar 2016 - 10:57:11 EDT

This archive was generated by hypermail 2.2.0 : Sun 27 Mar 2016 - 06:43:08 EDT