After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 70627 - AM_GLIB_GNU_GETTEXT / older libc problem
AM_GLIB_GNU_GETTEXT / older libc problem
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
2.0.x
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
: 69965 70480 72034 73413 (view as bug list)
Depends on:
Blocks: 85217
 
 
Reported: 2002-02-05 20:15 UTC by jon.hellan
Modified: 2011-02-18 15:55 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description jon.hellan 2002-02-05 20:15:52 UTC
On systems with an old libc or non gnu libc, libc does not provide all the
library functions needed by gnome2 applications.

The solution is to install a sufficiently new gettext, and link to its
library (libintl?). However , AM_GLIB_GNU_GETTEXT does not support this. 

I use Red Hat Linux 6.2, which comes with an old gettext. I build the
gnome2 version of gnumeric, which calls bind_textdomain_codeset. I've built
a gettext 0.10.40 rpm from source, tweaking the spec file to build
libintl.so, and installed it.

gnumeric builds if I manually add '-lintl' to the link line. But when I
autogen.sh using AM_GLIB_GNU_GETTEXT in configure.in, '-lintl' is omitted,
and the build fails.

Solaris users have experienced the same problem.

The problem seems to be that when the AM_GLIB_GNU_GETTEXT macro finds
bindtextdomain in libc, it falsely concludes that all is well. It should
also test for bind_textdomain_codeset, and try linking with libintl if 
that fails with libc.

Variations are possible, e.g. a parameter to tell whether
bind_textdomain_codeset is needed, or two versions of the macro.
Comment 1 Owen Taylor 2002-02-05 20:25:12 UTC
I would suggest that gnumeric should use UTF-8 .po files and
not require bind_textdomain_codeset().(Though you need to
call it if it is present.)  This is what GTK+ does.

I suspect that linking to a libintl when libc has gettext() as 
well will have some unpredictable side effects and wouldn't 
recommend it.

(If you really disagree, reopen and I'll put adding an option
to the macro on the future milestone as a feature request. We
aren't going to get to it for 2.0.09 in any case.)
Comment 2 Owen Taylor 2002-02-20 17:59:55 UTC
*** Bug 72034 has been marked as a duplicate of this bug. ***
Comment 3 Owen Taylor 2002-03-01 17:19:23 UTC
*** Bug 70480 has been marked as a duplicate of this bug. ***
Comment 4 Frederic.Devernay 2002-03-04 09:27:56 UTC
*** Bug 69965 has been marked as a duplicate of this bug. ***
Comment 5 Owen Taylor 2002-03-04 20:04:44 UTC
*** Bug 73413 has been marked as a duplicate of this bug. ***
Comment 6 jacob berkman 2002-03-04 20:57:18 UTC
laszlo, which gettext are you doing builds with?
Comment 7 Morten Welinder 2002-05-14 14:55:16 UTC
Reopening, marking gnome2, all OSs.

Owen, this problem is real and spreading.  Please don't just WONTFIX
because your Linux box does not show it.

Currently, gnome-vfs and gnome-print and everything using that will
not link on Solaris without hacking in the form of Makefile-editing
or LDFLAGS tricks.

Can we have something like
AC_CHECK_FUNC(bind_textdomain_codeset,,[AC_CHECK_LIB(intl,bind_textdomain_codeset)])

please?
Comment 8 Owen Taylor 2002-05-14 18:09:07 UTC
It's not WONTFIX'ed because it doesn't happen on Linux, it's
WONTFIX'ed because the GLib and GTK+ solution to UTF-8
translations doesn't require bind_textdomain_codeset().

Comment 9 Morten Welinder 2002-05-14 19:22:26 UTC
Like I said, it's spreading.  On Solaris you will not even get to try
to compile gnumeric any more.  Things will fail in gnome-vfs or
gnome-print.  See bug 78434 and bug 80577.

Note, that when you go ahead and add -lintl to (say) gnome-vfs, then
the final program will have bind_textdomain_codeset, but glib will not
call it.  If I read your 2002-02-05 15:25 comment right, then
that is not desireable.

So what is wrong with actually looking for bind_textdomain_codeset in
-lintl?  This is what I do and this is what sander and gman do.

> I suspect that linking to a libintl when libc has gettext() as 
> well will have some unpredictable side effects and wouldn't 
> recommend it.

I don't understand this fear.  If it was well founded, -lintl could
never be used on Solaris.  Yet it seems to work just fine for lots
of people.  It's not quite the same scale as overriding malloc
and other fancy things people do regularly.
Comment 10 jacob berkman 2002-05-14 20:19:59 UTC
it's not just gman and sander, it's the builds sun (and ximian) are
using to test gnome 2 on solaris, and will probably be what sun will ship.
Comment 11 Hidetoshi Tajima 2002-08-13 08:32:28 UTC
bind_textdomain_codeset (domain_name, "UTF-8") is needed even when .po
 and .mo file for the locale are encoded in 
UTF-8.

From http://www.gnu.org/manual/glibc-2.2.3/html_node/libc_126.html,

"The output character set (gettext returns) is, by default, the value
of nl_langinfo (CODESET):.."

"programs which store strings in a locale independent way (e.g. UTF-8)
can request that gettext and related functions return the translations
in that encoding, by use of the bind_textdomain_codeset function. "

So, I think calling bind_textdomain_codeset(domainname, "UTF-8") is
needed in all GNOME2 modules, including glib abd gtk+, in order to
keep gettext from doing unexpected code conversion from UTF-8 to the
locale text, but always
returns "UTF-8".


 
Comment 12 Owen Taylor 2002-12-11 19:46:57 UTC
Testing much appreciated:

Wed Dec 11 14:28:50 2002  Owen Taylor  <otaylor@redhat.com>

        * m4macros/glib-gettext.m4: Major rewrite; remove leftovers
        from building intl/, prefer libintl if both libc and libintl
        have dgettext and libintl also has bind_textdomain_codeset().
        (#70627)