I have amd64 stable/12 system updated on 8 December 2020. I updated stable/12 sources with gitup on yesterday, 6 January 2022 and attempted to rebuild some NanoBSD image. This box successfully performed the build last time with fresh stable/12 sources on early December 2021. Now same build fails: Building /usr/obj/nanobsd.gw/usr/src/amd64.amd64/lib/clang/liblldb/Core/ModuleList.o --- Core/ModuleList.o --- In file included from /usr/src/contrib/llvm-project/lldb/source/Core/ModuleList.cpp:34: In file included from /usr/src/contrib/llvm-project/clang/include/clang/Driver/Driver.h:12: In file included from /usr/src/contrib/llvm-project/clang/include/clang/Basic/Diagnostic.h:17: /usr/src/contrib/llvm-project/clang/include/clang/Basic/DiagnosticIDs.h:71:10: fatal error: 'clang/ Basic/DiagnosticCommonKinds.inc' file not found #include "clang/Basic/DiagnosticCommonKinds.inc" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. *** [Core/ModuleList.o] Error code 1 make[6]: stopped in /usr/src/lib/clang/liblldb Here is full list of knobs used for build: CONF_BUILD=' LOADER_BZIP2_SUPPORT= MODULES_WITH_WORLD= WITHOUT_ACCT= WITHOUT_AMD= WITHOUT_APM= WITHOUT_ASSERT_DEBUG= WITHOUT_ATM= WITHOUT_AUDIT= WITHOUT_AUTHPH= WITHOUT_AUTOFS= WITHOUT_BINUTILS= WITHOUT_BLACKLIST= WITHOUT_BLACKLIST_SUPPORT= WITHOUT_BLUETOOTH= WITHOUT_CALENDAR= WITHOUT_CAPSICUM= WITHOUT_CCD= WITHOUT_CLANG= WITHOUT_CPP= WITHOUT_CTM= WITHOUT_CUSE= WITHOUT_CVS= WITHOUT_DEBUG_FILES= WITHOUT_DMAGENT= WITHOUT_DICT= WITHOUT_ED_CRYPTO= WITHOUT_EXAMPLES= WITHOUT_FINGER= WITHOUT_FDT= WITHOUT_FLOPPY= WITHOUT_FREEBSD_UPDATE= WITHOUT_GAMES= WITHOUT_GCC= WITHOUT_GCOV= WITHOUT_GDB= WITHOUT_GPIO= WITHOUT_GROFF= WITHOUT_GSSAPI= WITGOUT_HESIOD= WITHOUT_HTML= WITHOUT_HYPERV= WITHOUT_INFO= WITHOUT_IPFILTER= WITHOUT_KERBEROS= WITHOUT_KERNEL_SYMBOLS= WITHOUT_LIB32= WITHOUT_MAN= WITHOUT_MAN_UTILS= WITHOUT_NDIS= WITHOUT_NETCAT= WITHOUT_NLS= WITHOUT_NLS_CATALOGS= WITHOUT_NS_CACHING= WITHOUT_OBJC= WITHOUT_PC_SYSINSTALL= WITHOUT_PF= WITHOUT_PORTSNAP= WITHOUT_PROFILE= WITHOUT_QUOTAS= WITHOUT_RCS= WITHOUT_RESCUE= WITHOUT_ROUTED= WITHOUT_SHAREDOCS= WITHOUT_SVNLITE= WITHOUT_SYSTEM_COMPILER= WITHOUT_TALK= WITHOUT_TESTS= WITHOUT_TEXTPROC= ' Attaching unmodified make.conf used by build process, it's full log and nanobsd environment out of its build directory.
Created attachment 230772 [details] full build log is over 1000KB, so it comes compressed
Created attachment 230773 [details] nanobsd make.conf
Created attachment 230774 [details] nanobsd environment
Was this an incremental build, and if so, from which old commmit to which new commit?
(In reply to Dimitry Andric from comment #4) This is standard nanobsd build (no flash) that includes obj cleaning: /usr/src/tools/tools/nanobsd/nanobsd.sh gw.conf
s/no flash/no flags/
Adding Ed, as he may have a clue on this. It looks like part of lldb requires part of clang to have been built, so maybe we added some logic later on in main that disables lldb if clang is disabled? In any case I think the quickest workaround is to add WITHOUT_LLDB= to the make.conf file.
(In reply to Dimitry Andric from comment #7) I'll try adding WITHOUT_LLDB= and will report back. Could it be some race due to parallel make, by the way?
(In reply to Dimitry Andric from comment #7) LLDB does use parts of Clang (it uses Clang as the expression parser). I'm not sure what would have broken this - 021385aba562 moved libclang build into MK_CLANG, but it seems we previously did not build lib/clang at all if MK_CLANG=no. I am trying a build on main now WITHOUT_CLANG but with LLDB left as default.
Indeed, main fails the same way: In file included from /tmp/cirrus-ci-build/contrib/llvm-project/lldb/source/Core/ModuleList.cpp:34: In file included from /tmp/cirrus-ci-build/contrib/llvm-project/clang/include/clang/Driver/Driver.h:12: In file included from /tmp/cirrus-ci-build/contrib/llvm-project/clang/include/clang/Basic/Diagnostic.h:17: /tmp/cirrus-ci-build/contrib/llvm-project/clang/include/clang/Basic/DiagnosticIDs.h:71:10: fatal error: 'clang/Basic/DiagnosticCommonKinds.inc' file not found #include "clang/Basic/DiagnosticCommonKinds.inc" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated.
Testing this patch: commit f8cb4720bfc67eeb033585d85a6323902ece7d1e (HEAD -> PR260993, github/PR260993) Author: Ed Maste <emaste@FreeBSD.org> Date: Fri Jan 7 10:34:08 2022 -0500 Build libclang if LLDB is enabled LLDB depends on libclang as it uses Clang as the expression parser. Previously setting WITHOUT_CLANG but leaving LLDB enabled resulted in a build failure. Users who set WITHOUT_CLANG to reduce build time or size may want to set WITHOUT_LLDB as well, or use WITHOUT_TOOLCHAIN instead. PR: 260993 diff --git a/lib/clang/Makefile b/lib/clang/Makefile index df4aa01a2653..cbb2c2a7175f 100644 --- a/lib/clang/Makefile +++ b/lib/clang/Makefile @@ -4,7 +4,7 @@ # These have to be built in order. SUBDIR= libllvm -.if ${MK_CLANG} != "no" +.if ${MK_CLANG} != "no" || ${MK_LLDB} != "no" SUBDIR+= libclang SUBDIR+= headers .endif
While my image is building, I'm re-reading src.conf(5) to update my set of knobs and I found that it refers to some "LLVM_TARGET_ALL" knob multiple times with note that this is preferred over WITHOUT_LLVM_TARGET_*. However, it does not document LLVM_TARGET_ALL. What is this knob for and how to use it? I would like to speedup my build as much as possible and I do not need any development bits in resulting image. If possible, I'd like to avoid building clang/llvm/etc. at boostrap stage and use possibly outdated clang/etc. binaries from base system. I'm fine with build failing if they are too outdated and I'm fine with restarting build with another "failsafe" set of knobs in such case.
(In reply to Ed Maste from comment #11) Need this additional patch: diff --git a/Makefile.inc1 b/Makefile.inc1 index 2cc00beed80d..b31c1d09fbeb 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2343,7 +2343,8 @@ _gensnmptree= usr.sbin/bsnmpd/gensnmptree _clang_tblgen= \ lib/clang/libllvmminimal \ usr.bin/clang/llvm-tblgen -.if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no" +.if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no" || \ + ${MK_LLDB} != "no" _clang_tblgen+= usr.bin/clang/clang-tblgen .endif .if ${MK_LLDB} != "no" With this and the patch in comment #9 WITHOUT_CLANG WITH_LLDB builds for me in Cirrus-CI
(In reply to Eugene Grosbein from comment #12) If you don't need a toolchain in the target just set WITHOUT_TOOLCHAIN. It covers these (from share/mk/src.opts.mk): .if ${MK_TOOLCHAIN} == "no" MK_CLANG:= no MK_INCLUDES:= no MK_LLD:= no MK_LLDB:= no MK_LLVM_BINUTILS:= no .endif The Cirrus-CI builds use the following command for quick builds: su user -c "make -j$(sysctl -n hw.ncpu) CROSS_TOOLCHAIN=llvm13 WITHOUT_TOOLCHAIN=yes buildworld buildkernel" If you want to just use whatever the host compiler is, and avoid building toolchain for the target, I think you could use: WITHOUT_CLANG_BOOTSTRAP WITHOUT_LLD_BOOTSTRAP WITHOUT_ELFTOOLCHAIN_BOOTSTRAP # this one won't save much WITHOUT_TOOLCHAIN
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=adc88b9c01b5d7a51c896091b291afbdae42b02a commit adc88b9c01b5d7a51c896091b291afbdae42b02a Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2022-01-07 15:34:08 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2022-01-07 20:23:55 +0000 Build libclang also if LLDB is enabled LLDB depends on libclang as it uses Clang as the expression parser. Previously setting WITHOUT_CLANG but leaving LLDB enabled (as default) resulted in a build failure. Users who set WITHOUT_CLANG in order to reduce build time or size might want to set WITHOUT_LLDB in addition to WITHOUT_CLANG, or use WITHOUT_TOOLCHAIN instead. PR: 260993 Reported by: eugen Reviewed by: dim MFC after: 3 days Sponsored by: The FreeBSD Foundation Makefile.inc1 | 3 ++- lib/clang/Makefile | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
(In reply to Ed Maste from comment #13) Adding WITHOUT_LLDB= to my initial build configuration fixed the issue and full image build process was successful without any patches.
(In reply to commit-hook from comment #15) Do you need me to test changes with stable/12? My build takes almost 3 hours and most of the time Clang/LLVM are built.
(In reply to Eugene Grosbein from comment #17) No need, I believe this patch will fix it once MFC'd in a few days.
(In reply to Ed Maste from comment #14) Thank you very much for a hint. Adding these WITHOUT_*_BOOTSTRAP knobs decreased buildworld time from ~3 hours to 43 minutes for my build box with i7200U 2-core 2.0Ghz system with 32GB RAM.
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=8402f6341ee331ae8d273e609dafa7359455491d commit 8402f6341ee331ae8d273e609dafa7359455491d Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2022-01-07 15:34:08 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2022-01-10 00:25:11 +0000 Build libclang also if LLDB is enabled LLDB depends on libclang as it uses Clang as the expression parser. Previously setting WITHOUT_CLANG but leaving LLDB enabled (as default) resulted in a build failure. Users who set WITHOUT_CLANG in order to reduce build time or size might want to set WITHOUT_LLDB in addition to WITHOUT_CLANG, or use WITHOUT_TOOLCHAIN instead. PR: 260993 Reported by: eugen Reviewed by: dim MFC after: 3 days Sponsored by: The FreeBSD Foundation (cherry picked from commit adc88b9c01b5d7a51c896091b291afbdae42b02a) Makefile.inc1 | 3 ++- lib/clang/Makefile | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
A commit in branch stable/12 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=620d156421e249269a4e957a6ad22957308f880f commit 620d156421e249269a4e957a6ad22957308f880f Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2022-01-07 15:34:08 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2022-01-10 00:25:50 +0000 Build libclang also if LLDB is enabled LLDB depends on libclang as it uses Clang as the expression parser. Previously setting WITHOUT_CLANG but leaving LLDB enabled (as default) resulted in a build failure. Users who set WITHOUT_CLANG in order to reduce build time or size might want to set WITHOUT_LLDB in addition to WITHOUT_CLANG, or use WITHOUT_TOOLCHAIN instead. PR: 260993 Reported by: eugen Reviewed by: dim MFC after: 3 days Sponsored by: The FreeBSD Foundation (cherry picked from commit adc88b9c01b5d7a51c896091b291afbdae42b02a) Makefile.inc1 | 3 ++- lib/clang/Makefile | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)