Kernel compilation errors with GCC 4.0
Craig Rodrigues
rodrigc at crodrigues.org
Mon May 23 20:46:15 PDT 2005
Hi,
There was recent mention here:
http://lists.freebsd.org/pipermail/freebsd-current/2005-April/049165.html
by Kirill Ponomarew that GCC 4.0 would be a good thing to look
at for inclusion in the base FreeBSD system.
Just out of curiousity, I tried to compile a GENERIC kernel from
-CURRENT, and wanted to see how many things would break (because
knowing GCC, I knew things would break :).
I used the following compiler from ports:
gcc version 4.0.1 20050423 (prerelease) [FreeBSD]
The pruned down results of what I got are
Approx. 70 errors:
http://people.freebsd.org/~rodrigc/gcc4.0_fbsdkernel_errors.txt
Approx. 2700 warnings, converted to errors by -Werror:
http://people.freebsd.org/~rodrigc/gcc4.0_fbsdkernel_warnings.txt
I found a few changes in compiler flags with gcc 4.0:
(1) The compiler complains that "-I-" is deprecated and that you should use
"-iquote DIR" instead. I changed it in src/sys/conf/kern.pre.mk
(2) "-mno-align-long-strings" seems to be gone and gives an error if you use
it. I commented it out of src/sys/conf/kern.mk
(3) "-fformat-extensions" is a FreeBSD extension that is
in the FreeBSD system gcc compiler, but not the FSF/ports gcc compiler.
I commented it out of /usr/share/mk/bsd.kern.mk
There were a lot of warnings (especially in the CAM layer, but in
other places too) of the type:
/usr/src/sys/cam/cam_periph.c:640: warning: pointer targets in assignment differ in signedness
I don't know if these are legitimate things that should be addressed,
or if GCC 4.0 is being needlessly pedantic.
I did not bother to try to compile any FreeBSD userland or ports.
>From what I can tell, a lot of things break with GCC 4.0, so I
can't tell if it performs better than GCC 3.4 or not.
--
Craig Rodrigues
rodrigc at crodrigues.org
More information about the freebsd-current
mailing list