# How could I add gcc compiler at build world or build kernel stage ??



## unto (Dec 22, 2017)

How could I add gcc compiler at buildworld or buildkernel stage ??
which Makefile I can set this up.

thanks.


----------



## Maelstorm (Dec 23, 2017)

I believe in /etc/make.conf you can add this line:


```
CC=gcc
```

Or something to that effect.  I personally haven't tried it though.


----------



## unto (Dec 24, 2017)

I think  in /etc/make.conf ,CC=gcc is for something like port compiler.
those were after the system was installed.
I also not mean to build system with gcc tool.
I need at system building stage to include gcc tool.




Maelstorm said:


> I believe in /etc/make.conf you can add this line:
> 
> 
> ```
> ...


----------



## Maelstorm (Dec 26, 2017)

Yeah, Ok.  I read about something in the manual pages that might be of interest to you.  Take a look at make.conf(5).  A quote from the man page as follows:


```
PORTS_MODULES
          Set this to the list    of ports you wish to rebuild every
          time    the kernel is built.
```

Hopefully that helps you.


----------



## ShelLuser (Dec 26, 2017)

unto said:


> How could I add gcc compiler at buildworld or buildkernel stage ??
> which Makefile I can set this up.


I have a hard time understand what you mean here.

If you want to build GCC and make it part of your base system you'd normally set the option WITH_GCC in /etc/src.conf, see also src.conf(5).


----------



## unto (Dec 27, 2017)

thanks  help,I will try it later and report later.


----------



## SirDice (Dec 27, 2017)

```
20130906:
        The GNU Compiler Collection and C++ standard library (libstdc++)
        are no longer built by default on platforms where clang is the system
        compiler.  You can enable them with the WITH_GCC and WITH_GNUCXX
        options in src.conf.
```
See /usr/src/UPDATING.


----------



## unto (Jan 5, 2018)

I added src.conf with  WITH_GCC=yes and WITH_GNUCXX=yes
after build and install kernel,finally I got gcc build in.
Thanks help.



SirDice said:


> ```
> 20130906:
> The GNU Compiler Collection and C++ standard library (libstdc++)
> are no longer built by default on platforms where clang is the system
> ...


----------

