# FreeBSD-8.1-RELEASE: kernel compile error



## spam (Sep 19, 2010)

```
#csup /usr/share/examples/cvsup/stable-supfile
#make buildkernel KERNCONF=MYKERNEL02
```
csup actually updated nothing 2 or 3 days ago.

after adding

```
options		IPFIREWALL_NAT
options		IPFIREWALL_FORWARD
device		speaker
```
to my old kernel configuration (all included in attach) compile-time error


```
cc -shared -nostdlib hack.c -o hack.So
rm -f hack.c
MAKE=make sh /usr/src/sys/conf/newvers.sh MYKERNEL02
cc -c -O -pipe -march=pentium3 -std=c99 -g -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -
Winline -Wcast-qual  -Wundef -Wno-pointer-sign -fformat-extensions -nostdinc  -I. -I/usr/src/sys -I/usr/src/sys/contrib/altq -D_KERNEL -
DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common -finline-limit=8000 --param inline-unit-growth=100 --param large-function-
growth=1000  -mno-align-long-strings -mpreferred-stack-boundary=2  -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -ffreestanding -fstack-
protector -Werror  vers.c
linking kernel.debug
ip_fw_nat.o(.text+0x434): In function `del_redir_spool_cfg':
/usr/src/sys/netinet/ipfw/ip_fw_nat.c:123: undefined reference to `LibAliasRedirectDelete'
ip_fw_nat.o(.text+0x694): In function `ipfw_nat_modevent':
/usr/src/sys/netinet/ipfw/ip_fw_nat.c:560: undefined reference to `LibAliasUninit'
ip_fw_nat.o(.text+0x799):/usr/src/sys/netinet/ipfw/ip_fw_nat.c:560: undefined reference to `LibAliasUninit'
ip_fw_nat.o(.text+0x8f7): In function `ipfw_nat_cfg':
/usr/src/sys/netinet/ipfw/ip_fw_nat.c:372: undefined reference to `LibAliasInit'
ip_fw_nat.o(.text+0xa33):/usr/src/sys/netinet/ipfw/ip_fw_nat.c:399: undefined re
ip_fw_nat.o(.text+0xa48):/usr/src/sys/netinet/ipfw/ip_fw_nat.c:400: undefined re
ip_fw_nat.o(.text+0xb68):/usr/src/sys/netinet/ipfw/ip_fw_nat.c:158: undefined re
ip_fw_nat.o(.text+0xc24):/usr/src/sys/netinet/ipfw/ip_fw_nat.c:167: undefined re
ip_fw_nat.o(.text+0xc7c):/usr/src/sys/netinet/ipfw/ip_fw_nat.c:178: undefined re
ip_fw_nat.o(.text+0xd54):/usr/src/sys/netinet/ipfw/ip_fw_nat.c:193: undefined re
ip_fw_nat.o(.text+0xf3d): In function `ifaddr_change':
/usr/src/sys/netinet/ipfw/ip_fw_nat.c:80: undefined reference to `LibAliasSetAdd
ip_fw_nat.o(.text+0x1151): In function `ipfw_nat_del':
/usr/src/sys/netinet/ipfw/ip_fw_nat.c:436: undefined reference to `LibAliasUnini
ip_fw_nat.o(.text+0x1197): In function `ipfw_nat':
/usr/src/sys/netinet/ipfw/ip_fw_nat.c:216: undefined reference to `m_megapullup'
ip_fw_nat.o(.text+0x123e):/usr/src/sys/netinet/ipfw/ip_fw_nat.c:261: undefined r
ip_fw_nat.o(.text+0x129d):/usr/src/sys/netinet/ipfw/ip_fw_nat.c:264: undefined r
*** Error code 1

Stop in /usr/obj/usr/src/sys/MYKERNEL02.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.
```

inb4 make.conf - it contain one string: CPUTYPE=pentium3

is it my mistake by any chance?

// compiling here takes 3+ hours, can't really test much.
// MYKERNEL01 compiles fine.

also, it seems kernel nat isn't working (after kldload ipfw_nat.ko), but here two bug reports already
kern/149572
kern/150141
surprisingly, second not even marked as critical.


----------



## DutchDaemon (Sep 19, 2010)

You're not supposed to build the kernel _separately_ after fetching new sources. You can only build a new kernel when the userland is built from the same new source tree. So before building a new kernel from new sources, build the new world first. See /usr/src/Makefile for the proper order.


----------



## spam (Sep 19, 2010)

buildworld was done before, just indicating it latest -RELEASE.

it looks like i've found problem source, ~2h till compiling done, but i miss

```
options LIBALIAS
required by IPFIREWALL_NAT
```

actually it documentation related problem.
google: options LIBALIAS @freebsd.org
very sad, ten years ago FreeBSD had best documentation and now...

what purpose of 6.X branch in handbook?
handbook: kernelconfig

not only handbook outdated,
/usr/src/sys/i386/conf/NOTES
mostly useless.

spent some time unpacking /usr/src from my FreeBSD 2.1.7 1997 cd...
/usr/sys/i386/conf/files.i386
contain all i need to enable sound in kernel and now, in 2010 /usr/src/sys/i386/conf/XBOX have single, useless sound device name, handbook: kernelconfig - deaf. it's like everywhere. is it possible to find "IPFIREWALL_NAT" in man ipfw? no, but example of use - yes.
nice :x


----------



## spam (Sep 19, 2010)

solved


----------



## phoenix (Sep 20, 2010)

Since 5.0, the canonical documentation for kernel config file options has been /usr/src/sys/conf/NOTES and /usr/src/<architecture>/conf/NOTES (where <architecture> is your CPU architecture, ie i386 for 32-bit x86 installs and amd64 for 64-bit x86 installs).  Everything is covered in those two files.

If you want an old-style (4.x-style) LINT file, you can run: `# make LINT`
But that strips out a lot of the comments.

However, one does not need to recompile the kernel to enable in-kernel NAT support in FreeBSD.  Just load the kernel modules, either manually via kldstat() or by adding entries to /boot/loader.conf.  The needed modules are:  *ipfw, ipfw_nat,  libalias* with *ipdivert* being optional if you need "ipfw divert" rules.


----------

