Kernel compile error on 9.1-RELEASE-p4

Hi,

I encountered an error when trying to compile a custom kernel. I've tried compiling using GENERIC and my custom configuration with different errors. The source is at revision 252359.

GENERIC
Code:
cc -c -O2 -frename-registers -pipe -fno-strict-aliasing  -std=c99 -g -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef -Wno-pointer-sign -fformat-extensions  -Wmissing-include-dirs -fdiagnostics-show-option   -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  -fno-omit-frame-pointer -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fstack-protector -Werror  /usr/src/sys/fs/nfsserver/nfs_nfsdport.c
cc1: warnings being treated as errors
/usr/src/sys/fs/nfsserver/nfs_nfsdport.c: In function 'nfsrv_sattr':
/usr/src/sys/fs/nfsserver/nfs_nfsdport.c:2313: warning: implicit declaration of function 'NFSGETTIME'
/usr/src/sys/fs/nfsserver/nfs_nfsdport.c:2313: warning: nested extern declaration of 'NFSGETTIME' [-Wnested-externs]
/usr/src/sys/fs/nfsserver/nfs_nfsdport.c: In function 'nfsv4_sattr':
/usr/src/sys/fs/nfsserver/nfs_nfsdport.c:2443: warning: passing argument 1 of 'nfsv4_strtouid' from incompatible pointer type
/usr/src/sys/fs/nfsserver/nfs_nfsdport.c:2443: warning: passing argument 2 of 'nfsv4_strtouid' makes pointer from integer without a cast
/usr/src/sys/fs/nfsserver/nfs_nfsdport.c:2443: warning: passing argument 3 of 'nfsv4_strtouid' makes integer from pointer without a cast
/usr/src/sys/fs/nfsserver/nfs_nfsdport.c:2443: warning: passing argument 4 of 'nfsv4_strtouid' from incompatible pointer type
/usr/src/sys/fs/nfsserver/nfs_nfsdport.c:2443: error: too few arguments to function 'nfsv4_strtouid'
/usr/src/sys/fs/nfsserver/nfs_nfsdport.c:2469: warning: passing argument 1 of 'nfsv4_strtogid' from incompatible pointer type
/usr/src/sys/fs/nfsserver/nfs_nfsdport.c:2469: warning: passing argument 2 of 'nfsv4_strtogid' makes pointer from integer without a cast
/usr/src/sys/fs/nfsserver/nfs_nfsdport.c:2469: warning: passing argument 3 of 'nfsv4_strtogid' makes integer from pointer without a cast
/usr/src/sys/fs/nfsserver/nfs_nfsdport.c:2469: warning: passing argument 4 of 'nfsv4_strtogid' from incompatible pointer type
/usr/src/sys/fs/nfsserver/nfs_nfsdport.c:2469: error: too few arguments to function 'nfsv4_strtogid'
*** [nfs_nfsdport.o] Error code 1

Stop in /usr/obj/usr/src/sys/GENERIC.
*** [buildkernel] Error code 1

Stop in /usr/src.
*** [buildkernel] Error code 1

Stop in /usr/src.


MYKERNEL
Code:
cc -c -O2 -frename-registers -pipe -fno-strict-aliasing  -std=c99 -g -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef -Wno-pointer-sign -fformat-extensions  -Wmissing-include-dirs -fdiagnostics-show-option   -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  -fno-omit-frame-pointer -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fstack-protector -Werror  /usr/src/sys/vm/vm_map.c
cc1: warnings being treated as errors
/usr/src/sys/vm/vm_map.c:731: warning: no previous prototype for 'vmspace_wired_count' [-Wmissing-prototypes]
*** [vm_map.o] Error code 1

Stop in /usr/obj/usr/src/sys/MYKERNEL.
*** [buildkernel] Error code 1

Stop in /usr/src.
*** [buildkernel] Error code 1

Stop in /usr/src.

Anything that I might have done wrong? I didn't encountered any problem on my other systems.

Thanks.
 
First of all, are you sure you didn't make any changes to your GENERIC kernel configuration file?

Maybe your previous builds are getting in the way. Run
Code:
# cd /usr/src
# chflags -R noschg /usr/obj/*
# rm -rf /usr/obj/*
# make clean cleanworld cleandir
# make cleandir
The # make cleandir is meant to be run twice, like I wrote. After that, try to build the kernel again, starting with the GENERIC kernel.
 
jozze said:
Code:
# cd /usr/src
# chflags -R noschg /usr/obj/*
# rm -rf /usr/obj/*

That's enough. The clean targets do the same thing only slower.

Actually, I just do # rm -rf /usr/obj/usr.
 
