git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: 1.7.9, libcharset missing from EXTLIBS

From
DPDilyan Palauzov <dilyan.palauzov@aegee.org>
Date
Feb 10, 2012, 19:52 UTC
Message-ID
<20120210205242.Horde.Ip6kLu3yGeFPNXWKXsdW3wA@webmail.aegee.org>
In-Reply-To
<7vipjer0yn.fsf@alter.siamese.dyndns.org>
Hello,

on my system locale_charset is included in libiconv as local symbol and thus linking with -liconv is not sufficient.

   nm /usr/lib64/libiconv.so.2.5.1 | grep locale
   0000000000012694 t locale_charset
whereas in libcharset the symbol is global:
   nm /usr/lib64/libcharset.so.1 |grep locale
   0000000000000c50 T locale_charset
looking at libiconv-1.4/lib/Makefile.in there is written

SOURCES = $(srcdir)/iconv.c $(srcdir)/../libcharset/lib/localcharset.c $(srcdir)/relocatable.c

OBJECTS = iconv.lo localcharset.lo relocatable.lo $(OBJECTS_EXP_@WOE32DLL@) $(OBJECTS_RES_@WOE32@)

libiconv.la : $(OBJECTS)
         $(LIBTOOL_LINK) $(CC) $(LDFLAGS) $(CFLAGS) -o libiconv.la  
-rpath $(libdir) -version-info $(LIBICONV_VERSION_INFO) -no-undefined  
$(OBJECTS)

this means, that libiconv.la includes $(OBJECTS) and thus libiconv-1.4/libcharset/lib/localecharset.c .

In libiconv-1.4/libcharset/lib/localecharset.c is written

#ifdef STATIC STATIC #endif const char * locale_charset (void) { ...}

and the preliminary localcharset.o still has locale_charset as global symbol:

libiconv-1.14/lib/.libs # nm localcharset.o |grep locale 0000000000000000 T locale_charset

Digging further, in libiconv-1.4/include/iconv.h some functions are prefixed with LIBICONV_DLL_EXPORTED , which is the same as #define LIBICONV_DLL_EXPORTED __attribute__((__visibility__("default"))) , all the rest including locale_charset is compiled with __attribute__((__visibility__("hidden"))), and hence locale_charset is not exported from libiconv.

Greetings
   Dilian
----- Message from Дилян Палаузов <dilyan.palauzov@aegee.org> ---------
    Date: Fri, 10 Feb 2012 02:29:24 +0100
    From: Дилян Палаузов <dilyan.palauzov@aegee.org>
Subject: 1.7.9, libcharset missing from EXTLIBS
      To: git@vger.kernel.org
Show 31 quoted lines
> Hello,
>
> git 1.7.9 makes use of libcharset and /Makefile contains:
>
> ifdef HAVE_LIBCHARSET_H
>         BASIC_CFLAGS += -DHAVE_LIBCHARSET_H
> endif
>
> when building git-daemon., the compiler reports
> make V=1
> cc  -I. -DUSE_LIBPCRE -pthread -DHAVE_PATHS_H -DHAVE_LIBCHARSET_H  
> -DHAVE_DEV_TTY -DSHA1_HEADER='<openssl/sha.h>'  -DNO_STRLCPY -o  
> git-daemon -L/usr/lib64 -L/lib64  daemon.o libgit.a xdiff/lib.a   
> -lpcre -lz  -liconv  -lcrypto -pthread
> /tmp/ccvPEthi.ltrans0.ltrans.o: In function `main':
> ccvPEthi.ltrans0.o:(.text.startup+0x59): undefined reference to  
> `locale_charset'
> collect2: ld returned 1 exit status
> make: *** [git-daemon] Error 1
>
>
> and the problem is, that libcharset is not used when linking.  To  
> solve this, please replace the above extract from /Makefile with
>
> ifdef HAVE_LIBCHARSET_H
>         BASIC_CFLAGS += -DHAVE_LIBCHARSET_H
> 	EXTLIBS += -lcharset
> endif
>
> Със здраве
>   Дилян
----- End message from Дилян Палаузов <dilyan.palauzov@aegee.org> -----
Previous: Junio C HamanoNext: Erik Faye-Lund
Message 6 of 13 in “1.7.9, libcharset missing from EXTLIBS”
  1. Дилян ПалаузовFeb 10, 2012
  2. Junio C HamanoFeb 10, 2012
  3. Ævar Arnfjörð BjarmasonFeb 10, 2012
  4. Дилян ПалаузовFeb 10, 2012
  5. Junio C HamanoFeb 10, 2012
  6. Dilyan PalauzovFeb 10, 2012
  7. Erik Faye-LundFeb 10, 2012
  8. Junio C HamanoFeb 10, 2012
  9. Дилян ПалаузовFeb 12, 2012
  10. Ævar Arnfjörð BjarmasonFeb 12, 2012
  11. Junio C HamanoFeb 12, 2012
  12. Re: 1.7.9, libcharset missing from EXTLIBSДилян Палаузов, Feb 12, 2012
  13. Jakub NarebskiFeb 10, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.