Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tlug: Locale mess



>>>>> "Totoro" == Totoro  <riley@example.com> writes:

    Totoro> All of a sudden yesterday, my locale broke and now all I
    Totoro> get is this error from kterm:

    Totoro> kterm: error in loading shared libraries : undefined
    Totoro> symbol: _Xsetlocale

I see you got it fixed, but here's a partial explanation of what's
going on.

POSIX locales have been unimplemented on most systems for most locales 
until very recently.  I think Linux only got a working Japanese locale 
within the last few months, and then only for glibc systems.

This was obviously unacceptable to X11, which has had working foreign
language support since R4.  However, X did not want to be
incompatible, so in R5 (IIRC) X11 specified the POSIX locale model as
its locale model, and then proceeded to implement as much as it needed
ad hoc.  So X11 implementations can use either a libc locale
implementation or a libX11 locale implementation.  Furthermore, if a
satisfactory libc implementation is available, this can be selected
unconditionally when you do `make World' in the X11 source tree.  In
this case, the X libraries will delegate locale support to the libc
implementation unconditionally.

If you do not, and elect to support the X11 locale implementation,
then you can again decide when you build a program.  By including
<X11/Xlocale.h> you include some trickery which does

#define setlocale Xsetlocale

and declares it as a function.  Then that function calls _Xsetlocale,
which is conditionally compiled, based on a private X11 #define
X_LOCALE, to call either libc's setlocale or the private X code that
implements X11-style locales.  (Remember that the compiler prepends a
"_" so the loader complains about _Xsetlocale and __Xsetlocale).  The
reason for this extra level of indirection is so that source code need
not worry about whether it is calling libc or libX11 routines.

This is the hook that muriyari Netscape uses to implement Japanese
input etc on Linux, at least until recently.

I seem to recall that one version or another of XFree86 took the
unconditional-delegate-to-libc route.  So you might have got such a
library, in which case a program built to use Xsetlocale mightn't
work.  I'm not really sure why, though, I thought the whole point of
the trickery was to avoid this outcome.

-- 
University of Tsukuba                Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Institute of Policy and Planning Sciences        Tel/fax: +1 (298) 53-5091
---------------------------------------------------------------
Next Nomikai: 20 November, 19:30 Tengu TokyoEkiMae 03-3275-3691
Next Meeting: 12 December, 12:30 Tokyo Station Yaesu central gate
---------------------------------------------------------------
Sponsor: PHT, makers of TurboLinux http://www.pht.co.jp


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links