Is amd64 buildworld supposed to be working for WITH_ASAN= WITH_UBSAN= (both used)? [It fails to link various things.]

From: Mark Millard via freebsd-current <freebsd-current_at_freebsd.org>
Date: Wed, 29 Dec 2021 20:28:39 UTC
In order to avoid the following for WITH_ASAN= WITH_UBSAN= (both used),
so also WITH_LLVM_BINUTILS= in use:

--- all_subdir_usr.bin/clang ---
--- llvm-as.full ---
ld: error: undefined symbol: compressBound
>>> referenced by Compression.cpp:51 (/usr/main-src/contrib/llvm-project/llvm/lib/Support/Compression.cpp:51)
>>>               Compression.o:(llvm::zlib::compress(llvm::StringRef, llvm::SmallVectorImpl<char>&, int)) in archive /usr/obj/BUILDs/main-amd64-nodbg-clang-alt/usr/main-src/amd64.amd64/lib/clang/libllvm/libllvm.a
. . .
ld: error: undefined symbol: compress2
. . .
ld: error: undefined symbol: uncompress
. . .
ld: error: undefined symbol: crc32
>>> referenced by Compression.cpp:85 (/usr/main-src/contrib/llvm-project/llvm/lib/Support/Compression.cpp:85)
>>>               Compression.o:(llvm::zlib::crc32(llvm::StringRef)) in archive /usr/obj/BUILDs/main-amd64-nodbg-clang-alt/usr/main-src/amd64.amd64/lib/clang/libllvm/libllvm.a

I hacked in:

# git -C /usr/main-src/ diff /usr/main-src/usr.bin/clang/
diff --git a/usr.bin/clang/llvm.prog.mk b/usr.bin/clang/llvm.prog.mk
index 3a708805d3ea..74bed2ecd314 100644
--- a/usr.bin/clang/llvm.prog.mk
+++ b/usr.bin/clang/llvm.prog.mk
@@ -25,6 +25,7 @@ PACKAGE=      clang
 .if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING)
 LIBADD+=       execinfo
 LIBADD+=       tinfow
+LIBADD+=       z
 .endif
 LIBADD+=       pthread

which avoided the specific problem.

But the next build attempt then got for missing Apple ObjC stuff
and something involving the name renderscript :

--- lldb.full ---
ld: error: undefined symbol: lldb_private::formatters::CMTimeSummaryProvider(lldb_private::ValueObject&, lldb_private::Stream&, lldb_private::TypeSummaryOptions const&)
>>> referenced by compressed_pair.h:61 (/usr/obj/BUILDs/main-amd64-nodbg-clang-alt/usr/main-src/amd64.amd64/tmp/usr/include/c++/v1/__memory/compressed_pair.h:61)
>>>               ObjCLanguage.o:(void std::__1::__call_once_proxy<std::__1::tuple<lldb_private::ObjCLanguage::GetFormatters()::$_0&&> >(void*)) in archive /usr/obj/BUILDs/main-amd64-nodbg-clang-alt/usr/main-src/amd64.amd64/lib/clang/liblldb/liblldb.a
ld: error: undefined symbol: lldb_private::AppleObjCRuntimeV2::Initialize()
. . .
ld: error: undefined symbol: lldb_private::CFBasicHash::IsValid() const
>>> referenced by NSDictionary.cpp:715 (/usr/main-src/contrib/llvm-project/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp:715)
>>>               NSDictionary.o:(lldb_private::formatters::NSCFDictionarySyntheticFrontEnd::CalculateNumChildren()) in archive /usr/obj/BUILDs/main-amd64-nodbg-clang-alt/usr/main-src/amd64.amd64/lib/clang/liblldb/liblldb.a
>>> referenced by NSSet.cpp:564 (/usr/main-src/contrib/llvm-project/lldb/source/Plugins/Language/ObjC/NSSet.cpp:564)
>>>               NSSet.o:(lldb_private::formatters::NSCFSetSyntheticFrontEnd::CalculateNumChildren()) in archive /usr/obj/BUILDs/main-amd64-nodbg-clang-alt/usr/main-src/amd64.amd64/lib/clang/liblldb/liblldb.a
. . .
ld: error: undefined symbol: lldb_private::lldb_renderscript::fixupX86FunctionCalls(llvm::Module&)
. . .

Is the "ObjC" related material and the "renderscript" related
material even supposed to be referenced or linked in? If yes,
what is missing to allow the links to complete.

I've not tried to get past this. There could be more that
fails to build after lldb.


I'm not sure if WITH_ASAN= WITH_UBSAN= is supposed to do
anything for buildkernel but I've not managed to get a
buildworld to finish everything yet.


May be src.conf is just ahead of what the build environment
is set up for?


For reference, at the time I was having the following build
itself with the WITH_ASAN= WITH_UBSAN= added (manually
line-split for readability):

# uname -apKU
FreeBSD amd64_ZFS 14.0-CURRENT FreeBSD 14.0-CURRENT #21
main-n252010-254e4e5b77d7-dirty: Tue Dec 28 15:54:08 PST 2021
root@amd64_ZFS:/usr/obj/BUILDs/main-amd64-nodbg-clang/usr/main-src/amd64.amd64/sys/GENERIC-NODBG
amd64 amd64 1400045 1400045



===
Mark Millard
marklmi at yahoo.com