Solved Cannot compile kernel

I recently updated from 10.3 to 11.0. The system seems to work fine, but I have one problem: When I try to compile a kernel with make buildkernel it stops with the following error:
Code:
MAKE=make sh /usr/src/sys/conf/newvers.sh GENERIC
cc  -c -O2 -pipe -fno-strict-aliasing  -g -nostdinc  -I. -I/usr/src/sys -I/usr/src/sys/contrib/libfdt -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h  -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer  -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -gdwarf-2 -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  -Wno-unknown-pragmas  -Wno-error-tautological-compare -Wno-error-empty-body  -Wno-error-parentheses-equality -Wno-error-unused-function  -Wno-error-pointer-sign  -mno-aes -mno-avx  -std=iso9899:1999 -Werror  vers.c
ctfconvert -L VERSION -g vers.o
linking kernel.full
random_infra.o:(.data+0xb0): undefined reference to `random_alg_context'
kern_mib.o: In function `sysctl_kern_arnd':
/usr/src/sys/kern/kern_mib.c:164: undefined reference to `read_random'
arc4random.o: In function `arc4_randomstir':
/usr/src/sys/libkern/arc4random.c:61: undefined reference to `read_random'
sctp_auth.o: In function `sctp_generate_random_key':
/usr/src/sys/netinet/sctp_auth.c:326: undefined reference to `read_random'
sctp_auth.o: In function `sctp_initialize_auth_params':
/usr/src/sys/netinet/sctp_auth.c:1997: undefined reference to `read_random'
sctp_output.o: In function `sctp_send_initiate_ack':
/usr/src/sys/netinet/sctp_output.c:6017: undefined reference to `read_random'
sctp_pcb.o:/usr/src/sys/netinet/sctp_pcb.c:2620: more undefined references to `read_random' follow
ivy.o: In function `rdrand_modevent':
/usr/src/sys/dev/random/ivy.c:115: undefined reference to `random_source_deregister'
/usr/src/sys/dev/random/ivy.c:108: undefined reference to `random_source_register'
nehemiah.o: In function `nehemiah_modevent':
/usr/src/sys/dev/random/nehemiah.c:136: undefined reference to `random_source_deregister'
/usr/src/sys/dev/random/nehemiah.c:127: undefined reference to `random_source_register'
*** Error code 1

Stop.
make[2]: stopped in /usr/obj/usr/src/sys/GENERIC
*** Error code 1

Stop.
make[1]: stopped in /usr/src
*** Error code 1

Stop.
make: stopped in /usr/src

If it helps this is the resul of uname -a
Code:
FreeBSD nas 11.0-RELEASE-p8 FreeBSD 11.0-RELEASE-p8 #0: Wed Feb 22 06:12:04 UTC 2017     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

Can someone tell me why this happens and what I did wrong?
 
Is there anything in /etc/make.conf and/or /etc/src.conf?
 
Ok, that's good. New users tend to try to "optimize" things and usually end up making things worse. Did you install the source during installation and updated it with freebsd-update(8)? Or did you use SVN to fetch the source?
 
Another important detail (just mentioning this to cover all grounds): I can see you're trying to compile a GENERIC kernel configuration, can we also assume that you didn't make changes to /usr/src/sys/amd64/conf/GENERIC?

Have you ever compiled a kernel (or the whole OS) before? I can't help wonder if there might have been left overs in /usr/obj which could (theoretically!) have interfered here. If you're sure there wasn't then you can ignore this message, otherwise here's what I would do:
  • Make sure you have the latest version of the source code. When in doubt clear out /usr/src (don't forget about possible hidden files) and then # svn co http://svn.freebsd.org/base/releng/11.0 /usr/src.
    • From there on use # svn update to update your source tree.
    • Also don't forget to remove this section (world/src) from /etc/freebsd-update.conf (if you're actually using this).
  • Make sure to clear out /usr/obj before compiling your stuff.
  • In general: always make sure never to edit existing GENERIC files; always add a new file and reference GENERIC or copy the file and then make changes (just mentioning this to rule it out).
Hope this can also help.
 
I recently updated from 10.3 to 11.0. The system seems to work fine, but I have one problem: When I try to compile a kernel with make buildkernel it stops with the following error:
Code:
MAKE=make sh /usr/src/sys/conf/newvers.sh GENERIC
cc  -c -O2 -pipe -fno-strict-aliasing  -g -nostdinc  -I. -I/usr/src/sys -I/usr/src/sys/contrib/libfdt -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h  -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer  -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -gdwarf-2 -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  -Wno-unknown-pragmas  -Wno-error-tautological-compare -Wno-error-empty-body  -Wno-error-parentheses-equality -Wno-error-unused-function  -Wno-error-pointer-sign  -mno-aes -mno-avx  -std=iso9899:1999 -Werror  vers.c
ctfconvert -L VERSION -g vers.o
linking kernel.full
random_infra.o:(.data+0xb0): undefined reference to `random_alg_context'
kern_mib.o: In function `sysctl_kern_arnd':
/usr/src/sys/kern/kern_mib.c:164: undefined reference to `read_random'
arc4random.o: In function `arc4_randomstir':
/usr/src/sys/libkern/arc4random.c:61: undefined reference to `read_random'
sctp_auth.o: In function `sctp_generate_random_key':
/usr/src/sys/netinet/sctp_auth.c:326: undefined reference to `read_random'
sctp_auth.o: In function `sctp_initialize_auth_params':
/usr/src/sys/netinet/sctp_auth.c:1997: undefined reference to `read_random'
sctp_output.o: In function `sctp_send_initiate_ack':
/usr/src/sys/netinet/sctp_output.c:6017: undefined reference to `read_random'
sctp_pcb.o:/usr/src/sys/netinet/sctp_pcb.c:2620: more undefined references to `read_random' follow
ivy.o: In function `rdrand_modevent':
/usr/src/sys/dev/random/ivy.c:115: undefined reference to `random_source_deregister'
/usr/src/sys/dev/random/ivy.c:108: undefined reference to `random_source_register'
nehemiah.o: In function `nehemiah_modevent':
/usr/src/sys/dev/random/nehemiah.c:136: undefined reference to `random_source_deregister'
/usr/src/sys/dev/random/nehemiah.c:127: undefined reference to `random_source_register'
*** Error code 1

Stop.
make[2]: stopped in /usr/obj/usr/src/sys/GENERIC
*** Error code 1

Stop.
make[1]: stopped in /usr/src
*** Error code 1

Stop.
make: stopped in /usr/src

If it helps this is the resul of uname -a
Code:
FreeBSD nas 11.0-RELEASE-p8 FreeBSD 11.0-RELEASE-p8 #0: Wed Feb 22 06:12:04 UTC 2017     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

Can someone tell me why this happens and what I did wrong?


At least in my case, was a dependency from one driver (that i' remove from kernel file)
i always copy the GENERIC file to another like JS

but,i search the undefined reference and i found this

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=201451

is marked as FIXED,so..good luck
 
Back
Top