Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 395151 - net-firewall/fwbuilder-5.0.1 build fails in fwbuilder/uint128.h due to undefined PRIX64 due to __STDC_FORMAT_MACROS being defined after inttypes.h is included
Summary: net-firewall/fwbuilder-5.0.1 build fails in fwbuilder/uint128.h due to undefi...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Joshua Kinard
URL: https://sourceforge.net/tracker/?func...
Whiteboard:
Keywords:
: 403257 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-12-18 14:10 UTC by Juergen Rose
Modified: 2012-05-04 22:11 UTC (History)
12 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,22.65 KB, text/plain)
2011-12-18 14:20 UTC, Juergen Rose
Details
patch uint128h (uint128.patch,383 bytes, patch)
2011-12-19 18:24 UTC, johannis
Details | Diff
autoheader log (autoheader.out,728 bytes, text/plain)
2011-12-20 14:23 UTC, Dario Sarango
Details
Address.i, gzipped (Address.i.gz,223.27 KB, text/plain)
2011-12-31 09:37 UTC, Markus Wernig
Details
/var/tmp/portage/net-firewall/fwbuilder-5.0.1.3592/temp/automake.out (automake.out,571 bytes, text/plain)
2012-01-11 13:35 UTC, Juergen Rose
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Juergen Rose 2011-12-18 14:10:21 UTC
'emerge fwbuilder' fails with:
...
make[3]: Leaving directory `/var/tmp/portage/net-firewall/fwbuilder-5.0.0.3568/work/fwbuilder-5.0.0.3568/src/libfwbuilder/migration'
g++ -c -pipe -Wno-unused-parameter -march=native -O2 -pipe -fPIC -Wall -W  -I/usr/share/qt4/mkspecs/linux-g++ -I. -I.. -I../.. -I/usr/include -I/usr/include/libxml2 -o .obj/InetAddrMask.o InetAddrMask.cpp
g++ -c -pipe -Wno-unused-parameter -march=native -O2 -pipe -fPIC -Wall -W  -I/usr/share/qt4/mkspecs/linux-g++ -I. -I.. -I../.. -I/usr/include -I/usr/include/libxml2 -o .obj/Inet6AddrMask.o Inet6AddrMask.cpp
In file included from ../fwbuilder/InetAddr.h:49:0,
                 from Inet6AddrMask.cpp:31:
../fwbuilder/uint128.h: In member function ‘std::string uint128::to_string() const’:
../fwbuilder/uint128.h:469:93: warning: format ‘%lX’ expects type ‘long unsigned int’, but argument 3 has type ‘long long unsigned int’
../fwbuilder/uint128.h:469:93: warning: format ‘%08lX’ expects type ‘long unsigned int’, but argument 4 has type ‘long long unsigned int’
../fwbuilder/uint128.h:471:57: warning: format ‘%lX’ expects type ‘long unsigned int’, but argument 3 has type ‘long long unsigned int’
In file included from ../fwbuilder/InetAddr.h:49:0,
                 from InetAddr.cpp:29:
...
In file included from ../fwbuilder/InetAddr.h:49:0,
                 from ../fwbuilder/Address.h:31,
                 from Address.cpp:31:
../fwbuilder/uint128.h: In member function ‘std::string uint128::to_string() const’:
../fwbuilder/uint128.h:469:29: error: expected ‘)’ before ‘PRIX64’
../fwbuilder/uint128.h:469:93: warning: spurious trailing ‘%’ in format
../fwbuilder/uint128.h:469:93: warning: too many arguments for format
../fwbuilder/uint128.h:471:28: error: expected ‘)’ before ‘PRIX64’
../fwbuilder/uint128.h:471:57: warning: spurious trailing ‘%’ in format
../fwbuilder/uint128.h:471:57: warning: too many arguments for format
g++ -c -pipe -Wno-unused-parameter -march=native -O2 -pipe -fPIC -Wall -W  -I/usr/share/qt4/mkspecs/linux-g++ -I. -I.. -I../.. -I/usr/include -I/usr/include/libxml2 -o .obj/AddressRange.o AddressRange.cpp
make[4]: *** [.obj/Address.o] Error 1


Reproducible: Always




root@condor:/root(221)# emerge --info =net-firewall/fwbuilder-5.0.0.3568
Portage 2.1.10.41 (default/linux/amd64/10.0/desktop, gcc-4.5.3, glibc-2.14.1-r1, 3.0.7-gentoo x86_64)
=================================================================
                        System Settings
=================================================================
System uname: Linux-3.0.7-gentoo-x86_64-Intel-R-_Core-TM-2_CPU_6600_@_2.40GHz-with-gentoo-2.1
Timestamp of tree: Sun, 18 Dec 2011 06:30:01 +0000
app-shells/bash:          4.2_p20
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.7.2-r3, 3.2.2
dev-util/cmake:           2.8.6-r4
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.1
sys-apps/openrc:          0.9.7
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.1-r1
sys-devel/binutils:       2.22-r1
sys-devel/gcc:            4.4.6-r1, 4.5.3-r2
sys-devel/gcc-config:     1.5-r2
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r3
sys-kernel/linux-headers: 3.1 (virtual/os-headers)
sys-libs/glibc:           2.14.1-r1
Repositories: gentoo lordvan x11 arcon bicatali science java-overlay sunrise local x-cpan g-octave
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA PUEL dlj-1.1 skype-eula googleearth AdobeFlash-10.1 cadsoft Oracle-BCLA-JavaSE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/maven-bin-3.0/conf /usr/share/openvpn/easy-rsa /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/apache2-php5.4/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS="-march=native -O2 -pipe"
GENTOO_MIRRORS="http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror http://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ rsync://ftp.fi.muni.cz/pub/linux/gentoo ftp://ftp.wh2.tu-dresden.de/pub/mirrors/gentoo rsync://gd.tuwien.ac.at/opsys/linux/gentoo ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo ftp://ftp.tu-clausthal.de/pub/linux/gentoo http://gentoo.oregonstate.edu"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="de fr"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages/"
PORTAGE_CONFIGROOT="/"
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="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/lordvan /var/lib/layman/x11 /var/lib/layman/arcon /var/lib/layman/bicatali /var/lib/layman/science /var/lib/layman/java-overlay /var/lib/layman/sunrise /usr/local/portage /var/lib/cpan /var/lib/g-octave"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="64bit R X Xaw3d a52 aac abiword accessibility acl acpi admin afs alsa amd64 ao apache2 applet archive arpack asf aspell assistant atlas audacious audiofile automap automount bash-completion beagle berkdb blas blast bluetooth boo boost branding bzip2 cairo cdda cddb cdf cdio cdparanoia cdr cg cgi chm cli consolekit corba cracklib crypt css cuda cups curl cxx daap db dbase dbi dbm dbus declarative designer devhelp device-mapper dga dia djvu doc dri ds2490 ds9097 ds9097u dts dv dvb dvd dvdr dvi dynamicplugin eds elf emacs emboss emf encode epiphany evo examples exif expat extensions extra extras fam fame ffmpeg fftw firefox fits flac fltk fontconfig foomaticdb fortran fortran95 fpx fts3 fuse galago garmin gcj gd gdal gdbm gdu gedit geoip geolocation geos gfortran gif gimp ginac git glade glib glpk gml gmp gmtsuppl gnome gnome-keyring gnome-print gnuplot gnutls gphoto2 gpm grammar graphics graphtft graphviz grass gs gsl gsm gstreamer gtk gudev guile harness hddtemp hdf hdf5 hdri http httpd hvm hwdb iconv icq icu id3 ide imagemagick imap innodb inotify ipod ipv6 irda ithreads jabber jadetex java java6 jbig john jpeg jpeg2k kdrive kerberos kpathsea kqemu kvm ladspa lame lapack latex latex3 lcms ldap lensfun libffi libgda libnotify libsamplerate lirc lm_sensors lua lzo mad mail maildir mapnik math matroska mkl mmx mmxext mng modules mono moonlight motif mozilla mp3 mp4 mpeg mpi mplayer mtp mudflap multilib musicbrainz mysql mysqli nautilus ncurses neXt netcdf netpbm network networking networkmanager nfs nls nntp nptl nptlonly nsplugin ntfs ntp numpy obex objc ocaml ocr octave odbc ogdi ogg ole openexr opengl openmp overview pae pam pango pcre pda pdf perl plotutils plugins png podcast policykit portaudio posix postgres postscript ppds pppd preview-latex proj projectx pstricks pulseaudio python python-bindings q16 q32 qemu qhull qt3support qt4 quicktime readline reiserfs reports rle romio rpc rrdcgi rrdtool sage samba sasl science sdk sdl secure-delete semantic-desktop server session sip slang slp smbclient smp sms sndfile snmp soup sox speex spell sql sqlite sse sse2 ssl ssse3 startup-notification stlport subtitles subversion suexec svg svm swig sysfs szip t1lib tcl tcpd tex tex4ht texmacs tgif theora threads thunderbird tidy tiff tk tools truetype udev unicode usb userlocales utempter v4l2 vaapi video virtualbox vorbis wav webdav webdav-serf webkit wmf wxwidgets x264 xattr xcb xemacs xext xft xine xml xmlreader xmlrpc xorg xpm xulrunner xv xvid xvmc yaml zlib zvbi" ALSA_CARDS="intel8x0" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgid dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump" CAMERAS="canon" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" DVB_CARDS="tda10045 tda10046lifeview" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="de fr" NETBEANS_MODULES="apisupport cnd dlight enterprise ergonomics groovy gsf harness ide identity j2ee java mobility nb php profiler ruby websvccommon xml" PHP_TARGETS="php5-3" QEMU_SOFTMMU_TARGETS="i386 ppc ppc64 x86_64" QEMU_USER_TARGETS="arm i386 x86_64" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nv nouveau vesa" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS



root@condor:/root(222)# emerge -pqv =net-firewall/fwbuilder-5.0.0.3568
[ebuild     U ] net-firewall/fwbuilder-5.0.0.3568 [4.2.2.3541]
Comment 1 Juergen Rose 2011-12-18 14:20:07 UTC
Created attachment 296251 [details]
build.log
Comment 2 Francesco Riosa 2011-12-18 17:41:16 UTC
it fails because PRIX64 is undefined, but PRIX64 should be defined in inttypes.h which is included

#include <inttypes.h>   // for sprintf formats for "long long"

these are the inttypes.h found:

grep -l PRIX64 $(locate '*/inttypes.h')
 /usr/diet/include/inttypes.h
 /usr/include/inttypes.h
 /usr/include/git2/inttypes.h
 /usr/lib64/nacl-toolchain-newlib/x86_64-nacl/include/inttypes.h

grep -L PRIX64 $(locate '*/inttypes.h')
 /usr/lib64/gcc/x86_64-pc-linux-gnu/4.5.3/include/g++-v4/tr1/inttypes.h
 /usr/lib64/gcc/x86_64-pc-linux-gnu/4.6.2/include/g++-v4/tr1/inttypes.h
 /usr/lib64/nacl-toolchain-newlib/x86_64-nacl/include/c++/4.4.3/tr1/inttypes.h

a workaround (not portable) is
 #define __STDC_FORMAT_MACROS
 #include <inttypes.h>   // for sprintf formats for "long long"
+#ifndef PRIX64
+#define PRIX64 "l"
+#endif
Comment 3 Robert Malek 2011-12-19 10:58:46 UTC
(In reply to comment #2)
> it fails because PRIX64 is undefined, but PRIX64 should be defined in
> inttypes.h which is included
> 
> #include <inttypes.h>   // for sprintf formats for "long long"
> 
> these are the inttypes.h found:
> 
> grep -l PRIX64 $(locate '*/inttypes.h')
>  /usr/diet/include/inttypes.h
>  /usr/include/inttypes.h
>  /usr/include/git2/inttypes.h
>  /usr/lib64/nacl-toolchain-newlib/x86_64-nacl/include/inttypes.h
> 
> grep -L PRIX64 $(locate '*/inttypes.h')
>  /usr/lib64/gcc/x86_64-pc-linux-gnu/4.5.3/include/g++-v4/tr1/inttypes.h
>  /usr/lib64/gcc/x86_64-pc-linux-gnu/4.6.2/include/g++-v4/tr1/inttypes.h
>  /usr/lib64/nacl-toolchain-newlib/x86_64-nacl/include/c++/4.4.3/tr1/inttypes.h
> 
> a workaround (not portable) is
>  #define __STDC_FORMAT_MACROS
>  #include <inttypes.h>   // for sprintf formats for "long long"
> +#ifndef PRIX64
> +#define PRIX64 "l"
> +#endif

Can confirm, same error here (AMD64). 
The Workaround works for me.
Comment 4 Steffen 'j0inty' Stollfuß 2011-12-19 16:28:59 UTC
Same here on my adm64 box.

I manually added the fix to the file:

/var/tmp/portage/net-firewall/fwbuilder-5.0.0.3568/work/fwbuilder-5.0.0.3568/src/libfwbuilder/src/fwbuilder/uint128.h

Then simply run

ebuild /usr/portage/net-firewall/fwbuilder/fwbuilder-5.0.0.3568.ebuild compile install postinst

and It works here, too.

Would it be possible to make a patch for this problem ???

regards
j0inty
Comment 5 johannis 2011-12-19 18:24:46 UTC
Created attachment 296377 [details, diff]
patch uint128h
Comment 6 Francesco Riosa 2011-12-19 21:29:18 UTC
please EVERYBODY DO NOT use #define PRIX64 "l" on everything else than amd64, it's not a fix, just a way to underline that "inttypes.h" is included, but it must be the wrong one.

The fix involve including the right inttypes.h, nothing else, but I've not the knowledge of what to change and where, so I've tryed to explain the issue by example.
Comment 7 Dario Sarango 2011-12-20 14:21:21 UTC
What I noticed, is that autoheader is failing.  Juergen's build.log also shows that autoheader failed.

Attaching my autoheader.log, if it helps.
Comment 8 Dario Sarango 2011-12-20 14:23:11 UTC
Created attachment 296449 [details]
autoheader log
Comment 9 Jacob Martin 2011-12-20 16:31:47 UTC
Same here on amd64, haven't tried any of the fixes yet...
Comment 10 Joshua Kinard gentoo-dev 2011-12-24 19:46:02 UTC
I cannot reproduce on my machine, which is amd64 (but runs Intel Core2).  I am suspecting this is an issue related to glibc or gcc (whichever provides the inttypes.h header).  There are no bugs on the fwbuilder sourceforge page regarding issues with the uint128 data type, either.

I am about to add 5.0.1.3592, please give that a run when it shows up in the tree and see if the problem still exists.
Comment 11 Steffen 'j0inty' Stollfuß 2011-12-25 10:25:19 UTC
Hi,

I tried the new 5.0.1.3592 package today and ran again into the problem.

I uploaded the build.log with wgetpaste: http://paste.pocoo.org/show/525642/ .

emerge --info    http://paste.pocoo.org/show/525647/

regards
j0inty
Comment 12 Markus Wernig 2011-12-25 22:46:08 UTC
Yes, confirm. Problem still exists.

Could it be that /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include/g++-v4/tr1/inttypes.h (from gcc, does not define PRIX64) is used instead of /usr/include/inttypes.h (which does)?
Comment 13 Joshua Kinard gentoo-dev 2011-12-26 02:16:42 UTC
CC'ing toolchain, as this does not appear to be an issue directly with fwbuilder (as far as I can tell -- I still cannot reproduce), but some kind of issue with the order of precedence for the include directories.
Comment 14 Markus Wernig 2011-12-26 11:30:58 UTC
I don't know if it has any relation, but I have crossdev installed.

The other thing I noticed is that in uint128.h inttypes.h gets included as 
"#include <inttypes.h>", while most of the other includes are included as
#"include <something>", i.e. without the ".h" extension
Comment 15 Markus Wernig 2011-12-26 14:12:14 UTC
Update:

Problem persists after unmerging crossdev and related tools/files.
Comment 16 Joshua Kinard gentoo-dev 2011-12-26 16:33:04 UTC
(In reply to comment #14)
> I don't know if it has any relation, but I have crossdev installed.
> 
> The other thing I noticed is that in uint128.h inttypes.h gets included as 
> "#include <inttypes.h>", while most of the other includes are included as
> #"include <something>", i.e. without the ".h" extension

I already tried merging the nacl-toolchain-newlib package to see if its includes were doing something.  Merged fine for me.  I do get the uint128.h errors about the format specifiers, and this was reported to the fwbuilder mailing list where one of the developers said it wasn't an issue and would not affect the output.  uint128.h is their custom, unsigned, 128-bit integer format needed to handle IPv6 addresses, which are 128-bit.  Naturally, no standard type exists for that in any of the libc/libstdc++ libs I know of, so they had to roll their own.

No idea if the inclusion of the .h throws it off.  I know C++ traditionally does not need .h added, but I do not believe it is supposed to cause any major errors, either.
Comment 17 Markus Wernig 2011-12-26 18:05:19 UTC
OK, I tried to manually change uint128.h to #include "/usr/include/inttypes.h", and it still gives the same errors.

So maybe the include order is not relevant to this bug.

But this is strange:

/usr/include/inttypes.h defines:

#if !defined __cplusplus || defined __STDC_FORMAT_MACROS

# if __WORDSIZE == 64
#  define __PRI64_PREFIX    "l"
#  define __PRIPTR_PREFIX   "l"
# else
#  define __PRI64_PREFIX    "ll"
#  define __PRIPTR_PREFIX
# endif

... and ...

# define PRIX64     __PRI64_PREFIX "X"

so if __cplusplus is set and __WORDSIZE == 64,
I would expect PRIX64 to be "lX".

In the error messages and warnings during the failure I see multiple appearances of:

In file included from ../fwbuilder/InetAddr.h:49:0,
                 from Inet6AddrMask.cpp:31:
../fwbuilder/uint128.h: In member function 'std::string uint128::to_string() const':
../fwbuilder/uint128.h:471:93: warning: format '%lX' expects type 'long unsigned int', but argument 3 has type 'long long unsigned int'
../fwbuilder/uint128.h:471:93: warning: format '%08lX' expects type 'long unsigned int', but argument 4 has type 'long long unsigned int'
../fwbuilder/uint128.h:473:57: warning: format '%lX' expects type 'long unsigned int', but argument 3 has type 'long long unsigned int'

The code around line 471 in uint128.h is:

467    std::string to_string() const
468    {
469        char buf[33];
470        if (hi)
471            sprintf(buf, "%"PRIX64"%08"PRIX64, (unsigned long long)hi,(unsigned long long)lo);
472        else
473            sprintf(buf,"%"PRIX64,(unsigned long long)lo);
474        return buf;
475    }

So it appears that PRIX64 is actually set to "lX", but somehow sprintf is not aware that this corresponds to an "unsigned long long".

There is a comment in uint128.h to that matter:
#include <inttypes.h>   // for sprintf formats for "long long"

From man sprintf:
The length modifier
       Here, "integer conversion" stands for d, i, o, u, x, or X conversion.
...
       l      (ell) A following integer conversion corresponds to a long int or unsigned long int argument, or a following  n  conversion  corre-
              sponds  to a pointer to a long int argument, or a following c conversion corresponds to a wint_t argument, or a following s conver-
              sion corresponds to a pointer to wchar_t argument.

       ll     (ell-ell).  A following integer conversion corresponds to a long long int or unsigned long long int argument, or a following n con-
              version corresponds to a pointer to a long long int argument.
...

From that it would seem that in order to have a true long long unsigned int, PRIX64 should in fact be "llX".

So it appears that on our systems (mine is a Core2), __WORDSIZE is not 64.
But this could well be harmless, I'm far from versatile on those matters.


But then, strangely, when the fatal error occurs, PRIX64 suddenly seems no longer to be a valid macro:

g++ -c -pipe -Wno-unused-parameter -march=core2 -O2 -pipe -fomit-frame-pointer -fPIC -Wall -W  -I/usr/share/qt4/mkspecs/linux-g++ -I. -I.. -I../.. -I/usr/include -I/usr/include/libxml2 -o .obj/Address.o Address.cpp
g++ -c -pipe -Wno-unused-parameter -march=core2 -O2 -pipe -fomit-frame-pointer -fPIC -Wall -W  -I/usr/share/qt4/mkspecs/linux-g++ -I. -I.. -I../.. -I/usr/include -I/usr/include/libxml2 -o .obj/AddressRange.o AddressRange.cpp
g++ -c -pipe -Wno-unused-parameter -march=core2 -O2 -pipe -fomit-frame-pointer -fPIC -Wall -W  -I/usr/share/qt4/mkspecs/linux-g++ -I. -I.. -I../.. -I/usr/include -I/usr/include/libxml2 -o .obj/dns.o dns.cpp
In file included from ../fwbuilder/InetAddr.h:49:0,
                 from ../fwbuilder/Address.h:31,
                 from Address.cpp:31:
../fwbuilder/uint128.h: In member function 'std::string uint128::to_string() const':
../fwbuilder/uint128.h:471:29: error: expected ')' before 'PRIX64'
../fwbuilder/uint128.h:471:93: warning: spurious trailing '%' in format
../fwbuilder/uint128.h:471:93: warning: too many arguments for format
../fwbuilder/uint128.h:473:28: error: expected ')' before 'PRIX64'
../fwbuilder/uint128.h:473:57: warning: spurious trailing '%' in format
../fwbuilder/uint128.h:473:57: warning: too many arguments for format
make[4]: *** [.obj/Address.o] Error 1
make[4]: *** Waiting for unfinished jobs....
In file included from ../fwbuilder/InetAddr.h:49:0,
                 from ../fwbuilder/dns.h:55,
                 from dns.cpp:52:
../fwbuilder/uint128.h: In member function 'std::string uint128::to_string() const':
../fwbuilder/uint128.h:471:93: warning: format '%lX' expects type 'long unsigned int', but argument 3 has type 'long long unsigned int'
../fwbuilder/uint128.h:471:93: warning: format '%08lX' expects type 'long unsigned int', but argument 4 has type 'long long unsigned int'
../fwbuilder/uint128.h:473:57: warning: format '%lX' expects type 'long unsigned int', but argument 3 has type 'long long unsigned int'
In file included from ../fwbuilder/InetAddr.h:49:0,
                 from ../fwbuilder/Address.h:31,
                 from ../fwbuilder/AddressRange.h:30,
                 from AddressRange.cpp:31:
../fwbuilder/uint128.h: In member function 'std::string uint128::to_string() const':
../fwbuilder/uint128.h:471:29: error: expected ')' before 'PRIX64'
../fwbuilder/uint128.h:471:93: warning: spurious trailing '%' in format
../fwbuilder/uint128.h:471:93: warning: too many arguments for format
../fwbuilder/uint128.h:473:28: error: expected ')' before 'PRIX64'
../fwbuilder/uint128.h:473:57: warning: spurious trailing '%' in format
../fwbuilder/uint128.h:473:57: warning: too many arguments for format
make[4]: *** [.obj/AddressRange.o] Error 1
make[4]: Leaving directory `/var/tmp/portage/net-firewall/fwbuilder-5.0.1.3592/work/fwbuilder-5.0.1.3592/src/libfwbuilder/src/fwbuilder'
make[3]: *** [sub-fwbuilder-make_default-ordered] Error 2
make[3]: Leaving directory `/var/tmp/portage/net-firewall/fwbuilder-5.0.1.3592/work/fwbuilder-5.0.1.3592/src/libfwbuilder/src'
make[2]: *** [sub-src-make_default] Error 2
make[2]: Leaving directory `/var/tmp/portage/net-firewall/fwbuilder-5.0.1.3592/work/fwbuilder-5.0.1.3592/src/libfwbuilder'
make[1]: *** [sub-libfwbuilder-make_default-ordered] Error 2
make[1]: Leaving directory `/var/tmp/portage/net-firewall/fwbuilder-5.0.1.3592/work/fwbuilder-5.0.1.3592/src'
make: *** [sub-src-make_default] Error 2
 * ERROR: net-firewall/fwbuilder-5.0.1.3592 failed (compile phase):

So I thought it might be a problem of parallel make not picking up the macro, but the error persists also with MAKEOPTS=-j1 instead of -j3, bailing out at the first error as above.

Well, and this is as far as my two grains of wisdom will take me ...
Comment 18 Markus Wernig 2011-12-29 22:28:17 UTC
(In reply to comment #17)

> So it appears that on our systems (mine is a Core2), __WORDSIZE is not 64.
> But this could well be harmless, I'm far from versatile on those matters.

This should of course have read:
"So it appears that on our systems (mine is a Core2), __WORDSIZE is really 64."

Btw: The warnings mentioned above are from the c++ preprocessor:

# c++ uint128.h -
uint128.h: In member function 'std::string uint128::to_string() const':
uint128.h:469:93: warning: format '%lX' expects type 'long unsigned int', but argument 3 has type 'long long unsigned int'
uint128.h:469:93: warning: format '%08lX' expects type 'long unsigned int', but argument 4 has type 'long long unsigned int'
uint128.h:471:57: warning: format '%lX' expects type 'long unsigned int', but argument 3 has type 'long long unsigned int'

Could it be that because of those c++ does not expand the PRIX64 macro?

I have gcc-4.5.3-r2 here:
# gcc-config -l
 [1] x86_64-pc-linux-gnu-4.5.3 *
Comment 19 SpanKY gentoo-dev 2011-12-31 09:10:43 UTC
builds find for me.  someone go into the build dir and compile the file by hand and see if it fails:

 cd /var/tmp/portage/net-firewall/fwbuilder-5.0.1.3592/work/fwbuilder-5.0.1.3592/src/libfwbuilder/src/fwbuilder/
 g++ -c -pipe -Wno-unused-parameter -march=core2 -O2 \
 -fomit-frame-pointer -fPIC -I/usr/share/qt4/mkspecs/linux-g++ -I. \
 -I.. -I../.. -I/usr/include -I/usr/include/libxml2 Address.cpp

if that fails, run it again like so:
 g++ -E -dD -pipe -Wno-unused-parameter -march=core2 -O2 \
 -fomit-frame-pointer -fPIC -I/usr/share/qt4/mkspecs/linux-g++ -I. \
 -I.. -I../.. -I/usr/include -I/usr/include/libxml2 Address.cpp -o Address.i

then compress the "Address.i" file and post it here for me to review
Comment 20 Markus Wernig 2011-12-31 09:35:45 UTC
(In reply to comment #19)
> builds find for me.  someone go into the build dir and compile the file by hand
> and see if it fails:
> 
>  cd
> /var/tmp/portage/net-firewall/fwbuilder-5.0.1.3592/work/fwbuilder-5.0.1.3592/src/libfwbuilder/src/fwbuilder/
>  g++ -c -pipe -Wno-unused-parameter -march=core2 -O2 \
>  -fomit-frame-pointer -fPIC -I/usr/share/qt4/mkspecs/linux-g++ -I. \
>  -I.. -I../.. -I/usr/include -I/usr/include/libxml2 Address.cpp

This again fails with the known errors:
#  g++ -c -pipe -Wno-unused-parameter -march=core2 -O2 \
>  -fomit-frame-pointer -fPIC -I/usr/share/qt4/mkspecs/linux-g++ -I. \
>  -I.. -I../.. -I/usr/include -I/usr/include/libxml2 Address.cpp
In file included from ../fwbuilder/InetAddr.h:49:0,
                 from ../fwbuilder/Address.h:31,
                 from Address.cpp:31:
../fwbuilder/uint128.h: In member function 'std::string uint128::to_string() const':
../fwbuilder/uint128.h:469:29: error: expected ')' before 'PRIX64'
../fwbuilder/uint128.h:469:93: warning: spurious trailing '%' in format
../fwbuilder/uint128.h:471:28: error: expected ')' before 'PRIX64'
../fwbuilder/uint128.h:471:57: warning: spurious trailing '%' in format

> 
> if that fails, run it again like so:
>  g++ -E -dD -pipe -Wno-unused-parameter -march=core2 -O2 \
>  -fomit-frame-pointer -fPIC -I/usr/share/qt4/mkspecs/linux-g++ -I. \
>  -I.. -I../.. -I/usr/include -I/usr/include/libxml2 Address.cpp -o Address.i
> 
> then compress the "Address.i" file and post it here for me to review
See attachment
Comment 21 Markus Wernig 2011-12-31 09:37:34 UTC
Created attachment 297437 [details]
Address.i, gzipped
Comment 22 SpanKY gentoo-dev 2011-12-31 09:56:14 UTC
not a bug in the toolchain.  the fwbuilder code allows inttypes.h to get included before it defines __STDC_FORMAT_MACROS.  thus the fwbuilder code is broken.  your address.i file shows this clearly:

line 32635:# 1 "/usr/include/inttypes.h" 1 3 4
line 51442:#define __STDC_FORMAT_MACROS 

suggestion: have configure.ac append -D__STDC_FORMAT_MACROS to CPPFLAGS.  otherwise, you'll have to rework all the places this header file gets included to make sure inttypes.h isn't (in)directly pulled in sooner.
Comment 23 Markus Wernig 2011-12-31 10:51:40 UTC
Should it be CXXFLAGS?

I've tried this (but maybe it's not a valid test case):

CXXFLAGS="-march=core2 -O2 -pipe -fomit-frame-pointer -D__STDC_FORMAT_MACROS"
export CXXFLAGS
CXXFLAGS="-march=core2 -O2 -pipe -fomit-frame-pointer -D__STDC_FORMAT_MACROS" emerge fwbuilder

This comes a lot further, but still breaks:

g++ -c -pipe -Wno-unused-parameter -fPIC -Wall -W -D_REENTRANT -DFWB_SIG=26932 -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I.. -I../.. -I/usr/include/libxml2 -I../../src -I../import -I../libfwbuilder/src -I.moc -o .obj/IPTCfgLexer.o IPTCfgLexer.cpp
In file included from ../libfwbuilder/src/fwbuilder/InetAddr.h:49:0,
                 from ../libfwbuilder/src/fwbuilder/Address.h:31,
                 from ../libfwbuilder/src/fwbuilder/Host.h:33,
                 from ../libfwbuilder/src/fwbuilder/Firewall.h:30,
                 from ../import/Importer.h:28,
                 from ../import/IOSImporter.h:36,
                 from iosacl.g:30,
                 from IOSCfgParser.cpp:8:
../libfwbuilder/src/fwbuilder/uint128.h: In member function 'std::string uint128::to_string() const':
../libfwbuilder/src/fwbuilder/uint128.h:469:29: error: expected ')' before 'PRIX64'
../libfwbuilder/src/fwbuilder/uint128.h:469:93: warning: spurious trailing '%' in format
../libfwbuilder/src/fwbuilder/uint128.h:469:93: warning: too many arguments for format
../libfwbuilder/src/fwbuilder/uint128.h:471:28: error: expected ')' before 'PRIX64'
../libfwbuilder/src/fwbuilder/uint128.h:471:57: warning: spurious trailing '%' in format
../libfwbuilder/src/fwbuilder/uint128.h:471:57: warning: too many arguments for format

Note how the -D__STDC_FORMAT_MACROS is no longer present (but was in all calls to g++ until then)

The same happens when appending -D__STDC_FORMAT_MACROS to CXXFLAGS in make.conf.

But running g++ -c -pipe -Wno-unused-parameter -fPIC -Wall -W -D__STDC_FORMAT_MACROS -D_REENTRANT -DFWB_SIG=26932 -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I.. -I../.. -I/usr/include/libxml2 -I../../src -I../import -I../libfwbuilder/src -I.moc -o .obj/IPTCfgLexer.o IPTCfgLexer.cpp
succeeds as expected.

BTW: Does anybody have a clue why this does not affect everybody? Given that the inclusion chain is identical (ptypes.h from dev-libs/icu reads inttype.h before uint128.h does), this should happen everywhere, no?
Comment 24 SpanKY gentoo-dev 2012-01-01 07:01:25 UTC
CPPFLAGS is used with both C and C++ compilation.  if it isn't, then that's another bug in the build system that needs to be fixed.
Comment 25 Joshua Kinard gentoo-dev 2012-01-03 03:41:46 UTC
Basically, this is an upstream bug.  I have opened ticket #3468802 with fwbuilder upstream, referencing this bug and providing some of the information from vapier.  Added the SF ticket to the URL field.
Comment 26 Juergen Rose 2012-01-11 13:34:27 UTC
One week later I get a new error trying to emerge fwbuilder-5.0.1.3592, now with automake-1.11.2.>>> Emerging (1 of 1) net-firewall/fwbuilder-5.0.1.3592
 * fwbuilder-5.0.1.3592.tar.gz RMD160 SHA1 SHA256 size ;-) ...                                                 [ ok ]
>>> Unpacking source...
>>> Unpacking fwbuilder-5.0.1.3592.tar.gz to /var/tmp/portage/net-firewall/fwbuilder-5.0.1.3592/work
>>> Source unpacked in /var/tmp/portage/net-firewall/fwbuilder-5.0.1.3592/work
>>> Preparing source in /var/tmp/portage/net-firewall/fwbuilder-5.0.1.3592/work/fwbuilder-5.0.1.3592 ...
 * Applying fwbuilder-5.0.0.3568-ldflags.patch ...                                                             [ ok ]
 * Running eautoreconf in '/var/tmp/portage/net-firewall/fwbuilder-5.0.1.3592/work/fwbuilder-5.0.1.3592' ...
 * Running aclocal ...                                                                                         [ ok ]
 * Running libtoolize --copy --force --install ...                                                             [ ok ]
 * Running aclocal ...                                                                                         [ ok ]
 * Running autoconf ...                                                                                        [ ok ]
 * Running autoheader ...                                                                                      [ !! ]
 * Running automake --add-missing --copy --foreign ...                                                         [ !! ]

 * Failed Running automake !
 * 
 * Include in your bugreport the contents of:
 * 
 *   /var/tmp/portage/net-firewall/fwbuilder-5.0.1.3592/temp/automake.out
Comment 27 Juergen Rose 2012-01-11 13:35:23 UTC
Created attachment 298641 [details]
/var/tmp/portage/net-firewall/fwbuilder-5.0.1.3592/temp/automake.out
Comment 28 Juergen Rose 2012-01-11 13:37:15 UTC
I get the same error with an without uint128h.patch. Do we have any workaround to emerge fwbuilder-5.*?
Comment 29 Joshua Kinard gentoo-dev 2012-01-13 05:52:31 UTC
Please open the automake issue into a new bug for separate tracking.  It's probably got a different cause than this bug.
Comment 30 Juergen Rose 2012-01-13 10:03:15 UTC
I filed a new bug report (https://bugs.gentoo.org/show_bug.cgi?id=398743) with the automake issue.
Comment 31 Joshua Kinard gentoo-dev 2012-02-14 22:30:37 UTC
Per the update on the upstream ticket here:
http://sourceforge.net/tracker/?func=detail&atid=1129518&aid=3468802&group_id=5314

Could someone affected by this bug test the updated source tarball and let me know if it works?  If so, I'll update the upstream bug and release a new ebuild when the bugfix release is posted.
Comment 32 Gian Luca Dalla Torre 2012-02-15 07:22:44 UTC
Hi Joshua,
I think you could release this new ebuild as hard masked. Doing so I can easily check if the build will work.
If I try it manually I can run into build mistakes due to my weak build capabilities.
If you make it available I will sure test it.
Thank you!
Comment 33 Gian Luca Dalla Torre 2012-02-24 07:51:57 UTC
Hi Joshua, any news on this bug?
Could you update the portage with the new release?
Comment 34 Joshua Kinard gentoo-dev 2012-02-26 06:13:43 UTC
(In reply to comment #33)
> Hi Joshua, any news on this bug?
> Could you update the portage with the new release?

There hasn't been a new release yet.  I will create a patch and post it to this bug for someone to test shortly.  I need to report the success upstream before they'll make a new release.
Comment 35 Didier Link 2012-03-11 10:25:04 UTC
Hi all,

I'm also affected by this bug, on Gentoo ~amd64.

I've just finished to test manually the build of fwbuilder 5.0.1, with the mentionned error, and the same with the nightly 5.0.2.3596 from fwbuilder sourceforge project mentionned upstream. They've added '-D__STDC_FORMAT_MACROS' in the commandline and all build like a charm.

So Joshua, I think you can confirm upstream that the problem on Gentoo is solved by this nightly build (from 20/02/12) for a new release to all.

Thanks
Comment 36 Joshua Kinard gentoo-dev 2012-03-11 23:02:13 UTC
(In reply to comment #35)
> Hi all,
> 
> I'm also affected by this bug, on Gentoo ~amd64.
> 
> I've just finished to test manually the build of fwbuilder 5.0.1, with the
> mentionned error, and the same with the nightly 5.0.2.3596 from fwbuilder
> sourceforge project mentionned upstream. They've added
> '-D__STDC_FORMAT_MACROS' in the commandline and all build like a charm.
> 
> So Joshua, I think you can confirm upstream that the problem on Gentoo is
> solved by this nightly build (from 20/02/12) for a new release to all.

Didier,

Thanks for the report.  I have some free time today, so I'll try and do that and see about getting their patch into 5.0.1 tonight.  Apologies for the delay on fixing this.
Comment 37 Joshua Kinard gentoo-dev 2012-03-12 06:58:28 UTC
I've added the patch that should address this issue to a new rev of fwbuilder 5.0.1.  For those affected, please give it a test and let me know if it solves the problem.  It's already included in the upstream release, which will hopefully be out soon.

Thanks!
Comment 38 Didier Link 2012-03-12 23:17:12 UTC
I Joshua,

Thanks a lot, it works like a charm ;)
Comment 39 Gian Luca Dalla Torre 2012-03-13 08:35:41 UTC
I have tested it and I can confirm it works!
Thank you!
Comment 40 Joshua Kinard gentoo-dev 2012-03-14 00:09:24 UTC
Confirmed fixed.
Comment 41 Andreas K. Hüttel archtester gentoo-dev 2012-05-04 22:11:14 UTC
*** Bug 403257 has been marked as a duplicate of this bug. ***