# Compiler options for kernel?



## YuryG (Aug 24, 2015)

I am on FreeBSD-10.2 now. I see there are options for an old gcc staying in the /usr/src to be compiled into the base system. But if I try to compile kernel with that old base gcc, I get warnings-that-errors. So, the question is: where can I set compiler (warning-errors) option for trying compiling kernel/ world? 
	
	



```
CFLAGS+=-fms-extensions
```
 in /etc/src.conf are not working, as I get.
Not as production, but as a try.


----------



## protocelt (Aug 25, 2015)

Could you post what you have set in your /etc/make.conf and /etc/src.conf files if anything? As far as I know, while I don't use it, All current supported releases of FreeBSD should build with GCC from base still.


----------



## YuryG (Aug 25, 2015)

protocelt said:


> Could you post what you have set in your /etc/make.conf and /etc/src.conf files if anything? As far as I know, while I don't use it, All current supported releases of FreeBSD should build with GCC from base still.


Well, I'm on FreeBSD 10.2-STABLE #11 r287102M and trying to compile it, I get at least these errors:
	
	



```
/usr/src/sys/dev/drm2/drm_lock.c drm_notifier commented     - unused declaration
/usr/src/sys/dev/drm2/radeon_acpi.c radeon_pm_acpi_event_handler commented   - redundant declaration
/usr/src/sys/dev/hyperv/vmbus/hv_channel_mgmt.c vmbus_select_outgoing_channel commented   - redundant declaration
/usr/src/sys/dev/hyperv/netvsc/hv_rndis.h      - declaration does not declare anything (unnamed union! not comply with standard)
/usr/src/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c and /usr/src/sys/dev/hyperv/netvsc/hv_rndis_filter.c    - 'rndis_tcp_ip_csum_info', 'rndis_tcp_tso_info' related to previous
/usr/src/sys/dev/sfxge/common/siena_flash.h     - declares nothing (unnamed union) 'siena_mc_combo_rom_hdr_t'
```
My /etc/make.conf:
	
	



```
MAKE_IDEA=yes
WITH_PKGNG=yes
WITHOUT_NOUVEAU="yes"
OPTIONS_SET=GALLIUM      #  new variant
WITH_NEW_MESA="YES"
WITH_OPENSSL_BASE=yes
QT4_OPTIONS=CUPS QGTKSTYLE
DEFAULT_VERSIONS= ruby=2.1 tcltk=8.6 python2=2.7 lua=5.3 perl5=5.20 python3=3.4 mysql=5.6
WITH_BDB_VER=6
```
And my /etc/src.conf:
	
	



```
CPUTYPE=amdfam10
WITH_GCC=yes
WITH_GNUCXX=yes
CC=gcc
CXX=g++
CPP=cpp
#WITHOUT_HYPERV="yes"
```


----------



## protocelt (Aug 25, 2015)

Did you want to use GCC for everything, the base system as well as ports? If so you might try using a newer version of GCC from ports. Right now lang/gcc is at version 4.8.5 and you may get a better resulting build trying that.

Anyway if you'd like to go that route, try a build with these settings in /etc/make.conf and remove what you have in /etc/src.conf as using /etc/make.conf is sufficient by itself.

```
CPUTYPE?=native
CC=gcc48
Cxx=c++48
CPP=cpp48
MAKE_IDEA=yes
WITH_PKGNG=yes
WITHOUT_NOUVEAU="yes"
OPTIONS_SET=GALLIUM # new variant
WITH_NEW_MESA="YES"
WITH_OPENSSL_BASE=yes
QT4_OPTIONS=CUPS QGTKSTYLE
DEFAULT_VERSIONS= ruby=2.1 tcltk=8.6 python2=2.7 lua=5.3 perl5=5.20 python3=3.4 mysql=5.6
WITH_BDB_VER=6
```
Also if I remember correctly, there a couple of ports, which I can't remember off hand, that don't play well with databases/bdb6.

Just out of curiosity, if you don't mind me asking, what is the reason you have for going with GCC as clang(1) works quite well?


----------



## YuryG (Aug 25, 2015)

protocelt said:


> Did you want to use GCC for everything, the base system as well as ports? If so you might try using a newer version of GCC from ports. Right now lang/gcc is at version 4.8.5 and you may get a better resulting build trying that.
> <…>
> Just out of curiosity, if you don't mind me asking, what is the reason you have for going with GCC as clang(1) works quite well?


Yes, "for everything" (that is for ports) I try to use lang/gcc48. Not all ports are good with it out of the box, although.

And world/ kernel are not good at all  Too many warnings-errors. So, I tried older and more "native" for FreeBSD base GCC.

I've tried clang and for some of my test it was not as good as GCC. And the latter is more used and has much longer history (and so, more documented). And since I'm not concerned with licenses… That made my belief in GCC .


----------



## wblock@ (Aug 25, 2015)

Using a non-default compiler is almost guaranteed to produce mysterious problems and difficulties.

I would remove the obsolete WITHOUT_NOUVEAU line from make.conf.  Probably also the WITH_NEW_MESA line.


----------



## wisdown (Aug 27, 2015)

I am curious, for rebuild the system without CLANG adding on src.conf the value:


```
WITHOUT_CLANG_IS_CC
```

And then doing an:

`make buildworld`

Is not enough?

By the way, on my my tests, java from ports does not compile well with GCC on FreeBSD 10+.


----------



## wblock@ (Aug 27, 2015)

To make a difference, `make installworld` must be run after building the world.


----------

