Unable to build generic kernel. All methods generate errors.

Hello,

Still learning the ins and outs of FreeBSD, so please keep that in mind. :-) I'm happy to read whatever manual that might help with this, but my searches have not turned up anything that is helpful.

I have a server at home running FreeBSD 12.1-RELEASE-p3 GENERIC amd64. It is mainly just ZFS storage at the moment.

I wanted to use an external USB LG Blu-ray player (model BE14NU40). I was interested in using multimedia/makemkv. Based on the port requirements, in order to have it recognized by FreeBSD I need to build a custom kernel with the
Code:
device sg
in a custom kernel:

A custom FreeBSD kernel with sg devices (Linux' "scsi generic" interface) is required to use makemkvcon. To build such a kernel, add "device sg" to your kernel configuration

I followed the steps laid out at https://www.freebsd.org/doc/handbook/kernelconfig-building.html. I created a duplicate kernel file and edited that to add device sg at the end.

Code:
cd /usr/src/sys/amd64/conf
cp GENERIC MYKERNEL
cd /usr/src
make buildkernel KERNCONF=MYKERNEL

When I attempt to build the kernel it fails with the following error:

Code:
cc -target x86_64-unknown-freebsd12.1 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin -c -O3 -pipe -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -DKLD_TIED -DHAVE_KERNEL_OPTION_HEADERS -include /usr/obj/usr/src/amd64.amd64/sys/MYKERNEL/opt_global.h -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -fno-common -g -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdebug-prefix-map=./machine=/usr/src/sys/amd64/include -fdebug-prefix-map=./x86=/usr/src/sys/x86/include -I/usr/obj/usr/src/amd64.amd64/sys/MYKERNEL -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 -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -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 -Wno-error-shift-negative-value -Wno-address-of-packed-member -mno-aes -mno-avx -std=iso9899:1999 -Werror   -mmmx -msse -msse4 -maes -mpclmul /usr/src/sys/crypto/aesni/aesni_ccm.c
ctfconvert -L VERSION -g aesni_ccm.o
make[4]: don't know how to make immintrin.h. Stop

make[4]: stopped in /usr/src/sys/modules/aesni
*** Error code 2

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

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

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

Stop.
make: stopped in /usr/src

I removed the device sg addition from the kernel file just to make sure that it wasn't that. And I get the same error.

My source is up-to-date:

Code:
root@daedalus:/usr/src # svn info /usr/src
Path: .
Working Copy Root Path: /usr/src
URL: https://svn.freebsd.org/base/releng/12.1
Relative URL: ^/releng/12.1
Repository Root: https://svn.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 360360
Node Kind: directory
Schedule: normal
Last Changed Author: gordon
Last Changed Rev: 360151
Last Changed Date: 2020-04-21 10:54:08 -0500 (Tue, 21 Apr 2020)

Here's the output of head -15 /usr/src/Makefile:

Code:
root@daedalus:/usr/src # head -15 /usr/src/Makefile
#
# $FreeBSD: releng/12.1/Makefile 348458 2019-05-31 15:05:54Z markj $
#
# The user-driven targets are:
#
# universe            - *Really* build *everything* (buildworld and
#                       all kernels on all architectures).  Define the
#                       MAKE_JUST_KERNELS variable to only build kernels.
# tinderbox           - Same as universe, but presents a list of failed build
#                       targets and exits with an error if there were any.
# buildworld          - Rebuild *everything*, including glue to help do
#                       upgrades.
# installworld        - Install everything built by "buildworld".
# world               - buildworld + installworld, no kernel.
# buildkernel         - Rebuild the kernel and the kernel-modules.

Even running make clean under /usr/src generates an error:

Code:
===> lib/libc (clean)
===> lib/libc/tests (clean)
===> lib/libc/tests/tls_dso (clean)
make[5]: "/usr/src/share/mk/netbsd-tests.test.mk" line 9: "Please define TESTSRC to the absolute path of the test sources, e.g. ${SRCTOP}/contrib/netbsd-tests/lib/libc/stdio"
*** Error code 1

Stop.
make[4]: stopped in /usr/src/lib/libc/tests
*** Error code 1

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

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

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

Stop.
make: stopped in /usr/src

Here's the error when running make buildworld in /usr/src:

Code:
sh /usr/src/tools/install.sh  -C -o root -g wheel -m 444   libnv.a /usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/lib/
===> usr.bin/lex/lib (obj,includes,all,install)
[Creating objdir /usr/obj/usr/src/amd64.amd64/tmp/obj-tools/usr.bin/lex/lib...]
make[3]: don't know how to make libmain.c. Stop

make[3]: stopped in /usr/src/usr.bin/lex/lib
*** Error code 2

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

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

Stop.
make: stopped in /usr/src

I am at a complete loss because I'm not changing anything. At this point, I am just trying to build the kernel unchanged. And as I research where to look, I feel like I am running in to dead ends. If you can offer any guidance, that would be great. Thank you.
 
Last edited by a moderator:
I ran a make buildkernel , no problem here.
Code:
--------------------------------------------------------------               
>>> Kernel build for GENERIC completed on Sat May  9 11:26:28 +02 2020       
--------------------------------------------------------------

svnlite info /usr/src
Code:
Path: /usr/src
Working Copy Root Path: /usr/src
URL: https://svn.freebsd.org/base/releng/12.1
Relative URL: ^/releng/12.1
Repository Root: https://svn.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 360837
Node Kind: directory
Schedule: normal
Last Changed Author: emaste
Last Changed Rev: 360473
Last Changed Date: 2020-04-29 21:51:34 +0300 (Wed, 29 Apr 2020)

You could try a update of the src tree, clean up /usr/obj, try again, or get a fresh copy, rename the old one ( or delete ).

I’ve noticed you are using svn from devel/subversion, FYI the base system comes with svnlite(1).

I have a server at home running FreeBSD 12.1-RELEASE-p3 GENERIC amd64
12.1 is at patch level -p4, you might want to update.
 
From your outputs I see make is attempting to "build" files that are part of the source, so this looks very broken.
I would suggest to retry from scratch: completely remove /usr/obj and /usr/src and check out a new copy of the source to /usr/src. In a first step, you can try whether just removing all contents of /usr/obj already solves the problem.

Just to be sure, you might want to check whether which make is /usr/bin/make, which cc is /usr/bin/cc and so on.

About multimedia/makemkv, unfortunately this is out of date. I guess I'll have to solve a strange compilation issue on i386 before the update can be applied. But it works well on 12.1/amd64, you can find it in this PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=245665

12.1 is at patch level -p4, you might want to update.
The quoted output looks like uname, and as -p4 didn't introduce any kernel changes, this might be just fine. Always check your version with freebsd-version(1) :)

I followed the steps laid out at https://www.freebsd.org/doc/handbook/kernelconfig-building.html. I created a duplicate kernel file and edited that to add device sg at the end.

I would recommend to include GENERIC instead, this is more flexible. E.g., for using makemkv, I have a kernel config DESKTOP with these contents:
Code:
include GENERIC
ident DESKTOP

device        sg

That way there's nothing to change when GENERIC changes.
 
Thank you both for the help. But I'm still getting errors. I have tried the suggestions you mentioned above. I'd welcome more comments. Here's the updated info and output.

Code:
root@daedalus:~ # which make
/usr/bin/make
root@daedalus:~ # which cc
/usr/bin/cc
root@daedalus:~ # freebsd-version
12.1-RELEASE-p4

I decided to remove everything in /usr/obj first and re-ran make, but I still got an error. So I went forward with wiping out /usr/src like you suggested.

Code:
root@daedalus:/usr/obj # chflags -R noschg *
root@daedalus:/usr/obj # rm -rf *
root@daedalus:/usr/obj # ll
total 0
root@daedalus:/usr/obj # cd /usr/src
root@daedalus:/usr/src # rm -rf *
root@daedalus:/usr/src # ll
total 27
-rw-r--r--  1 root  wheel   85 Mar 27 17:00 .arcconfig
-rw-r--r--  1 root  wheel  448 Mar 27 17:00 .arclint
-rw-r--r--  1 root  wheel  152 Mar 27 17:00 .gitattributes
-rw-r--r--  1 root  wheel  188 Mar 27 17:00 .gitignore
drwxr-xr-x  4 root  wheel    8 Mar 27 16:56 .svn/
root@daedalus:/usr/src # svnlite update /usr/src
Updating '.':
Restored 'Makefile.inc1'
Restored 'ObsoleteFiles.inc'
Restored 'targets'
Restored 'targets/Makefile'
Restored 'targets/Makefile.xtras'
Restored 'targets/pseudo'

<snipped the rest of the restored>

Restored 'rescue/librescue/Makefile.depend'
Restored 'rescue/librescue/Makefile'
Restored 'Makefile.libcompat'
At revision 360849.

Code:
root@daedalus:/usr/src # svnlite info /usr/src
Path: .
Working Copy Root Path: /usr/src
URL: https://svn.freebsd.org/base/releng/12.1
Relative URL: ^/releng/12.1
Repository Root: https://svn.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 360849
Node Kind: directory
Schedule: normal
Last Changed Author: emaste
Last Changed Rev: 360473
Last Changed Date: 2020-04-29 13:51:34 -0500 (Wed, 29 Apr 2020)

I try to build again and still get an error:

Code:
root@daedalus:/usr/src # make -j4 buildworld
[Creating objdir /usr/obj/usr/src/amd64.amd64...]
--- buildworld ---
make[1]: "/usr/src/Makefile.inc1" line 341: SYSTEM_COMPILER: Determined that CC=cc matches the source tree.  Not bootstrapping a cross-compiler.
make[1]: "/usr/src/Makefile.inc1" line 346: SYSTEM_LINKER: Determined that LD=ld matches the source tree.  Not bootstrapping a cross-linker.
--- buildworld_prologue ---
--------------------------------------------------------------
>>> World build started on Sat May  9 11:24:28 CDT 2020
--------------------------------------------------------------
--- _worldtmp ---

--------------------------------------------------------------
>>> Rebuilding the temporary build tree
--------------------------------------------------------------
rm -rf /usr/obj/usr/src/amd64.amd64/tmp
cd /usr/src/tools/build;  make DIRPRFX=tools/build/ DESTDIR=/usr/obj/usr/src/amd64.amd64/tmp/legacy installdirs
[Creating objdir /usr/obj/usr/src/amd64.amd64/tools/build...]
--- installdirs ---
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/bin"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/sbin"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/bin"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/sbin"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/lib"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/lib/geom"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/lib/casper"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy//usr/include/sys"
--- _legacy ---

--------------------------------------------------------------
>>> stage 1.1: legacy release compatibility shims
--------------------------------------------------------------
cd /usr/src; INSTALL="sh /usr/src/tools/install.sh"  TOOLS_PREFIX=/usr/obj/usr/src/amd64.amd64/tmp  PATH=/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/sbin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/bin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/bin:/sbin:/bin:/usr/sbin:/usr/bin  WORLDTMP=/usr/obj/usr/src/amd64.amd64/tmp  MAKEFLAGS="-m /usr/src/tools/build/mk  -j 4 -J 15,16 -m /usr/src/share/mk" make  -f Makefile.inc1  DESTDIR=  OBJTOP='/usr/obj/usr/src/amd64.amd64/tmp/obj-tools'  OBJROOT='${OBJTOP}/'  MAKEOBJDIRPREFIX=  BOOTSTRAPPING=1201000  BWPHASE=legacy  SSP_CFLAGS=  MK_HTML=no NO_LINT=yes MK_MAN=no  -DNO_PIC MK_PROFILE=no -DNO_SHARED  -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no  MK_CLANG_EXTRAS=no MK_CLANG_FULL=no  MK_LLDB=no MK_RETPOLINE=no MK_TESTS=no  MK_INCLUDES=yes MK_LLVM_TARGET_ALL=no legacy
[Creating objdir /usr/obj/usr/src/amd64.amd64/tmp/obj-tools...]
--- legacy ---
===> tools/build (obj,includes,all,install)
[Creating objdir /usr/obj/usr/src/amd64.amd64/tmp/obj-tools/tools/build...]
--- _SYSINCSINS ---
sh /usr/src/tools/install.sh  -C -o root -g wheel -m 444  /usr/src/sys/sys/nv.h /usr/src/sys/sys/cnv.h /usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include/sys/
--- dummy.o ---
cc  -O2 -pipe  -g -MD  -MF.depend.dummy.o -MTdummy.o -std=gnu99  -Qunused-arguments  -I/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include -c /usr/src/tools/build/dummy.c -o dummy.o
--- libegacy.a ---
building static egacy library
ar -crD libegacy.a `NM='nm' NMFLAGS=''  lorder dummy.o  | tsort -q`
ranlib -D libegacy.a
--- _libinstall ---
--- installdirs ---
--- _libinstall ---
sh /usr/src/tools/install.sh  -C -o root -g wheel -m 444   libegacy.a /usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/lib/
--- installdirs ---
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/bin"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/sbin"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/bin"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/sbin"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/lib"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/lib/geom"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/lib/casper"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy//usr/include/sys"
===> lib/libnv (obj,includes,all,install)
[Creating objdir /usr/obj/usr/src/amd64.amd64/tmp/obj-tools/lib/libnv...]
--- cnvlist.o ---
--- dnvlist.o ---
--- msgio.o ---
--- nvlist.o ---
--- cnvlist.o ---
cc  -O2 -pipe  -I/usr/src/lib/libnv -g -MD  -MF.depend.cnvlist.o -MTcnvlist.o -std=gnu99  -Qunused-arguments  -I/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include -c /usr/src/sys/contrib/libnv/cnvlist.c -o cnvlist.o
--- dnvlist.o ---
cc  -O2 -pipe  -I/usr/src/lib/libnv -g -MD  -MF.depend.dnvlist.o -MTdnvlist.o -std=gnu99  -Qunused-arguments  -I/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include -c /usr/src/sys/contrib/libnv/dnvlist.c -o dnvlist.o
--- msgio.o ---
cc  -O2 -pipe  -I/usr/src/lib/libnv -g -MD  -MF.depend.msgio.o -MTmsgio.o -std=gnu99  -Qunused-arguments  -I/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include -c /usr/src/lib/libnv/msgio.c -o msgio.o
--- nvlist.o ---
cc  -O2 -pipe  -I/usr/src/lib/libnv -g -MD  -MF.depend.nvlist.o -MTnvlist.o -std=gnu99  -Qunused-arguments  -I/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include -c /usr/src/sys/contrib/libnv/nvlist.c -o nvlist.o
--- nvpair.o ---
cc  -O2 -pipe  -I/usr/src/lib/libnv -g -MD  -MF.depend.nvpair.o -MTnvpair.o -std=gnu99  -Qunused-arguments  -I/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include -c /usr/src/sys/contrib/libnv/nvpair.c -o nvpair.o
--- libnv.a ---
building static nv library
ar -crD libnv.a `NM='nm' NMFLAGS=''  lorder cnvlist.o dnvlist.o msgio.o nvlist.o nvpair.o  | tsort -q`
ranlib -D libnv.a
--- _libinstall ---
sh /usr/src/tools/install.sh  -C -o root -g wheel -m 444   libnv.a /usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/lib/
===> usr.bin/lex/lib (obj,includes,all,install)
[Creating objdir /usr/obj/usr/src/amd64.amd64/tmp/obj-tools/usr.bin/lex/lib...]
make[3]: make[3]: don't know how to make libmain.c. Stop

make[3]: stopped in /usr/src/usr.bin/lex/lib
*** [legacy] Error code 2

make[2]: stopped in /usr/src
1 error

make[2]: stopped in /usr/src
*** [_legacy] Error code 2

make[1]: stopped in /usr/src
1 error

make[1]: stopped in /usr/src
*** [buildworld] Error code 2

make: stopped in /usr/src
1 error

make: stopped in /usr/src

Thank you again for all the help.
 
Removing -j gives me the same error:

Code:
root@daedalus:~ # cd /usr/src
root@daedalus:/usr/src # make buildworld
make[1]: "/usr/src/Makefile.inc1" line 341: SYSTEM_COMPILER: Determined that CC=cc matches the source tree.  Not bootstrapping a cross-compiler.
make[1]: "/usr/src/Makefile.inc1" line 346: SYSTEM_LINKER: Determined that LD=ld matches the source tree.  Not bootstrapping a cross-linker.
--------------------------------------------------------------
>>> World build started on Sat May  9 12:23:54 CDT 2020
--------------------------------------------------------------

--------------------------------------------------------------
>>> Rebuilding the temporary build tree
--------------------------------------------------------------
rm -rf /usr/obj/usr/src/amd64.amd64/tmp
cd /usr/src/tools/build;  make DIRPRFX=tools/build/ DESTDIR=/usr/obj/usr/src/amd64.amd64/tmp/legacy installdirs
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/bin"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/sbin"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/bin"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/sbin"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/lib"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/lib/geom"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/lib/casper"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy//usr/include/sys"

--------------------------------------------------------------
>>> stage 1.1: legacy release compatibility shims
--------------------------------------------------------------
cd /usr/src; INSTALL="sh /usr/src/tools/install.sh"  TOOLS_PREFIX=/usr/obj/usr/src/amd64.amd64/tmp  PATH=/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/sbin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/bin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/bin:/sbin:/bin:/usr/sbin:/usr/bin  WORLDTMP=/usr/obj/usr/src/amd64.amd64/tmp  MAKEFLAGS="-m /usr/src/tools/build/mk  -m /usr/src/share/mk" make  -f Makefile.inc1  DESTDIR=  OBJTOP='/usr/obj/usr/src/amd64.amd64/tmp/obj-tools'  OBJROOT='${OBJTOP}/'  MAKEOBJDIRPREFIX=  BOOTSTRAPPING=1201000  BWPHASE=legacy  SSP_CFLAGS=  MK_HTML=no NO_LINT=yes MK_MAN=no  -DNO_PIC MK_PROFILE=no -DNO_SHARED  -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no  MK_CLANG_EXTRAS=no MK_CLANG_FULL=no  MK_LLDB=no MK_RETPOLINE=no MK_TESTS=no  MK_INCLUDES=yes MK_LLVM_TARGET_ALL=no legacy
[Creating objdir /usr/obj/usr/src/amd64.amd64/tmp/obj-tools...]
===> tools/build (obj,includes,all,install)
[Creating objdir /usr/obj/usr/src/amd64.amd64/tmp/obj-tools/tools/build...]
sh /usr/src/tools/install.sh  -C -o root -g wheel -m 444  /usr/src/sys/sys/nv.h /usr/src/sys/sys/cnv.h /usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include/sys/
cc  -O2 -pipe  -g -MD  -MF.depend.dummy.o -MTdummy.o -std=gnu99  -Qunused-arguments  -I/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include -c /usr/src/tools/build/dummy.c -o dummy.o
building static egacy library
ar -crD libegacy.a `NM='nm' NMFLAGS=''  lorder dummy.o  | tsort -q`
ranlib -D libegacy.a
sh /usr/src/tools/install.sh  -C -o root -g wheel -m 444   libegacy.a /usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/lib/
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/bin"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/sbin"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/bin"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/sbin"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/lib"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/lib/geom"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy/lib/casper"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy//usr/include/sys"
===> lib/libnv (obj,includes,all,install)
[Creating objdir /usr/obj/usr/src/amd64.amd64/tmp/obj-tools/lib/libnv...]
cc  -O2 -pipe  -I/usr/src/lib/libnv -g -MD  -MF.depend.cnvlist.o -MTcnvlist.o -std=gnu99  -Qunused-arguments  -I/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include -c /usr/src/sys/contrib/libnv/cnvlist.c -o cnvlist.o
cc  -O2 -pipe  -I/usr/src/lib/libnv -g -MD  -MF.depend.dnvlist.o -MTdnvlist.o -std=gnu99  -Qunused-arguments  -I/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include -c /usr/src/sys/contrib/libnv/dnvlist.c -o dnvlist.o
cc  -O2 -pipe  -I/usr/src/lib/libnv -g -MD  -MF.depend.msgio.o -MTmsgio.o -std=gnu99  -Qunused-arguments  -I/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include -c /usr/src/lib/libnv/msgio.c -o msgio.o
cc  -O2 -pipe  -I/usr/src/lib/libnv -g -MD  -MF.depend.nvlist.o -MTnvlist.o -std=gnu99  -Qunused-arguments  -I/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include -c /usr/src/sys/contrib/libnv/nvlist.c -o nvlist.o
cc  -O2 -pipe  -I/usr/src/lib/libnv -g -MD  -MF.depend.nvpair.o -MTnvpair.o -std=gnu99  -Qunused-arguments  -I/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include -c /usr/src/sys/contrib/libnv/nvpair.c -o nvpair.o
building static nv library
ar -crD libnv.a `NM='nm' NMFLAGS=''  lorder cnvlist.o dnvlist.o msgio.o nvlist.o nvpair.o  | tsort -q`
ranlib -D libnv.a
sh /usr/src/tools/install.sh  -C -o root -g wheel -m 444   libnv.a /usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/lib/
===> usr.bin/lex/lib (obj,includes,all,install)
[Creating objdir /usr/obj/usr/src/amd64.amd64/tmp/obj-tools/usr.bin/lex/lib...]
make[3]: don't know how to make libmain.c. Stop

make[3]: stopped in /usr/src/usr.bin/lex/lib
*** Error code 2

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

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

Stop.
make: stopped in /usr/src
 
So I went forward with wiping out /usr/src like you suggested.
From the code following this, I see you didn't delete everything. Namely, .svn is still there, and I assume any restore happens from there. Please try to really delete the complete contents of /usr/src (including hidden files). I can't give any guarantees, but the nature of the errors you get seems to suggest a broken working copy with missing files, so I think the best solution is a complete new svn checkout.
 
Any strange things in /etc/make.conf /etc/src.conf ?
Any strange customizations in the environment?
Any disk have run full?

Then, lets have a look (this is a 11.3, so probably not everything sharp at the mark, but nevertheless):
Code:
$ cd /usr/src/usr.bin/lex/lib/
$ make -n
echo "Warning: Object directory not changed from original /usr/src/usr.bin/lex/lib"
cc  -O2 -pipe -march=pentium3  -MD  -MF.depend.libmain.o -MTlibmain.o -std=gnu99 -fstack-protector-strong    -Qunused-arguments  -c /usr/src/contrib/flex/libmain.c -o libmain.o

First thing it wants to do here is compile the /usr/src/contrib/flex/libmain.c - and in your case it seems to not find it. So, where is the damned thing?

Otherwise I agree: clean out the whole src and recreate from upstream.
 
Two more hints for later:
  • There's no need to build "world" when all you need is a custom kernel.
  • Removing -j[x] is often worth a shot when a build misbehaves, this happens when Makefiles miss some dependencies. I've personally never seen FreeBSD's builds choke on it, though. For a fast build, you want to give the number of available cores/threads on your system here, possibly more then 4 on a modern CPU.
 
I hope you solved your problem now? Just wanted to add that today, the current version of makemkv hit the ports :)
 
