缺少 locale_t

发布于 2024-09-08 13:56:12 字数 815 浏览 2 评论 0 原文

在 libintl.h 第 440 行中,使用 macports 安装 gtk 1.2(软件包名称 gtk1)会在最终 make 中阻塞。

extern locale_t libintl_newlocale (junk, stuff, stuff)

编译器找不到 locale_t,而且我也没有做得更好。

该文件导入不存在的 locale.h 和未定义此类型的 xlocale.h。

locale_t 应该在哪里定义?这可能就像缺少依赖项一样简单,但我不知道缺少什么。

根据要求,这里是 xlocale.h,减去版权,这是 Open Group 的。

#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 */

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 */

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

揪着可爱 2024-09-15 13:56:12

如果您不需要将消息翻译成英语以外的语言,您可以找到 libintl 的各种虚拟版本,它们可以作为直接替代品。如果我没记错的话,uclibc 包含一个。您还可以在某处添加 typedef void *locale_t; 并解决该错误。

..这是一个错误locale_t 直到 POSIX 2008 才添加到 POSIX,它比 libgtk1.2 更新了很多;在那之前,它只是一个 GNU 扩展。无论如何,由于它是一个非常新且未得到广泛支持的功能,因此配置应该对其进行测试,并且仅在存在时才使用它。

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.

孤单情人 2024-09-15 13:56:12

我在 Mac OS X 上遇到了同样的问题。这是由 使用 _XLOCALE_H_< 引起的/code> 作为包含守卫。如果某物同时包含两者,则实际上只包含其中之一。为了解决该问题,我编辑了 /usr/include/X11/Xlocale.h 并将包含保护更改为 _X11_XLOCALE_H_

此问题已已在上游修复,但尚未修复降到Mac OS X。

I had this same problem on Mac OS X. It was caused by both <xlocale.h> and <X11/Xlocale.h> using _XLOCALE_H_ as the include guard. If something included both, only one of them actually got included. To fix the problem, I edited /usr/include/X11/Xlocale.h and changed the include guard to _X11_XLOCALE_H_.

This problem was fixed upstream but the fix hasn't yet made it down to Mac OS X.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文