Re: Problem building world

From: Mitchell Horne <mhorne_at_freebsd.org>
Date: Tue, 07 Dec 2021 15:34:04 UTC

On 11/28/21 10:52, tuexen@freebsd.org wrote:
> Dear all,
>
> when trying to build world as of today, the following happens:
>
>>>> stage 3: cross tools
> --------------------------------------------------------------
> cd /usr/home/tuexen/freebsd-src; time env INSTALL="sh /usr/home/tuexen/freebsd-src/tools/install.sh"  TOOLS_PREFIX=/usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp  PATH=/usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/legacy/usr/sbin:/usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/legacy/usr/bin:/usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/legacy/bin:/usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/legacy/usr/libexec:/sbin:/bin:/usr/sbin:/usr/bin  WORLDTMP=/usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp  MAKEFLAGS="-m /usr/home/tuexen/freebsd-src/tools/build/mk  -j 4 -J 15,16 -m /usr/home/tuexen/freebsd-src/share/mk" make  -f Makefile.inc1  DESTDIR=  OBJTOP='/usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools'  OBJROOT='${OBJTOP}/'  MAKEOBJDIRPREFIX=  BOOTSTRAPPING=1400029  BWPHASE=cross-tools  -DNO_CPU_CFLAGS  -DNO_LINT  -DNO_PIC  -DNO_SHARED  MK_ASAN=no  MK_CTF=no  MK_CLANG_EXTRAS=no  MK_CLANG_FORMAT=no  MK_CLANG_FULL=no  MK_HTML=no  MK_MAN=no  MK_PROFILE=no  MK_RETPOLINE=no  MK_SSP=no  MK_TESTS=no  MK_UBSAN=no  MK_WERROR=no  MK_INCLUDES=yes  MK_MAN_UTILS=yes MK_LLVM_TARGET_ALL=no  TARGET=riscv TARGET_ARCH=riscv64  MK_CLANG_IS_CC=yes  MK_LLDB=no  MK_LLVM_BINUTILS=no  MK_TESTS=no cross-tools
> --- cross-tools ---
> ===> lib/clang (obj,all,install)
> --- all_subdir_lib/clang/libllvm ---
> ===> lib/clang/libllvm (all)
> [Creating objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/Analysis...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/AsmParser...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/BinaryFormat...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/Bitcode/Reader...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/Bitcode/Writer...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/Bitstream/Reader...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/CodeGen...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/CodeGen/AsmPrinter...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/CodeGen/GlobalISel...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/CodeGen/LiveDebugValues...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/CodeGen/SelectionDAG...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/DebugInfo/CodeView...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/DebugInfo/DWARF...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/DebugInfo/MSF...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/DebugInfo/Symbolize...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/Demangle...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/Frontend/OpenMP...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/IR...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/IRReader...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/LTO...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/Linker...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/MC...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/MC/MCDisassembler...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/MC/MCParser...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/Object...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/ObjectYAML...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/Option...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/Passes...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/ProfileData...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/ProfileData/Coverage...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/Remarks...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/Support...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/TableGen...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/Target...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/Target/RISCV...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/Target/RISCV/AsmParser...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/Target/RISCV/Disassembler...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/Target/RISCV/MCTargetDesc...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/Target/RISCV/TargetInfo...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/TextAPI...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/ToolDrivers/llvm-dlltool...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/ToolDrivers/llvm-lib...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/Transforms/AggressiveInstCombine...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/Transforms/CFGuard...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/Transforms/Coroutines...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/Transforms/IPO...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/Transforms/InstCombine...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/Transforms/Instrumentation...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/Transforms/ObjCARC...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/Transforms/Scalar...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/Transforms/Utils...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/Transforms/Vectorize...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/llvm-dlltool...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/llvm-lib...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/llvm/Frontend/OpenMP...]
> [Creating nested objdir /usr/obj/usr/home/tuexen/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvm/llvm/IR...]
> --- llvm/Frontend/OpenMP/OMP.h.inc ---
> --- llvm/Frontend/OpenMP/OMP.inc ---
> --- llvm/IR/IntrinsicImpl.inc ---
> --- llvm/IR/IntrinsicsAArch64.h ---
> --- llvm/Frontend/OpenMP/OMP.h.inc ---
> llvm-tblgen --gen-directive-decl  -I /usr/home/tuexen/freebsd-src/contrib/llvm-project/llvm/include -d llvm/Frontend/OpenMP/OMP.h.inc.d -o llvm/Frontend/OpenMP/OMP.h.inc  /usr/home/tuexen/freebsd-src/contrib/llvm-project/llvm/include/llvm/Frontend/OpenMP/OMP.td
> ELF binary type "0" not known.
> --- llvm/Frontend/OpenMP/OMP.inc ---
> llvm-tblgen --gen-directive-impl  -I /usr/home/tuexen/freebsd-src/contrib/llvm-project/llvm/include -d llvm/Frontend/OpenMP/OMP.inc.d -o llvm/Frontend/OpenMP/OMP.inc  /usr/home/tuexen/freebsd-src/contrib/llvm-project/llvm/include/llvm/Frontend/OpenMP/OMP.td
> --- llvm/IR/IntrinsicImpl.inc ---
> llvm-tblgen -gen-intrinsic-impl  -I /usr/home/tuexen/freebsd-src/contrib/llvm-project/llvm/include -d llvm/IR/IntrinsicImpl.inc.d -o llvm/IR/IntrinsicImpl.inc  /usr/home/tuexen/freebsd-src/contrib/llvm-project/llvm/include/llvm/IR/Intrinsics.td
> --- llvm/IR/IntrinsicsAArch64.h ---
> llvm-tblgen -gen-intrinsic-enums -intrinsic-prefix=aarch64  -I /usr/home/tuexen/freebsd-src/contrib/llvm-project/llvm/include -d llvm/IR/IntrinsicsAArch64.h.d -o llvm/IR/IntrinsicsAArch64.h  /usr/home/tuexen/freebsd-src/contrib/llvm-project/llvm/include/llvm/IR/Intrinsics.td
> ELF binary type "0" not known.
> --- llvm/IR/IntrinsicImpl.inc ---
> sh: llvm-tblgen: Exec format error
> ELF binary type "0" not known.
> --- llvm/Frontend/OpenMP/OMP.inc ---
> sh: llvm-tblgen: Exec format error
> --- llvm/IR/IntrinsicsAArch64.h ---
> sh: llvm-tblgen: Exec format error
> ELF binary type "0" not known.
> --- llvm/IR/IntrinsicImpl.inc ---
> *** [llvm/IR/IntrinsicImpl.inc] Error code 126
>
> make[4]: stopped in /usr/home/tuexen/freebsd-src/lib/clang/libllvm
> --- llvm/Frontend/OpenMP/OMP.inc ---
> *** [llvm/Frontend/OpenMP/OMP.inc] Error code 126
>
> make[4]: stopped in /usr/home/tuexen/freebsd-src/lib/clang/libllvm
> --- llvm/IR/IntrinsicsAArch64.h ---
> *** [llvm/IR/IntrinsicsAArch64.h] Error code 126
>
> make[4]: stopped in /usr/home/tuexen/freebsd-src/lib/clang/libllvm
> --- llvm/Frontend/OpenMP/OMP.h.inc ---
> sh: llvm-tblgen: Exec format error
> *** [llvm/Frontend/OpenMP/OMP.h.inc] Error code 126
>
> make[4]: stopped in /usr/home/tuexen/freebsd-src/lib/clang/libllvm
> 4 errors
>
> make[4]: stopped in /usr/home/tuexen/freebsd-src/lib/clang/libllvm
>
> make[3]: stopped in /usr/home/tuexen/freebsd-src/lib/clang
>
> make[2]: stopped in /usr/home/tuexen/freebsd-src
>        12.89 real        11.86 user         1.14 sys
>
> make[1]: stopped in /usr/home/tuexen/freebsd-src
>
> Any idea what is going wrong?
Hi Michael,

I believe the following diff will function as a workaround for this 
issue (untested by me):

diff --git a/lib/clang/llvm.build.mk b/lib/clang/llvm.build.mk
index 5aff7081fb76..730b1131068e 100644
--- a/lib/clang/llvm.build.mk
+++ b/lib/clang/llvm.build.mk
@@ -104,7 +104,7 @@ CFLAGS+=    -fdata-sections
.if ${LINKER_TYPE} == "mac"
LDFLAGS+=      -Wl,-dead_strip
.else
-LDFLAGS+=      -Wl,--gc-sections
+LDFLAGS+=      -Wl,--gc-sections,-m,elf64lriscv_fbsd
.endif

CXXSTD?=       c++14

CC'ing Jess, who knows the full story here.

Cheers,
Mitchell

>
> Best regards
> Michael
>
>