# cc: error: unknown argument: '-fformat-extensions' when building kernel



## kareem33 (Oct 11, 2020)

Hello.
I want to build custom kernel (which should include drivers for my WiFi USB adapter).
When I try to run:

make buildkernel KERNCONF=MYKERNEL

it stops with error:

cc: error: unknown argument: '-fformat-extensions'

Could anybody help me?
My custom kernel config and session output in attachement.

It is FreeBSD 12.1 on amd64.


----------



## SirDice (Oct 12, 2020)

kareem33 said:


> which should include drivers for my WiFi USB adapter


Most common Wifi drivers are already included in GENERIC. There's rarely a need to build a custom kernel. And those that aren't built-in can easily be dynamically loaded.


----------



## kareem33 (Oct 12, 2020)

Hello.
These are rtwn and rtwn_usb. I'm new to FreeBSD (but experienced user of other unix-like systems) - but according to my findings, these aren't included by default.


----------



## Mjölnir (Oct 12, 2020)

You can load most kernel modules at boot with e.g. `sysrc kld_list+=" rtwn"` (this adds it to rc.conf(5), note the space), or add `if_rtwn_usb_load="YES"` to loader.conf(5).  The general guideline is to only load vital kernel modules in loader.conf(5), i.e. those that are needed to access the root filesystem or provide other features needed to boot, and load all other kernel modules via `kld_list` in rc.conf[.local].  To load at runtime (i.e. now), use `kldload rtwn_usb`.  Very few modules can only be loaded via `xyz_load="YES"` in loader.conf(5), these are obviously exceptions to that rule.


----------



## kareem33 (Oct 12, 2020)

Thanks.
Now modules seem to be loaded correctly, but still I cannot connect... I've created new post in proper section regarding this...


----------