I have exactly the same problem after upgrading 12.1 -> 12.2 RELEASE. I need to fix a driver on my working machine with a generated release memstick to verify. I took /usr/src from new git repository. /usr/obj is clean. Now I build without -j but man that is slow :-(

Update1: Without -j there are some build errors!

Code:
cc -target x86_64-unknown-freebsd12.2 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin  -O2 -pipe -fno-common -I/usr/src/cddl/contrib/opensolaris/lib/libzpool/common -I/usr/src/cddl/comp[10/1254]
laris/include -I/usr/src/cddl/compat/opensolaris/lib/libumem -I/usr/src/sys/cddl/compat/opensolaris -I/usr/src/cddl/contrib/opensolaris/head -I/usr/src/cddl/contrib/opensolaris/lib/libuutil/common -I/usr/src/cddl/contrib/opensolaris
/lib/libzfs/common -I/usr/src/cddl/contrib/opensolaris/lib/libzfs_core/common -I/usr/src/cddl/contrib/opensolaris/lib/libumem/common -I/usr/src/cddl/contrib/opensolaris/lib/libnvpair -I/usr/src/sys/cddl/contrib/opensolaris/uts/commo
n -I/usr/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs -I/usr/src/sys/cddl/contrib/opensolaris/common/zfs   -DNEED_SOLARIS_BOOLEAN -g -O0 -MD  -MF.depend.zfs_iter.o -MTzfs_iter.o -std=gnu99 -fstack-protector-strong -Wno-pointer
-sign -Wno-unknown-pragmas -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wn
o-address-of-packed-member -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter -Wno-parentheses  -Qunused-arguments  -c /usr/src/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c -o zfs_iter.o
cc -target x86_64-unknown-freebsd12.2 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin -O2 -pipe -fno-common -I/usr/src/cddl/contrib/opensolaris/lib/libzpool/common -I/usr/src/cddl/compat/opensol
aris/include -I/usr/src/cddl/compat/opensolaris/lib/libumem -I/usr/src/sys/cddl/compat/opensolaris -I/usr/src/cddl/contrib/opensolaris/head -I/usr/src/cddl/contrib/opensolaris/lib/libuutil/common -I/usr/src/cddl/contrib/opensolaris/
lib/libzfs/common -I/usr/src/cddl/contrib/opensolaris/lib/libzfs_core/common -I/usr/src/cddl/contrib/opensolaris/lib/libumem/common -I/usr/src/cddl/contrib/opensolaris/lib/libnvpair -I/usr/src/sys/cddl/contrib/opensolaris/uts/common
-I/usr/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs -I/usr/src/sys/cddl/contrib/opensolaris/common/zfs -DNEED_SOLARIS_BOOLEAN -g -O0 -std=gnu99 -fstack-protector-strong -Wno-pointer-sign -Wno-unknown-pragmas -Wno-empty-body -
Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-address-of-packed-member -Wno-switch -Wno-
switch-enum -Wno-knr-promoted-parameter -Wno-parentheses -Qunused-arguments   -o zfs.full zfs_main.o zfs_iter.o   -ljail  -lnvpair  -luutil  -lzfs_core  -lzfs
ld: error: /usr/obj/usr/src/amd64.amd64/tmp/usr/lib/libuutil.so: undefined reference to __assfail
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Stop.
make[5]: stopped in /usr/src/cddl/sbin/zfs
*** Error code 1

Update2: Replacing /usr/src containing git repo with /usr/src containing the svn repo algo results with the same problem. Never had that problem before :-(

Update 2: Building stable/12 works fine. It turned out there was a problem, it was fixed in stable/12, but did not land into releng/12.2 yet. PARV pointed that on mailing lists, big thanks! Just leaving a trace if someone gets into this kind of problem, try different branch :-)

Code:
On 27.01.2021 19:31, parv/freebsd wrote:
[QUOTE]
# git log --pretty=fuller --grep libuutil release/12.2.0. <http://12.2.0.>.stable/12

commit 30ec3f368d
Author: Eugene Grosbein <eugen@FreeBSD.org>
AuthorDate: Dec.2020.1206-1622 +0000
Commit: Eugene Grosbein <eugen@FreeBSD.org>
CommitDate: Dec.2020.1206-1622 +0000

MFC r364027 by arichardson: Fix linker error in libuutil with recent LLVM

This also fixes nanobsd-style build (cross-compiling).
Original commit log:

Not marking the function as static can result in a linker error:
undefined reference to __assfail [--no-allow-shlib-undefined]
I noticed this error after updating our CHERI LLVM to the latest upstream
LLVM HEAD revision.

This change effectively reverts r329984 and marks dmu_buf_init_user as
static (which keeps the GCC build happy).
... above seems to (as I haven't bisected) be the fix in 12-STABLE which allows
the build to finish with success.
- parv
[/QUOTE]
 
Last edited:
Back
Top