Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 278109 - dev-libs/boost-1.39.0 fails to build on gcc-4.4 due to strict aliasing
Summary: dev-libs/boost-1.39.0 fails to build on gcc-4.4 due to strict aliasing
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] GCC Porting (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Tiziano Müller (RETIRED)
Depends on:
Blocks: gcc-4.4
  Show dependency tree
Reported: 2009-07-17 02:45 UTC by Alexandre Rostovtsev (RETIRED)
Modified: 2009-08-07 05:48 UTC (History)
12 users (show)

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

build.log (build.log,1.03 MB, text/plain)
2009-07-20 10:08 UTC, Alexey Shvetsov
Build log on x86_64 (build.log,365.62 KB, text/plain)
2009-07-27 00:09 UTC, Andrew John Hughes

Note You need to log in before you can comment on or make changes to this bug.
Description Alexandre Rostovtsev (RETIRED) gentoo-dev 2009-07-17 02:45:34 UTC
This is basically a duplicate of bug #252287 (which was fixed several weeks ago for earlier versions of boost).

Boost-1.39.0 fails to build with gcc-4.4.0-r1, eventually dying with something like

In file included from libs/wave/src/instantiate_cpp_literalgrs.cpp:23:
./boost/optional/optional.hpp: In static member function 'static unsigned int boost::wave::grammars::chlit_grammar_gen<TokenT>::evaluate(const TokenT&, boost::wave::grammars::value_error&) [with TokenT = boost::wave::cpplexer::lex_token<boo
st::wave::util::file_position<boost::wave::util::flex_string<char, std::char_traits<char>, std::allocator<char>, boost::wave::util::CowString<boost::wave::util::AllocatorStringStorage<char, std::allocator<char> >, char*> > > >]':
./boost/optional/optional.hpp:262: warning: dereferencing pointer '<anonymous>' does break strict-aliasing rules
./boost/optional/optional.hpp:422: note: initialized from here
./boost/optional/optional.hpp:268: warning: dereferencing pointer '<anonymous>' does break strict-aliasing rules
./boost/optional/optional.hpp:422: note: initialized from here
...failed updating 1 target...
...updated 1337 targets...
 * ERROR: dev-libs/boost-1.39.0 failed.

The fix is exactly the same as the one that Diego Pettenò and Ryan Hill added to boost-1.35, 1.36 and 1.37 a few weeks ago: add

[[ $(gcc-version) > 4.3 ]] && append-flags -Wno-strict-aliasing

to the ebuild. Then boost-1.39.0 will compile with gcc-4.4

For some reason, the bugfix was not propagated to boost-1.39.0 when it was version bumped today.
Comment 1 Jory A. Pratt gentoo-dev 2009-07-17 04:36:45 UTC
--- /usr/portage/dev-libs/boost/boost-1.39.0.ebuild	2009-07-16 04:36:51.000000000 -0500
+++ boost-1.39.0.ebuild	2009-07-16 23:30:15.098207012 -0500
@@ -92,6 +92,9 @@
 		# yeah, we WANT it to work on non-Linux too
 		sed -i -e 's/#ifdef __linux__/#if 1/' libs/random/random_device.cpp || die
