if 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 -MT SocketCore.o -MD -MP -MF ".deps/SocketCore.Tpo" -c -o SocketCore.o SocketCore.cc; \ then mv -f ".deps/SocketCore.Tpo" ".deps/SocketCore.Po"; else rm -f ".deps/SocketCore.Tpo"; exit 1; fi if 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 -MT Command.o -MD -MP -MF ".deps/Command.Tpo" -c -o Command.o Command.cc; \ then mv -f ".deps/Command.Tpo" ".deps/Command.Po"; else rm -f ".deps/Command.Tpo"; exit 1; fi if 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 -MT AbstractCommand.o -MD -MP -MF ".deps/AbstractCommand.Tpo" -c -o AbstractCommand.o AbstractCommand.cc; \ then mv -f ".deps/AbstractCommand.Tpo" ".deps/AbstractCommand.Po"; else rm -f ".deps/AbstractCommand.Tpo"; exit 1; fi In file included from /usr/include/libintl.h:8, from /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.3/include/g++-v4/x86_64-pc-linux-gnu/bits/c++locale.h:52, from /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.3/include/g++-v4/iosfwd:45, from /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.3/include/g++-v4/bits/stl_algobase.h:70, from /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.3/include/g++-v4/deque:66, from Command.h:39, from Command.cc:35: /usr/include/gentoo-multilib/amd64/libintl.h:40: error: expected unqualified-id before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:40: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:40: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:40: error: expected initializer before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:45: error: expected unqualified-id before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:45: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:45: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:45: error: expected initializer before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:52: error: expected unqualified-id before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:52: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:52: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:52: error: expected initializer before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:62: error: expected unqualified-id before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:62: error: expected `)' before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:62: error: expected `)' before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:62: error: expected initializer before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:68: error: expected unqualified-id before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:68: error: expected `)' before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:68: error: expected `)' before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:68: error: expected initializer before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:74: error: expected unqualified-id before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:74: error: expected `)' before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:74: error: expected `)' before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:74: error: expected initializer before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:83: error: expected unqualified-id before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:83: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:83: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:83: error: expected initializer before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:87: error: expected unqualified-id before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:87: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:87: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:87: error: expected initializer before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:92: error: expected unqualified-id before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:92: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:92: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:92: error: expected initializer before 'const' make[2]: *** [Command.o] Error 1 make[2]: *** Waiting for unfinished jobs.... In file included from /usr/include/libintl.h:8, from /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.3/include/g++-v4/x86_64-pc-linux-gnu/bits/c++locale.h:52, from /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.3/include/g++-v4/iosfwd:45, from /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.3/include/g++-v4/bits/stl_algobase.h:70, from /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.3/include/g++-v4/deque:66, from Command.h:39, from AbstractCommand.h:38, from AbstractCommand.cc:35: /usr/include/gentoo-multilib/amd64/libintl.h:40: error: expected unqualified-id before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:40: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:40: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:40: error: expected initializer before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:45: error: expected unqualified-id before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:45: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:45: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:45: error: expected initializer before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:52: error: expected unqualified-id before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:52: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:52: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:52: error: expected initializer before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:62: error: expected unqualified-id before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:62: error: expected `)' before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:62: error: expected `)' before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:62: error: expected initializer before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:68: error: expected unqualified-id before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:68: error: expected `)' before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:68: error: expected `)' before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:68: error: expected initializer before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:74: error: expected unqualified-id before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:74: error: expected `)' before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:74: error: expected `)' before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:74: error: expected initializer before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:83: error: expected unqualified-id before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:83: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:83: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:83: error: expected initializer before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:87: error: expected unqualified-id before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:87: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:87: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:87: error: expected initializer before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:92: error: expected unqualified-id before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:92: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:92: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:92: error: expected initializer before 'const' In file included from /usr/include/libintl.h:8, from /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.3/include/g++-v4/x86_64-pc-linux-gnu/bits/c++locale.h:52, from /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.3/include/g++-v4/iosfwd:45, from /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.3/include/g++-v4/bits/stl_algobase.h:70, from /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.3/include/g++-v4/bits/char_traits.h:46, from /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.3/include/g++-v4/string:47, from SocketCore.h:40, from SocketCore.cc:35: /usr/include/gentoo-multilib/amd64/libintl.h:40: error: expected unqualified-id before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:40: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:40: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:40: error: expected initializer before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:45: error: expected unqualified-id before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:45: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:45: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:45: error: expected initializer before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:52: error: expected unqualified-id before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:52: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:52: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:52: error: expected initializer before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:62: error: expected unqualified-id before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:62: error: expected `)' before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:62: error: expected `)' before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:62: error: expected initializer before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:68: error: expected unqualified-id before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:68: error: expected `)' before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:68: error: expected `)' before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:68: error: expected initializer before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:74: error: expected unqualified-id before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:74: error: expected `)' before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:74: error: expected `)' before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:74: error: expected initializer before 'unsigned' /usr/include/gentoo-multilib/amd64/libintl.h:83: error: expected unqualified-id before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:83: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:83: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:83: error: expected initializer before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:87: error: expected unqualified-id before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:87: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:87: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:87: error: expected initializer before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:92: error: expected unqualified-id before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:92: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:92: error: expected `)' before 'const' /usr/include/gentoo-multilib/amd64/libintl.h:92: error: expected initializer before 'const' make[2]: *** [SocketCore.o] Error 1 make[2]: *** [AbstractCommand.o] Error 1 make[2]: Leaving directory `/20GB/var/tmp/paludis/net-misc/aria2-0.13.0/work/aria2c-0.13.0/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/20GB/var/tmp/paludis/net-misc/aria2-0.13.0/work/aria2c-0.13.0' make: *** [all] Error 2 here's emerge --info ---------------- Portage 2.2_pre3 (default-linux/amd64/dev/2008.0, gcc-4.2.3, glibc-2.7-r1, 2.6.24-gentoo-r3 x86_64) ================================================================= System uname: 2.6.24-gentoo-r3 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 4200+ Timestamp of tree: Tue, 04 Mar 2008 21:00:01 +0000 app-shells/bash: 3.2_p33 dev-java/java-config: 1.3.7, 2.1.5 dev-lang/python: 2.5.1-r5 sys-apps/baselayout: 2.0.0_rc6-r1 sys-apps/sandbox: 1.2.18.1-r2 sys-devel/autoconf: 2.13, 2.61-r1 sys-devel/automake: 1.4_p6, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.1 sys-devel/binutils: 2.18.50.0.4 sys-devel/gcc-config: 1.4.0-r4 sys-devel/libtool: 1.5.26 virtual/os-headers: 2.6.24 ACCEPT_KEYWORDS="amd64 ~amd64" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O2 -march=k8 -pipe -msse3" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config" CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/udev/rules.d" CXXFLAGS="-O2 -march=k8 -pipe -msse3" DISTDIR="/media/reiser/distfiles" FEATURES="distlocks metadata-transfer parallel-fetch preserve-libs sandbox sfperms strict unmerge-orphans userfetch" GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo" LANG="cs_CZ.UTF-8" LC_ALL="cs_CZ.UTF-8" LINGUAS="cs" MAKEOPTS="-j3" PKGDIR="/20GB/portage/packages" PORTAGE_RSYNC_EXTRA_OPTS="--exclude-from=/etc/portage/rsync_excludes --progress --prune-empty-dirs" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/20GB/var/tmp" PORTDIR="/20GB/portage" PORTDIR_OVERLAY="/20GB/overlay /usr/local/portage/dave /usr/local/portage/desktop-effects" SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage" USE="3dnow 3dnowext X a52 alsa amd64 apache2 asf avi branding bzip2 cdparanoia cdr cli css curl curlwrappers custom-cflags cxx dbus dga dts dvd dvdnav dvdr dvdread enca encode ffmpeg flash ftp gd gpm hal iconv id3 id3v2 ithreads jabber javascript jpeg kde kdeenablefinal kdehiddenvisibility lame mad matroska mmx mmxext mp3 mpeg mplayer ncurses no-old-linux nptl nptlonly nsplugin nvidia ogg oggvorbis openal opengl pcre pic png posix pppd print qt qt3 qt3support qt4 quicktime rar reflection session smp sockets spl srt sse sse2 sse3 ssl subversion symlink threads truetype unicode usb vorbis wma x264 xine xorg xv xvid zlib" ALSA_CARDS="emu10k1" ALSA_PCM_PLUGINS="asym empty file null plug" APACHE2_MODULES="alias authz_host cache dir disk_cache include log_config mime mime_magic rewrite setenvif" APACHE2_MPMS="event" ELIBC="glibc" INPUT_DEVICES="mouse keyboard" KERNEL="linux" LINGUAS="cs" USERLAND="GNU" VIDEO_CARDS="nvidia" Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS
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