Summary: | net-misc/aria2-0.13.0 fails to compile | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | David Watzke <david> |
Component: | Current packages | Assignee: | Tiziano Müller (RETIRED) <dev-zero> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | joe, vapier |
Priority: | Lowest | ||
Version: | 2008.0 | ||
Hardware: | AMD64 | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: | Command.ii |
Description
David Watzke
2008-03-05 00:48:44 UTC
go into /20GB/var/tmp/paludis/net-misc/aria2-0.13.0/work/aria2c-0.13.0/src and run: x86_64-pc-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I. -I.. -Wall -I../lib -I../intl -I../intl -I/usr/local/include -I/usr/include/libxml2 '-DLOCALEDIR="/usr/share/locale"' -DHAVE_CONFIG_H -O2 -march=k8 -pipe -msse3 -E -dD -o Command.ii Command.cc then post the Command.ii file as an attachment Created attachment 145636 [details]
Command.ii
thanks, that illustrates the issue aria2 has local macro defines but then includes the headers that has the real prototypes and then everything falls apart in this case, lib/gettext.h does "#define gettext(...) ..." before pulling in libintl.h vapier: You're wrong. It either pulls in libintl.h or it defines gettext, but not both. But I can reproduce the problem when building with USE="-nls" hmm, when building aria2 without nls support, it defines gettext but libintl.h gets pulled in via the chain of headers: deque->stl_algobase->iosfwd->c++-locale.h->libintl.h which really sucks. vapier: what's the proper solution here? Such things should not happen, should they? i dont really care if you believe me. read the Command.ii posted by David. it clearly backs up my statement. local macros should be defined only after including all other headers. The point is that libintl.h is _not_ included by aria2 but by the C++ STL. To paste lib/gettext.h: *snip* if ENABLE_NLS /* Get declarations of GNU message catalog functions. */ # include <libintl.h> #else /* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which chokes if dcgettext is defined as a macro. So include it now, to make later inclusions of <locale.h> a NOP. We don't include <libintl.h> as well because people using "gettext.h" will not include <libintl.h>, and also including <libintl.h> would fail on SunOS 4, whereas <locale.h> is OK. */ #if defined(__sun) # include <locale.h> #endif /* Disabled NLS. The casts to 'const char *' serve the purpose of producing warnings for invalid uses of the value returned from these functions. On pre-ANSI systems without 'const', the config.h file is supposed to contain "#define const". */ # define gettext(Msgid) ((const char *) (Msgid)) # define dgettext(Domainname, Msgid) ((const char *) (Msgid)) # define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid)) # define ngettext(Msgid1, Msgid2, N) \ ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) # define dngettext(Domainname, Msgid1, Msgid2, N) \ ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) # define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) # define textdomain(Domainname) ((const char *) (Domainname)) # define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname)) # define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset)) #endif *snip* ... and grepping through the code reveals that all "#include <libintl.h>" are guarded by "#ifdef USE_NLS" (except if I missed one). I'd say that something like this: void gettext(const char*) {} // or // # define gettext(Msgid) ((const char *) (Msgid)) #include <deque> int main(int, char**) { return 0; } should compile, even if it's not nice code. But having libintl.h pulled in and polluting the global namespace is really bad. The gcc-implementation of the STL should put that stuff in a separate namespace instead. Using STLport instead of the GCC-implementation makes the snippet above compile perfectly, btw. which is irrelevant. system headers are free to include whatever they like. my statement still stands: do not declare macros until after all system includes. well, your argument may be true, but the solution to not declare macros until after all system includes isn't really practicable. Upstream solved the issue by not using the gettext macro directly, but doing something like this: "#define _(String) gettext(String)" if USE_NLS is defined. Anyway: solved in version bump 0.13.1 |