Hi, still on the same error for GENERIC kernel configuration even after the cleanup on the /usr/src. Nothing in /etc/make.conf.

Code:
# cd /usr/src
# chflags -R noschg /usr/obj/*
# rm -rf /usr/obj/*
# make clean cleanworld cleandir
# make cleandir

Code:
cc -c -O2 -frename-registers -pipe -fno-strict-aliasing  -std=c99 -g -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef -Wno-pointer-sign -fformat-extensions  -Wmissing-include-dirs -fdiagnostics-show-option   -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  -fno-omit-frame-pointer -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fstack-protector -Werror  /usr/src/sys/fs/nfsserver/nfs_nfsdport.c
cc1: warnings being treated as errors
/usr/src/sys/fs/nfsserver/nfs_nfsdport.c: In function 'nfsrv_sattr':
/usr/src/sys/fs/nfsserver/nfs_nfsdport.c:2313: warning: implicit declaration of function 'NFSGETTIME'
/usr/src/sys/fs/nfsserver/nfs_nfsdport.c:2313: warning: nested extern declaration of 'NFSGETTIME' [-Wnested-externs]
/usr/src/sys/fs/nfsserver/nfs_nfsdport.c: In function 'nfsv4_sattr':
/usr/src/sys/fs/nfsserver/nfs_nfsdport.c:2443: warning: passing argument 1 of 'nfsv4_strtouid' from incompatible pointer type
/usr/src/sys/fs/nfsserver/nfs_nfsdport.c:2443: warning: passing argument 2 of 'nfsv4_strtouid' makes pointer from integer without a cast
/usr/src/sys/fs/nfsserver/nfs_nfsdport.c:2443: warning: passing argument 3 of 'nfsv4_strtouid' makes integer from pointer without a cast
/usr/src/sys/fs/nfsserver/nfs_nfsdport.c:2443: warning: passing argument 4 of 'nfsv4_strtouid' from incompatible pointer type
/usr/src/sys/fs/nfsserver/nfs_nfsdport.c:2443: error: too few arguments to function 'nfsv4_strtouid'
/usr/src/sys/fs/nfsserver/nfs_nfsdport.c:2469: warning: passing argument 1 of 'nfsv4_strtogid' from incompatible pointer type
/usr/src/sys/fs/nfsserver/nfs_nfsdport.c:2469: warning: passing argument 2 of 'nfsv4_strtogid' makes pointer from integer without a cast
/usr/src/sys/fs/nfsserver/nfs_nfsdport.c:2469: warning: passing argument 3 of 'nfsv4_strtogid' makes integer from pointer without a cast
/usr/src/sys/fs/nfsserver/nfs_nfsdport.c:2469: warning: passing argument 4 of 'nfsv4_strtogid' from incompatible pointer type
/usr/src/sys/fs/nfsserver/nfs_nfsdport.c:2469: error: too few arguments to function 'nfsv4_strtogid'
*** [nfs_nfsdport.o] Error code 1

Stop in /usr/obj/usr/src/sys/GENERIC.
*** [buildkernel] Error code 1

Stop in /usr/src.
*** [buildkernel] Error code 1

Stop in /usr/src.

CPU type :
Code:
CPU: Intel(R) Xeon(R) CPU E31230 @ 3.20GHz (3209.42-MHz K8-class CPU)
  Origin = "GenuineIntel"  Id = 0x206a2  Family = 6  Model = 2a  Stepping = 2
  Features=0x1fe3fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT>
  Features2=0x9e982203<SSE3,PCLMULQDQ,SSSE3,CX16,SSE4.1,SSE4.2,POPCNT,AESNI,XSAVE,OSXSAVE,AVX,HV>
  AMD Features=0x28100800<SYSCALL,NX,RDTSCP,LM>
  AMD Features2=0x1<LAHF>
  TSC: P-state invariant

Any chance it could be related to http://www.scip.ch/en/?vuldb.8580?

Thanks.
 
What about /etc/src.conf? Do you have any settings there?

You can try to completely remove /usr/src and create again a fresh checkout with devel/subversion. Before you do that, don't forget to save your own custom kernel configuration file somewhere safe. After that you again run # rm -rf /usr/obj/* and retry the compilation.

As for that link you suggested: at the first glance it seems more like a security vulnerability than a bug that could affect the build process, however, I'm no expert and I could be wrong.
 
If you have a custom kernel config, put it in /root and make a soft link to it in /usr/src. Then it is somewhat safer from accidental deletion, and if /usr/src is removed, only the link needs to be recreated.
 
Hi, I believe there is a change on the source tree as the revision is different and the errors on both configs are at the same place /usr/src/sys/amd64/acpica/acpi_switch.S.

