This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

a gettext patch for static linking


Here is a patch to permit static linking of programs with included
gettext in a glibc system. The problem that occurs is that both the
libintl.a versions of the functions (dcigettext__ etc.) and the libc
versions (__dcigettext etc.) define these variables, and static
linking drags in both.

gcc -static -g -O2 -o xgettext message.o open-po.o po-gram-gen.o po-hash-gen.o po-lex.o po.o str-list.o xget-lex.o xgettext.o dir-list.o ../lib/libnlsut.a ../intl/libintl.a
/usr/lib/libc.a(dcgettext.o): In function `__dcgettext':
/usr/src/packages/BUILD/glibc-2.1/intl/dcgettext.c:264: multiple definition of `_nl_default_default_domain'
../intl/libintl.a(dcigettext.o):/home/haible/gettext-cvs/gettext/build/intl/../../intl/dcigettext.c:232: first defined here
/usr/lib/libc.a(dcgettext.o): In function `__dcgettext':
/usr/src/packages/BUILD/glibc-2.1/intl/dcgettext.c:264: multiple definition of `_nl_current_default_domain'
../intl/libintl.a(dcigettext.o):/home/haible/gettext-cvs/gettext/build/intl/../../intl/dcigettext.c:232: first defined here
/usr/lib/libc.a(dcgettext.o): In function `__dcgettext':
/usr/src/packages/BUILD/glibc-2.1/intl/dcgettext.c:264: multiple definition of `_nl_default_dirname'
../intl/libintl.a(dcigettext.o):/home/haible/gettext-cvs/gettext/build/intl/../../intl/dcigettext.c:232: first defined here
/usr/i486-suse-linux/bin/ld: Warning: size of symbol `_nl_default_dirname' changed from 24 to 18 in dcgettext.o
collect2: ld returned 1 exit status

The patch removes _nl_default_dirname and _nl_domain_bindings from Versions;
_nl_domain_bindings must be removed anyway because `struct binding' has
changed since glibc-2.1. I don't think any programs use these variables
directly; the standalone libintl certainly doesn't, otherwise we wouldn't
see the error messages above.

The patch also adds bind_textdomain_codeset to Versions; it had been
forgotten when bind_textdomain_codeset was implemented.


2000-09-14  Bruno Haible  <haible@clisp.cons.org>

	* intl/dcigettext.c: In libc, use local variable names starting
	with __nl_, not _nl_.
	* intl/bindtextdom.c: Likewise.
	* intl/textdomain.c: Likewise.
	* intl/Versions: Remove _nl_default_dirname, _nl_domain_bindings.

	* intl/Versions: Add bind_textdomain_codeset.

*** intl/dcigettext.c.bak	Fri Sep  1 22:16:59 2000
--- intl/dcigettext.c	Thu Sep 14 20:39:28 2000
***************
*** 119,124 ****
--- 119,134 ----
      ((int) &((struct { char dummy1; TYPE dummy2; } *) 0)->dummy2)
  #endif
  
+ /* The internal variables in GNU libc must have different names than
+    the internal variables in the standalone libintl.a, otherwise
+    programs using libintl.a cannot be linked statically.  */
+ #ifdef _LIBC
+ # define _nl_default_default_domain __nl_default_default_domain
+ # define _nl_current_default_domain __nl_current_default_domain
+ # define _nl_default_dirname __nl_default_dirname
+ # define _nl_domain_bindings __nl_domain_bindings
+ #endif
+ 
  /* @@ end of prolog @@ */
  
  #ifdef _LIBC
*** intl/bindtextdom.c.bak	Wed May 10 15:14:35 2000
--- intl/bindtextdom.c	Thu Sep 14 20:39:12 2000
***************
*** 57,62 ****
--- 57,70 ----
  # define __libc_rwlock_unlock(NAME)
  #endif
  
+ /* The internal variables in GNU libc must have different names than
+    the internal variables in the standalone libintl.a, otherwise
+    programs using libintl.a cannot be linked statically.  */
+ #ifdef _LIBC
+ # define _nl_default_dirname __nl_default_dirname
+ # define _nl_domain_bindings __nl_domain_bindings
+ #endif
+ 
  /* @@ end of prolog @@ */
  
  /* Contains the default location of the message catalogs.  */
*** intl/textdomain.c.bak	Fri Apr 28 12:38:31 2000
--- intl/textdomain.c	Thu Sep 14 20:34:08 2000
***************
*** 51,56 ****
--- 51,64 ----
  # define __libc_rwlock_unlock(NAME)
  #endif
  
+ /* The internal variables in GNU libc must have different names than
+    the internal variables in the standalone libintl.a, otherwise
+    programs using libintl.a cannot be linked statically.  */
+ #ifdef _LIBC
+ # define _nl_default_default_domain __nl_default_default_domain
+ # define _nl_current_default_domain __nl_current_default_domain
+ #endif
+ 
  /* @@ end of prolog @@ */
  
  /* Name of the default text domain.  */
*** intl/Versions.bak	Mon Jan 24 14:24:26 2000
--- intl/Versions	Thu Sep 14 21:11:46 2000
***************
*** 1,7 ****
  libc {
    GLIBC_2.0 {
      # global variables
!     _nl_msg_cat_cntr; _nl_default_dirname; _nl_domain_bindings;
  
      # functions used in inline functions or macros
      __dcgettext;
--- 1,7 ----
  libc {
    GLIBC_2.0 {
      # global variables
!     _nl_msg_cat_cntr;
  
      # functions used in inline functions or macros
      __dcgettext;
***************
*** 21,26 ****
--- 21,29 ----
    GLIBC_2.2 {
      # functions used in inline functions or macros
      __dcngettext;
+ 
+     # b*
+     bind_textdomain_codeset;
  
      # d*
      dcngettext; dngettext;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]