Bug 264258

Summary: 13-CURRENT r339587 fails to build 13.1_releng LLVM: c++: error: unable to execute command: Killed
Product: Base System Reporter: Alex <born2b_daem0n>
Component: miscAssignee: Kubilay Kocak <koobs>
Status: Closed Not A Bug    
Severity: Affects Only Me CC: brooks
Priority: ---    
Version: 13.1-RELEASE   
Hardware: amd64   
OS: Any   

Description Alex 2022-05-26 17:27:30 UTC
Hello,

I have 13.0-CURRENT and trying to build world for 13.1-releng
FreeBSD goodhost 13.0-CURRENT FreeBSD 13.0-CURRENT r339587 GENERIC  amd64


I've got following error in while buildword was compiling LLVM part:

c++  -O2 -pipe -fno-common -I/usr/obj/usr/src_13.1_releng/amd64.amd64/tmp/obj-tools/lib/clang/libllvm -I/usr/src_13.1_releng/contrib/llvm-project/llvm/lib/Target/X86 -I/usr/src_13.1_releng/lib/clang/include -I/usr/src_13.1_releng/contrib/llvm-project/llvm/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DHAVE_VCS_VERSION_INC -DNDEBUG -DLLVM_DEFAULT_TARGET_TRIPLE=\"x86_64-unknown-freebsd13.1\" -DLLVM_HOST_TRIPLE=\"x86_64-unknown-freebsd13.1\" -DDEFAULT_SYSROOT=\"/usr/obj/usr/src_13.1_releng/amd64.amd64/tmp\" -DLLVM_TARGET_ENABLE_X86 -DLLVM_NATIVE_ASMPARSER=LLVMInitializeX86AsmParser -DLLVM_NATIVE_ASMPRINTER=LLVMInitializeX86AsmPrinter -DLLVM_NATIVE_DISASSEMBLER=LLVMInitializeX86Disassembler -DLLVM_NATIVE_TARGET=LLVMInitializeX86Target -DLLVM_NATIVE_TARGETINFO=LLVMInitializeX86TargetInfo -DLLVM_NATIVE_TARGETMC=LLVMInitializeX86TargetMC -ffunction-sections -fdata-sections -gline-tables-only -MD -MF.depend.Passes_PassBuilder.o -MTPasses/PassBuilder.o -Wno-format-zero-length -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 -I/usr/obj/usr/src_13.1_releng/amd64.amd64/tmp/legacy/usr/include  -fno-exceptions -fno-rtti -gline-tables-only -std=c++14    -stdlib=libc++ -Wno-c++11-extensions   -c /usr/src_13.1_releng/contrib/llvm-project/llvm/lib/Passes/PassBuilder.cpp -o Passes/PassBuilder.o
c++: error: unable to execute command: Killed
c++: error: clang frontend command failed due to signal (use -v to see invocation)
FreeBSD clang version 6.0.1 (tags/RELEASE_601/final 335540) (based on LLVM 6.0.1)
Target: x86_64-unknown-freebsd13.0
Thread model: posix
InstalledDir: /usr/bin
c++: note: diagnostic msg: PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and include the crash backtrace, preprocessed source, and associated run script.
c++: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
c++: note: diagnostic msg: /tmp/PassBuilder-8a5d79.cpp
c++: note: diagnostic msg: /tmp/PassBuilder-8a5d79.sh
c++: note: diagnostic msg:

********************
*** Error code 254

Stop.
make[4]: stopped in /usr/src_13.1_releng/lib/clang/libllvm
*** Error code 1

Stop.
make[3]: stopped in /usr/src_13.1_releng/lib/clang
*** Error code 1

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

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

Stop.
make: stopped in /usr/src_13.1_releng
root@130:/usr/src_13.1_releng # c++ -v
FreeBSD clang version 6.0.1 (tags/RELEASE_601/final 335540) (based on LLVM 6.0.1)
Target: x86_64-unknown-freebsd13.0
Thread model: posix
InstalledDir: /usr/bin
Comment 1 Alex 2022-05-26 17:38:05 UTC
The attach function did not work for :-(

Therefore, see shared archive:

https://1drv.ms/u/s!AuwC8ttPDR4XhasnOzMGHRZaaKKAMg?e=yWZadv
Comment 2 Brooks Davis freebsd_committer freebsd_triage 2022-05-26 19:14:41 UTC
This is quite an old CURRENT to upgrade from in one go (you have LLVM 6.0.1, but FreeVSD 13.0 shipped with 11.0.0 and even FreeBSD 11.4 has LLVM 10.0.0). I don't have any way to test 6.0.1 and there aren't going to be fixes for it. You may need to do this upgrade in multiple steps.

A few other thoughts:

clang just reporting "Killed" often means out of memory. Check dmesg or logs to see if that might have happened.

If you have a newer llvm installed by ports you may be able to use it with CROSS_TOOLCHAIN=llvm##, however if your ports are old enough you may need a to install one of the xtoolchain-llvm## ports (now obsolete) to make that work or do the equivalent by hand (see an example below):

/usr/local/share/toolchains/llvm13.mk:
XCC=/usr/local/bin/clang13
XCXX=/usr/local/bin/clang++13
XCPP=/usr/local/bin/clang-cpp13
XLD=/usr/local/bin/ld.lld13
CROSS_BINUTILS_PREFIX=/var/empty
X_COMPILER_TYPE=clang
Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2022-05-27 00:11:22 UTC
^Triage: Closing as likely resource exhaustion.

@Alex Don't hesitate to re-open this issue with additional information if you are able to isolate/reproduce a specific bug in supported FreeBSD versions (including up to date CURRENT)