# [SOLVED]: How to build gentoo-sources-2.6.30

## ONEEYEMAN

Hi, ALL,

I upgraded the gcc from 4.1.1 to 4.3.2.

Now trying to compile gentoo-sources-2.6.30, and I'm receiving this:

```

include/linux/compiler-gcc4.h:8:4: error: #error Your version of gcc miscompiles the __weak directive

```

What gcc version do I need?

Thank you.Last edited by ONEEYEMAN on Sun Sep 20, 2009 3:36 pm; edited 1 time in total

----------

## DaggyStyle

post the following outputs:

```
emerge --info

emerge -ptv gcc

```

----------

## ONEEYEMAN

Hi,

Here you go:

```

Portage 2.1.6.13 (default/linux/x86/2008.0, gcc-4.3.2, glibc-2.9_p20081201-r2, 2.6.23-gentoo-r8 i686)

=================================================================

System uname: Linux-2.6.23-gentoo-r8-i686-Genuine_Intel-R-_CPU_T1350_@_1.86GHz-with-gentoo-1.12.11.1

Timestamp of tree: Wed, 09 Sep 2009 19:15:01 +0000

ccache version 2.4 [enabled]

app-shells/bash:     3.2_p39

dev-lang/python:     2.4.4-r9, 2.5.4-r3, 2.6.2-r1

dev-python/pycrypto: 2.0.1-r6

dev-util/ccache:     2.4-r7

sys-apps/baselayout: 1.12.11.1

sys-apps/sandbox:    1.6-r2

sys-devel/autoconf:  2.13, 2.63-r1

sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.2

sys-devel/binutils:  2.18-r3

sys-devel/gcc-config: 1.4.1

sys-devel/libtool:   1.5.26

virtual/os-headers:  2.6.27-r2

ACCEPT_KEYWORDS="x86"

CBUILD="i686-pc-linux-gnu"

CFLAGS="-Os -march=prescott -pipe"

CHOST="i686-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/udev/rules.d"

CXXFLAGS="-Os -march=prescott -pipe"

DISTDIR="/usr/portage/distfiles"

FEATURES="ccache distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"

GENTOO_MIRRORS="http://gentoo.osuosl.org/ "

LDFLAGS="-Wl,-O1"

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"

SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"

USE="X a52 acl acpi alsa apm berkdb bzip2 cdr clamav cli cracklib crypt dri dvd dvdr freetds gdbm gnome gpm gtk gtk2 hal iconv ipv6 isdnlog lm_sensors mplayer mssql mudflap ncurses nls nptl nptlonly odbc opengl openmp pam pcre pmu pppd python readline reflection session spl ssl sybase sybase-ct symlink sysfs tcpd theora truetype unicode usb wifi wxwindows x86 xine xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 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="evdev mouse keyboard synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="i810"

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, MAKEOPTS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY

```

and

```

These are the packages that would be merged, in reverse order:

Calculating dependencies   ... done!

[ebuild   R   ] sys-devel/gcc-4.3.2-r3  USE="gtk mudflap nls nptl openmp (-altivec) -bootstrap -build -doc (-fixed-point) -fortran -gcj (-hardened) -ip28 -ip32r10k -libffi (-multilib) -multislot (-n32) (-n64) -nocxx -nopie -objc -objc++ -objc-gc -test -vanilla" 0 kB

Total: 1 package (1 reinstall), Size of downloads: 0 kB

 * IMPORTANT: 3 news items need reading for repository 'gentoo'.

 * Use eselect news to read news items.

```

Thank you.

----------

## DaggyStyle

try to recompile it with ccahce disabled

----------

## ONEEYEMAN

So, just take it off from /etc/make.conf?

Thank you.

----------

## DaggyStyle

not sure if it will work but give it a try. something like this:

```
FEATURES="-ccache" emerge -atv gcc
```

----------

## VoidMage

I think the correct answer is "open a new terminal"

- that error comes up during preprocessing, not compiling,

so it's unlikely that ccache has anything to do with it.

More likely is that after using gcc-config you didn't

follow the note about already running shells,

so the one you were using still has gcc 4.1 vars.

----------

## DaggyStyle

 *VoidMage wrote:*   

