# Building Custom Kernel -> fatal error: too many errors emitted, stopping now [-ferror-limit=]



## yth (Aug 29, 2018)

Hello,

I am attempting to creating a custom kernel as a learning experience.

Per instruction from the Handbook, I copied the GENERIC file. I made some minimum amount of edits since what I really wanted to do was the go through the kernel compilation and installation steps. I was prepared for the process to create a badly made kernel and that I would have to roll back to the original version. However, I got an unexpected type of error.

The compilation was killed off due to reaching -ferror-limit. I am not sure what I can do to solve this problem.

`uname -v
FreeBSD 11.2-RELEASE #0 r335510: Fri Jun 22 04:32:14 UTC 2018     root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC`

This is a fresh installation on a T4X0.

Any tip/advice welcome.


----------



## ShelLuser (Aug 29, 2018)

Can you paste the exact error message? Or the changes you made to the config? Because this isn't really much to go on.

I'd start by trying to build a GENERIC kernel, see how that fares. Once that works you can always apply changes.

By the way; copying the generic file is kind of pointless, it's easier to create a new config file, include the one you want to base yourself on and then apply changes (either by adding or overruling stuff):

For example:


```
include GENERIC
ident ZEFIRIS

nooptions       QUOTA
nooptions       GEOM_RAID
nooptions       INCLUDE_CONFIG_FILE

# Floppy
nodevice        fdc
```


----------



## yth (Aug 30, 2018)

Thanks for the suggestions.
I didn't make any change to any config beyond making my system accept root login from ssh, other than the kernel configuration file.

I was able to successfully build the kernel from GENERIC. That gave me the idea to test which of the options triggered the cascade of errors. I was able to narrow it down to one, COMPAT_FREEBSD7. I believe I have all of the errors generated and their exact message in the attached file.


----------



## ShelLuser (Aug 30, 2018)

Well, not all options can be safely disabled while building a kernel (or the base system). I don't have first hand experience, but I can well imagine that if you'd find yourself in a heap of trouble if you remove certain compatibility options.

Don't forget that FreeBSD is a pretty old operating system which means that plenty of its source code could be years old. Which means that it also could easily depend on some kind of backwards compatibility. Leave that out and you'd run into problems.

Do note that this is just a theory of mine, but based on hands on experience with other options: some options simply can't be disabled without running into problems. And therefor I suspect that this is one of those.

So the solution would be not to disable COMPAT_FREEBSD7. Quite frankly I'd never try to disable any of the compatibility options. There's no real need and the risk of ending up with an incompatible system is quite high.


----------



## kpa (Aug 30, 2018)

If you disable comptibility options you better unset all of them. There might be some hidden dependencies between the different options. Otherwise it's completely ok to disable them because the only time you need them is when running older binary only software.


----------



## yth (Aug 30, 2018)

That's really good advice. I turned off COMPAT_FREEBSD4-10 and buildkernel worked.

I read that COMPAT_FREEBSD32 should not be turned off to be compatible with 32 bit software. Is this also just for binary compatibility (i.e. if I compile all the software I use I wouldn't need it)?


----------



## SirDice (Aug 31, 2018)

You can remove FREEBSD_COMPAT7 but you will also need to remove FREEBSD_COMPAT6, all the lower numbers.

It basically works like this:

```
FREEBSD_COMPAT(N)
FREEBSD_COMPAT(N-1)
FREEBSD_COMPAT(N-2)
```
(N-2) depends on (N-1), (N-1) depends on (N).



yth said:


> I read that COMPAT_FREEBSD32 should not be turned off to be compatible with 32 bit software. Is this also just for binary compatibility (i.e. if I compile all the software I use I wouldn't need it)?


Correct, it's for 32 bit _binary_ compatibility. If everything you have installed is specifically compiled for 64 bit you won't need it.


----------



## kpa (Aug 31, 2018)

I think there's one oddball case and that's the 64-bit version of WINE that actually needs the 32-bit compatibility layer to work.


----------



## SirDice (Aug 31, 2018)

I typically just leave it in, I do remove the FREEBSD_COMPAT(N) compatibility because I really have no need for them but the FREEBSD_COMPAT32 I keep. I don't think it's a lot of code so it's not going to make a major difference if you left it in.


----------



## yth (Sep 1, 2018)

Thanks for all the explanation and the great advice!


----------

