Error compiling kernel with gcc46

Hello, I'm trying to compile my kernel with Dtrace support enabled. I'm using gcc46 as the default compiler. The full command is # make buildkernel KERNCONF=cat_kernel WITH_CTF=1. But as soon as the build process starts I get this error :
Code:
--------------------------------------------------------------
>>> stage 2.3: build tools
--------------------------------------------------------------
cd /usr/obj/usr/src/sys/cat_kernel;  MAKESRCPATH=/usr/src/sys/dev/aic7xxx/aicasm  make SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF  -f 
/usr/src/sys/dev/aic7xxx/aicasm/Makefile
Warning: Object directory not changed from original /usr/obj/usr/src/sys/cat_kernel
gcc46 -O2 -pipe -nostdinc -I/usr/include -I. -I/usr/src/sys/dev/aic7xxx/aicasm -std=gnu99  -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -
Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-
align -Wunused-parameter -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wno-pointer-sign -c 
/usr/src/sys/dev/aic7xxx/aicasm/aicasm.c
gcc46: not found
*** Error code 127

I have these settings in /etc/make.conf :
Code:
# added by use.perl 2010-12-31 21:42:54
PERL_VERSION=5.10.1
.if !empty(.CURDIR:M/usr/ports/*) && exists(/usr/local/bin/gcc46)
CC=gcc46
CXX=g++46
CPP=cpp46
CFLAGS+=-msse2
.endif

It looks like gcc46 fails to find something but I don't know what. Can someone help me please ?
 
If you're trying to use a non-standard compiler to compile the base you're pretty much on your own.

Remove all the CC and related flags and try again.
 
clang is experimentally used in -CURRENT (FreeBSD 9).

Remove /usr/obj and run a [cmd=]make cleanworld && make cleandir[/cmd] in /usr/src to be thorough. Make sure there are no symlinks or aliases expanding gcc to the wrong (non-base) compilers.
 
If it's the same error it means it's still trying to use gcc46 instead of the default.

Try removing lang/gcc46 and see if it switches back.
 
I haven't tried with base GCC, I wanted to use a more recent compiler, since the handbook said that it's possible to gain something like 10% more performance with recent compilers. I'll try with GCC4.2 and see if it works.
 
Where in The Handbook does it say that? I'm pretty sure that The Handbook does not suggest anywhere that one should use anything other than the base system compilers for building the kernel and world.
 
adihodos, the title of that article is "Using newer version of GCC and binutils with the FreeBSD Ports Collection". And even there it is a gigantic minefield. But absolutely, positively: keep it away from the base system!
 
Just for the record - I've successfully compiled kernel (9.0-CURRENT, about six months ago) with GCC 4.5 with this in /etc/make.conf:

C
Code:
C=            /usr/local/bin/gcc45
CXX=           /usr/local/bin/g++45
CWARNFLAGS=    -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
               -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \
               -Wno-pointer-sign -D__FreeBSD_cc_version=0 \
               -Wno-unused-function -Wno-inline -Wno-format \
               -Wno-uninitialized -Wno-array-bounds -Wno-missing-prototypes
NO_WERROR=    1
 
Let's not take that as an encouragement .. we have enough problems to solve around here ;)

This may be a nice experiment in a developer environment (e.g. the FreeBSD mailing lists), but I truly hope not to see the forums flooded with people demolishing their systems using uninformed flags and ill-understood compiler options (simply copied without understanding them) and complaining that 'a developer said it would work'.

If anyone does demolish their systems doing this: don't complain on these forums. Please stick to the base system compilers.
 
If you encounter any problems, go to the FreeBSD dev mailing lists .... because you'll get the predictable reply here: "Use the base system compilers." ..
 
just to assure people who curious to use what Me trasz suggest, it will not work with FreeBSD 8.1 STABLE either with gcc44 or gcc45.
If you encounter any problems, go to the FreeBSD dev mailing lists .... because you'll get the predictable reply here: "Use the base system compilers." ..
I am still have problem memory usage with recent gnome and you expect me ask question like this, at least when I fix my problem :D.
 
adihodos said:
gcc46: not found
*** Error code 127
You can remove PATH overriding from src/Makefile
Code:
PATH=  /sbin:/bin:/usr/sbin:/usr/bin
It's unlikely to break build as /usr/local/bin is after /usr/bin in PATH by default, so it'll not pick wrong binutils by accident.

trasz' example is boring because it excludes one from using ccache/distcc and other creative PATH tricks. And using CC=/usr/local/libexec/ccache/gcc46 won't work, guess why?
 
Back
Top