Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 266267

Summary: gcc-3.4.6-r2 doesn't compile with march=native
Product: Gentoo Linux Reporter: Sérgio Almeida <mephx.x>
Component: Current packagesAssignee: Gentoo Toolchain Maintainers <toolchain>
Status: RESOLVED DUPLICATE    
Severity: minor CC: leio
Priority: High    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Sérgio Almeida 2009-04-15 15:22:29 UTC
While re-emerging gcc-3.4.6-r2 it crashed. Removed march=native temporarily and emerge completed successfully.

Reproducible: Always

Steps to Reproduce:
1. make.conf <- "march=native"
2. emerge =gcc-3.4.6-r2





Portage 2.2_rc30 (default/linux/amd64/2008.0, gcc-4.3.3, glibc-2.9_p20081201-r2, 2.6.27-gentoo-r10 x86_64)
=================================================================
System uname: Linux-2.6.27-gentoo-r10-x86_64-Quad-Core_AMD_Opteron-tm-_Processor_8354-with-glibc2.2.5
Timestamp of tree: Wed, 15 Apr 2009 12:15:01 +0000
ccache version 2.4 [enabled]
app-shells/bash:     4.0_p17-r1
dev-java/java-config: 2.1.7
dev-lang/python:     2.5.4-r2
dev-util/ccache:     2.4-r8
dev-util/cmake:      2.6.3
sys-apps/baselayout: 2.0.0
sys-apps/openrc:     0.4.3-r1
sys-apps/sandbox:    1.9
sys-devel/autoconf:  2.63-r1
sys-devel/automake:  1.9.6-r2, 1.10.2
sys-devel/binutils:  2.19.1-r1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6a
virtual/os-headers:  2.6.28-r1
ACCEPT_KEYWORDS="amd64 ~amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=native"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc"
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=native"
DISTDIR="/usr/portage/distfiles"
FEATURES="ccache distlocks fixpackages parallel-fetch preserve-libs protect-owned sandbox sfperms strict unmerge-orphans userfetch"
FFLAGS="-O2 -pipe -march=native"
GENTOO_MIRRORS="http://darkstar.ist.utl.pt/gentoo"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en fr pt"
MAKEOPTS="-j30"
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="/usr/local/portage/layman/science"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext X acl amd64 bash-completion berkdb blas bzip2 cairo cli cracklib crypt cups dri emacs fftw fortran gd gdbm gif glitz gnuplot gpm gs gsl gtk hdf5 iconv imagemagick ipv6 isdnlog java jpeg lapack latex libffi logrotate midi mmx mpi mudflap multilib ncurses netcdf nls nptl nptlonly offensive opengl openmp pam pcre pdf perl plotutils png pppd profile python qt4 readline reflection session smp spl sse sse2 ssl svg sysfs tcpd threads tiff tk truetype unicode vim-syntax wxwindows xcb xft xml xorg 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" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en fr pt" USERLAND="GNU" VIDEO_CARDS="nv"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPT
Comment 1 Sérgio Almeida 2009-04-15 15:31:22 UTC
log: http://magdalene.ist.utl.pt/~mephx/sys-devel-gcc-3.4.6-r2.log
Comment 2 Rafał Mużyło 2009-04-15 15:40:17 UTC
-march=native was not supported by gcc 3.x.
Comment 3 Rafał Mużyło 2009-04-15 15:42:46 UTC
Though, perhaps filtering that out should be possible
by the ebuild/eclass.
Comment 4 Sérgio Almeida 2009-04-16 14:49:49 UTC
(In reply to comment #3)
> Though, perhaps filtering that out should be possible
> by the ebuild/eclass.
> 

Hello,

That would be the purpose of this bug.

Cheers,
Sérgio
Comment 5 Mart Raudsepp gentoo-dev 2009-04-17 12:15:23 UTC
The core issue here is that gcc is built with currently selected gcc first - everything is fine with -march=native, but then it compiles again with itself again for proper bootstrapping, and honors the CFLAGS there too, and that doesn't accept -march=native as it's gcc3.x, not gcc-4.2 or so when =native was introduced.

So this will happen with any flags that you have set in your make.conf that work fine for you usually due to gcc4.3 supporting them, but fail when compiling some older gcc, as that older gcc will try to recompile itself as part of the process with the provided CFLAGS.
Given that this isn't limited to just -march=native, I'm not sure what the toolchain guys could do here. For example gcc-4.1 won't compile with -march=geode in CFLAGS, while the typical system gcc-4.3 is quite happy with it. Or many of the other flags that are new after gcc-3.4

I guess we can quickly run it through them to decide if there's something useful possible here (if even some kind of a warning) or not.
Comment 6 Ryan Hill (RETIRED) gentoo-dev 2009-04-17 16:52:15 UTC
we do have tests that catch invalid flags for the compiler being used (see the bashrc in the amd64 profile for eg.), but we have no way of knowing what flags the bootstrapped compiler will accept until it's built, at which point you're getting an error anyways.  we can't strip march=native or replace it with something sane because we don't know what sane is for your hardware.

i always forget to change -march=core2 to -march=nocona when i build 4.1 so i'm right there with you, but there's not much we can do.

*** This bug has been marked as a duplicate of bug 219281 ***