Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Aug 2023 12:46:25 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        Ronald Klop <ronald@freebsd.org>, Current FreeBSD <freebsd-current@freebsd.org>
Subject:   Re: building with llvm16 pkg fails in tests
Message-ID:  <D3C57620-FA25-4229-B369-AA521E8174F2@yahoo.com>
References:  <D3C57620-FA25-4229-B369-AA521E8174F2.ref@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Ronald Klop <ronald_at_FreeBSD.org> wrote on
Date: Thu, 17 Aug 2023 10:45:06 UTC :

> To save time on my Raspberry Pi I would like to build FreeBSD using a =
llvm pkg instead of llvm in the tree.
>=20
> My /etc/make.conf:
> WITHOUT_TOOLCHAIN=3Dyes
> LD=3D/usr/local/llvm16/bin/ld.lld
> CC=3D/usr/local/llvm16/bin/clang
> CXX=3D/usr/local/llvm16/bin/clang++
> CPP=3D/usr/local/llvm16/bin/clang-cpp
> OBJCOPY=3D/usr/local/llvm16/bin/llvm-objcopy
>=20
> #WITHOUT_CLEAN=3Dyes

More normal would likely be something like (but
expressed just in command line notation below):

make -j$(sysctl -n hw.ncpu) CROSS_TOOLCHAIN=3Dllvm16 =
WITHOUT_TOOLCHAIN=3Dyes buildworld buildkernel

The CROSS_TOOLCHAIN hook is already present and
avoids needing the explicit assignments to LD, CC,
CXX, CPP, and OBJCOPY . (Those presume the host is
compatible with the target, by the way. See below
for notation that does not presume such --but
allows such.)

For reference, CROSS_TOOLCHAIN=3Dllvm16 uses:

# more /usr/local/share/toolchains/llvm16.mk
XCC=3D/usr/local/bin/clang16
XCXX=3D/usr/local/bin/clang++16
XCPP=3D/usr/local/bin/clang-cpp16
XLD=3D/usr/local/bin/ld.lld16
CROSS_BINUTILS_PREFIX=3D/var/empty
X_COMPILER_TYPE=3Dclang

that is installed as part of devel/llvm16 .


> This fails in:
>=20
> /usr/local/llvm16/bin/clang++ -O2 -pipe -fno-common -fPIE =
-Wno-format-zero-length -nobuiltininc -idirafter =
/usr/local/llvm16/lib/clang/16/include -fstack-protector-strong =
-Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter =
-Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch =
-Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Wdate-time =
-Wmissing-variable-declarations -Wno-empty-body -Wno-string-plus-int =
-Wno-unused-const-variable -Wno-error=3Dunused-but-set-parameter -O0 -g0 =
-Qunused-arguments =
-I/usr/obj/usr/src/amd64.amd64/tmp/usr/include/private =
-I/usr/src/contrib/googletest/googlemock/include =
-I/usr/src/contrib/googletest/googlemock =
-I/usr/src/contrib/googletest/googletest/include =
-I/usr/src/contrib/googletest/googletest =
-I/usr/obj/usr/src/amd64.amd64/tmp/usr/include/private =
-DGTEST_HAS_POSIX_RE=3D1 -DGTEST_HAS_PTHREAD=3D1 =
-DGTEST_HAS_STREAM_REDIRECTION=3D1 -frtti -Wno-deprecated-copy =
-Wno-signed-unsigned-wchar -DGTEST_HAS_POSIX_RE=3D1 =
-DGTEST_HAS_PTHREAD=3D1 -DGTEST_HAS_STREAM_REDIRECTION=3D1 -frtti =
-Wno-deprecated-copy -Wno-signed-unsigned-wchar -fPIE -std=3Dc++14 =
-Wno-deprecated-copy -Wno-error=3Dinconsistent-missing-override =
-Wno-error=3Dmissing-variable-declarations -Wno-error=3Dsign-compare =
-Wno-error=3Dunused-parameter -Wno-c++11-extensions -Wl,-zrelro -pie =
--ld-path=3D/usr/local/llvm16/bin/ld.lld -o gmock-actions_test =
gmock-actions_test.o -lprivategmock_main -lprivategmock -lprivategtest
> ld.lld: error: undefined symbol: =
testing::internal::DeathTest::Create(char const*, =
testing::Matcher<std::__1::basic_string<char, =
std::__1::char_traits<char>, std::__1::allocator<char>> const&>, char =
const*, int, testing::internal::DeathTest**)
> >>> referenced by gmock-actions_test.cc
> >>> gmock-actions_test.o:(testing::(anonymous =
namespace)::BuiltInDefaultValueDeathTest_IsUndefinedForReferences_Test::Te=
stBody())
> >>> referenced by gmock-actions_test.cc
> >>> gmock-actions_test.o:(testing::(anonymous =
namespace)::BuiltInDefaultValueDeathTest_IsUndefinedForReferences_Test::Te=
stBody())
> >>> referenced by gmock-actions_test.cc
> >>> gmock-actions_test.o:(testing::(anonymous =
namespace)::BuiltInDefaultValueDeathTest_IsUndefinedForNonDefaultConstruct=
ibleType_Test::TestBody())
> >>> referenced 4 more times
>=20
> ld.lld: error: undefined symbol: =
testing::Expectation::Expectation(std::__1::shared_ptr<testing::internal::=
ExpectationBase> const&)

I'm not making claims about the specifics of this error
being produced vs. not the "more normal" way. But it would
be worth a try.

> Any thoughts on how to fix this?
> Compiling with the in tree llvm does work properly.
>=20
> NB: building 14-CURRENT in a 14-CURRENT jail on 13.2-RELEASE. And this =
example is my test on amd64 to make it work before I will do this in the =
slow RPI4.



=3D=3D=3D
Mark Millard
marklmi at yahoo.com




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D3C57620-FA25-4229-B369-AA521E8174F2>