+	# Huge number of strict-aliasing warnings cause a build failure w/ >= GCC 4.4 bug #252287
+	[[ $(gcc-version) > 4.3 ]] && append-flags -Wno-strict-aliasing
 src_configure() {

It seems gcc-4.4 support was drop'd from the ebuild, simply readd and compiles fine.
Comment 2 Tiziano Müller (RETIRED) gentoo-dev 2009-07-17 06:29:37 UTC
That's a workaround and not a fix. While this may be appropriate for older boost versions (since backporting surely causes headaches) we have to make sure that the new version is fixed properly.
Comment 3 Ryan Hill (RETIRED) gentoo-dev 2009-07-20 05:07:10 UTC
The problem is that this appears to be gentoo-specific, and upstream considers these warnings false-positives.  I don't know why this is failing, but I do know that no other distro using GCC 4.4 has come across it.
Comment 4 Tiziano Müller (RETIRED) gentoo-dev 2009-07-20 07:17:28 UTC
And to make the matter even more complicated: I successfully built boost-1.39.0 here with gcc-4.4.0
Comment 5 Alexey Shvetsov archtester gentoo-dev 2009-07-20 10:08:05 UTC
Created attachment 198558 [details]
Comment 6 Peter Read 2009-07-22 15:01:42 UTC
(In reply to comment #4)
> And to make the matter even more complicated: I successfully built boost-1.39.0
> here with gcc-4.4.0

what use flags are you using?  

is e.g. gcc built with 'vanila' or some such?
Comment 7 Emmanuel Andry 2009-07-23 19:47:13 UTC
Maybe one of these patches can help :
Comment 8 Ryan Hill (RETIRED) gentoo-dev 2009-07-25 01:58:20 UTC
(In reply to comment #4)
> And to make the matter even more complicated: I successfully built boost-1.39.0
> here with gcc-4.4.0

What package manager?
Comment 9 Tiziano Müller (RETIRED) gentoo-dev 2009-07-25 09:17:06 UTC
paludis, but my recent conclusion is that it's a gcc-bug.
I could narrow it down to one file in the wave-library.
The problem is that when I try to build it 10 times, it works 1 or 2 times.
What is common is that gcc just stops compiling at some point without any further notice or error. It even forgets the line feed. But as far as I could tell it always works when you disable the warnings.
What we can try: backport/get the strict-aliasing fixes from the boost trunk to really fix the issue (as did the exherbo-devs). That will most likely avoid to trigger that gcc-bug.
Comment 10 Ryan Hill (RETIRED) gentoo-dev 2009-07-25 18:45:42 UTC
if it were a GCC bug, it seems to me that one of the other many distros using GCC 4.4 would have also encountered it.

but anyways, if we're going this route, the best place to start is looking for is fixes applied to

Comment 11 Andrew John Hughes 2009-07-27 00:08:03 UTC
Also fails for me with gcc 4.4.  Build log attached.

Comment 12 Andrew John Hughes 2009-07-27 00:09:02 UTC
Created attachment 199264 [details]
Build log on x86_64
Comment 13 Andrew John Hughes 2009-07-27 00:09:27 UTC
emerge --info:

Portage 2.2_rc33 (default/linux/amd64/2008.0/desktop, gcc-4.4.1, glibc-2.10.1-r0, 2.6.30-gentoo-r2.rivendell x86_64)
System uname: Linux-2.6.30-gentoo-r2.rivendell-x86_64-Intel-R-_Xeon-R-_CPU_X5482_@_3.20GHz-with-glibc2.2.5
Timestamp of tree: Fri, 24 Jul 2009 12:45:02 +0000
ccache version 2.4 [enabled]
app-shells/bash:     3.2_p39
dev-java/java-config: 2.1.8-r1
dev-lang/python:     2.5.4-r3
dev-util/ccache:     2.4-r7
dev-util/cmake:      2.6.4-r1
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.4.3-r3
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.13, 2.63-r1
sys-devel/automake:  1.5, 1.7.9-r1, 1.9.6-r2, 1.10.2, 1.11
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.4
virtual/os-headers:  2.6.27-r2
CFLAGS="-O2 -pipe -march=core2 -ggdb -mno-tls-direct-seg-refs"
CONFIG_PROTECT="/etc /usr/share/config /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /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 /etc/udev/rules.d"
CXXFLAGS="-O2 -pipe -march=core2 -ggdb -mno-tls-direct-seg-refs"
FEATURES="ccache distlocks fixpackages parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unmerge-orphans userfetch"
LINGUAS="en en_GB"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTDIR_OVERLAY="/usr/local/gentoo/xmmsroot2-overlay /usr/local/gentoo/java-overlay /usr/local/gentoo/fixes-overlay"
USE="X a52 aac acl acpi alsa amd64 avahi bash-completion berkdb bindist bluetooth branding bzip2 cairo cddb cdparanoia cdr cli consolekit cracklib crypt cups curl cvs dbus dga dirac djvu dri dts dv dvb dvd dvdr dvdread eds emacs emboss encode evo exif fam ffmpeg fftw firefox flac fontconfig fortran ftp fuse gcj gdbm gif gimp gnome gnutls gpm graphviz gstreamer gtk gtkhtml hal iconv idn ieee1394 imagemagick imap ipv6 isdnlog java java5 javascript jbig jpeg jpeg2k ladspa lame latex lcms libass libcaca libnotify libsamplerate lzma lzo mad mbox midi mikmod mmap mmx mng mp3 mpeg mudflap multilib musepack musicbrainz ncurses nis nls nntp nptl nptlonly nsplugin ogg openexr opengl openmp pam pch pcre pdf perl png policykit postgres ppds pppd pulseaudio python qt3 qt3support qt4 quicktime readline reflection sasl schroedinger sdl session sndfile sox speex spell spl sse sse2 ssl ssse3 startup-notification subversion svg sysfs taglib tcpd tga theora threads tiff truetype unicode usb vorbis wavpack wmf x264 xattr xcomposite xft xml xmmsroot2 xorg xosd xprint xscreensaver xulrunner xv xvid yahoo zeroconf zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" 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 authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en en_GB" USERLAND="GNU" VIDEO_CARDS="radeonhd"
Comment 14 Tiziano Müller (RETIRED) gentoo-dev 2009-08-07 05:48:53 UTC
Fixed with readding -Wno-strict-aliasing since backporting is too cumbersome and boost-1.40.0 which fixes it anyway is near (beta should be published this weekend).