views:

51

answers:

1
+2  Q: 

missing locale_t

Installing gtk 1.2 (package name gtk1) with macports chokes on the final make, in libintl.h line 440.

extern locale_t libintl_newlocale (junk, stuff, stuff)

The compiler can't find locale_t, and I'm not doing any better.

The file imports locale.h, which doesn't exist, and xlocale.h, which doesn't define this type.

Where should locale_t be defined? This might be as easy as a missed dependency, but I don't know what is missing.

By request, here is xlocale.h, minus the copyright, which is the Open Group's.

#include <X11/Xfuncproto.h>
#include <X11/Xosdefs.h>

#ifndef X_LOCALE
#include <locale.h>
#else

#define LC_ALL      0
#define LC_COLLATE  1
#define LC_CTYPE    2
#define LC_MONETARY 3
#define LC_NUMERIC  4
#define LC_TIME     5

_XFUNCPROTOBEGIN
    extern char *_Xsetlocale(
    int /* category */,
    _Xconst char* /* name */
);
_XFUNCPROTOEND

#define setlocale _Xsetlocale

#include <stddef.h>

#endif /* X_LOCALE */
+1  A: 

If you don't need messages translated to languages other than English, you can find various dummy versions of libintl which serve as drop-in replacements. If I remember correctly, uclibc includes one. You could also just add typedef void *locale_t; somewhere and work around the bug.

..and this is a bug. locale_t was not added to POSIX until POSIX 2008, which is a good bit newer than libgtk1.2; until then, it was a GNU extension. And in any case, since it's a very new and not-widely-supported feature, configure should be testing for it and only using it if it's present.

R..
I actually solved this problem by using uninstalling gtk2, which I can only assume cleaned my include directory of some nonsense. I'll give you the credit for this question because you clued me in to this being a gtk time warp bug.On a related note, I feel way dumber now.
Jared Garst