/etc/src.conf
Code:
cat /etc/src.conf
cat: /etc/src.conf: No such file or directory

/etc/make.conf
Code:
cat /etc/make.conf
cat: /etc/make.conf: No such file or directory

Previous source revision info
Code:
svn info /usr/src/
Path: /usr/src
Working Copy Root Path: /usr/src
URL: https://svn0.us-west.freebsd.org/base/stable/9
Repository Root: https://svn0.us-west.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: [file]252359[/file]
Node Kind: directory
Schedule: normal
Last Changed Author: jhb
Last Changed Rev: 252350
Last Changed Date: 2013-06-29 02:25:04 +0800 (Sat, 29 Jun 2013)

Removed object rm -rf /usr/obj/*.

Removed source rm -fr /usr/src/*.

Re-checkout source files svn co [url]https://svn0.us-west.freebsd.org/base/stable/9/[/url] /usr/src/.

Current source revision info
Code:
svn info /usr/src/
Path: /usr/src
Working Copy Root Path: /usr/src
URL: https://svn0.us-west.freebsd.org/base/stable/9
Repository Root: https://svn0.us-west.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: [file]252364[/file]
Node Kind: directory
Schedule: normal
Last Changed Author: jhb
Last Changed Rev: 252350
Last Changed Date: 2013-06-29 02:25:04 +0800 (Sat, 29 Jun 2013)

Compiled custom kernel config make buildkernel KERNCONF=MYKERNEL
Code:
cc -c -x assembler-with-cpp -DLOCORE -O2 -frename-registers -pipe -fno-strict-aliasing  -std=c99  -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef -Wno-pointer-sign -fformat-extensions  -Wmissing-include-dirs -fdiagnostics-show-option   -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  -fno-omit-frame-pointer -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fstack-protector  -Werror /usr/src/sys/amd64/acpica/acpi_switch.S
/usr/src/sys/amd64/acpica/acpi_switch.S: Assembler messages:
/usr/src/sys/amd64/acpica/acpi_switch.S:146: Error: no such instruction: `xsetbv'
/usr/src/sys/amd64/acpica/acpi_switch.S:147: Error: no such instruction: `xrstor (%rbx)'
*** [acpi_switch.o] Error code 1

Stop in /usr/obj/usr/src/sys/MYKERNEL.
*** [buildkernel] Error code 1

Stop in /usr/src.
*** [buildkernel] Error code 1

Stop in /usr/src.

Removed object rm -rf /usr/obj/*

Compiled kernel with generic config make buildkernel KERNCONF=GENERIC
Code:
cc -c -x assembler-with-cpp -DLOCORE -O2 -frename-registers -pipe -fno-strict-aliasing  -std=c99 -g -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef -Wno-pointer-sign -fformat-extensions  -Wmissing-include-dirs -fdiagnostics-show-option   -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  -fno-omit-frame-pointer -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fstack-protector  -Werror /usr/src/sys/amd64/acpica/acpi_switch.S
/usr/src/sys/amd64/acpica/acpi_switch.S: Assembler messages:
/usr/src/sys/amd64/acpica/acpi_switch.S:146: Error: no such instruction: `xsetbv'
/usr/src/sys/amd64/acpica/acpi_switch.S:147: Error: no such instruction: `xrstor (%rbx)'
*** [acpi_switch.o] Error code 1

Stop in /usr/obj/usr/src/sys/GENERIC.
*** [buildkernel] Error code 1

Stop in /usr/src.
*** [buildkernel] Error code 1

Stop in /usr/src.

I guess I might just wait a[ ]bit before recompiling since there are still changes on the source.

Thanks.
 
When you update source to newer than what is currently installed, a buildworld has to be done before trying to build a new kernel. That gets a toolchain with the necessary features in place.
 
More specifically if you don't do make buildworld first, the kernel compilation will try to use the header files from /usr/include instead of the new headers that come with the updated source. So, always do make buildworld first, or at least make kernel-toolchain, when you have updated sources and want to compile a new kernel.
 
Hi all, thanks for all the effort to troubleshoot this matter. I did a new clean install including ports and src.

I compiled and installed my initial custom kernel, updated src via SVN, make buildworld, compiled and installed a new kernel based on the updated source, reboot and make installworld.

Now I guess all are in good hands.

Thank you all again for the excellent assistance.
 
Just to be sure, don't forget to run the # mergemaster command if you haven't done it yet. The # make installworld should be issued like this:
Code:
# mergemaster -p
# cd /usr/src && make installworld
# mergemaster
See the Handbook in case you don't know about this.
 
Back
Top