> I think the correct answer is "open a new terminal"
> 
> - that error comes up during preprocessing, not compiling,
> 
> so it's unlikely that ccache has anything to do with it.
> ...

 

well I went with the ccache because if I'm not mistaken, ccache uses parts that are precompiled already inorder to prevent unnecessary recompilation

that is why I've went this that, moreover, his emerge --info outputs state he uses gcc-4.3.2

----------

## VoidMage

Unless I'm missing something, ccache caches objects,

if the error happens during preprocessing, there's no objects.

----------

## ONEEYEMAN

Hi, guys,

I rebooted the machine and get the same error.

I am going to try DaggyStyle suggestion and come back...

Thank you.

----------

## ONEEYEMAN

No luck. Got the same error.

Any other suggestions?

Thank you.

----------

## John R. Graham

Post the output of

```
gcc-config -l
```

maybe?

- John

----------

## ONEEYEMAN

Hi, john,

```

[1] i686-pc-linux-gnu-4.1.1

[2] i686-pc-linux-gnu-4.3.2 [color=green]*[/color]

```

Thank you.

----------

## Mike Hunt

try 

```
gcc-config -f 2 && env-update && source /etc/profile
```

also you might want to put a MAKEOPTS="-j2" entry in your make.conf.  :Smile: 

----------

## ONEEYEMAN

Mike,

Nope, that didn't work either.

Anything else?

Thank you.

----------

## cwr

It's a known bug with the GCC 4.1.x compiler - I'm not sure how many patchlevels

it applies to.  If you google for the error message, there's a fair amount of stuff.

I'd be inclined just to comment out the test in the header file, build gcc 4.3.x with

gcc 4.1.x, and then re-instate the test and re-compile gcc 4.3 with itself.

Or get a working gcc from one of the Gentoo stage3 files, and use that to rebuild.

Will

----------

## ONEEYEMAN

cwr,

I'm not sure what you mean. I know that it's a bug with 4.1.x, but I have 4.3.2.

What test are you talking about? I got this while trying to compile "gentoo-sources-2.6.30". Are you saying I need to comment out this test? But then re-compiling gcc won't help...

I could try to get the gcc from the stage file, but I'd like to know what files I need to extract.

Or I might just install earlier kernel...

Thank you.

----------

## ONEEYEMAN

OK, this little mistery is solved, but I have another question in regards to this.

When upgrading gcc, I followed this:

```

http://www.gentoo.org/doc/en/gcc-upgrading.xml#doc_chap2

```

where it states in listing 2.2 to upgrade both "system" and "world" AND THEN remove older gcc version.

The problem is that when you install newer gcc the search path is added to the end of the $PATH env. variable, which means that when compiling gentoo-sources it first will look in old gcc include and then the new ones.

I just l;ooked at config.log from one of my "world" failures and that's how I solved it.

Now the question is: is it safe to finish the "world" upgrade, remove the old gcc and then upgrade the kernel.

I'm upgrading from gcc-4.1.1.

I guess I should've followed "Chapter 3" of this document...  :Wink: 

Also, I think I will have to rebuild "world" after un-merging old gcc verion...

Thank you.

----------

## John R. Graham

If the mystery is solved, please post how you solved it so that others may learn.    :Wink: 

- John

----------

## ONEEYEMAN

John,

When you install a system package that is slotted, it adds the include path for itself to the $PATH environment variable. Something like:

```

$PATH=$PATH:/usr/include/gcc-4.3.2

```

and it also add the library search path to the $LD_LIBRARY_PATH (not sure about this variable name):

```

$LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/gcc-4.3.2

```

However, the $PATH and $LD_LIBRARY_PATH already contain the old gcc-4.1.1 stuff and they goes before the new gcc stuff, which means when new gcc invokes to compile kernel/new clamav/something else it will issue the command similar to (pseudocode):

```

i686-pc-linux-gnu-4.3.2 $PATH *.o *.c

```

where $PATH is

```

$PATH=/usr/include/gcc-4.1.1:<somestuff>:/usr/include/gcc-4.3.2

```

and the first include path is for the gcc-4.1.1.

So to make the kernel to compile all I need is to uninstall gcc-4.1.1 and re-compile the kernel and all other stuff that won't compile because of that.

I will try that right now and post the results of it...

Thank you.

----------

