AOSP build error- ld.lld: error: undefined symbol: v8::internal

I am trying to build AOSP for Hikey960 board. I have followed the steps from this link: https://source.android.com/setup/build/devices

I am building the hikey960-userdebug itself as per the link, on a 64 bit Ubuntu 16.04 in VirtualBox.

While compiling the userspace code, the build fails with the following error:

[  3% 106/3275] //external/chromium-libpac:libpac link libpac.so [arm]
FAILED: out/soong/.intermediates/external/chromium-libpac/libpac/android_arm_armv8-a_cortex-a73_core_shared_com.android.runtime.debug/unstripped/libpac.so
prebuilts/clang/host/linux-x86/clang-r353983d/bin/clang++ out/soong/.intermediates/bionic/libc/crtbegin_so/android_arm_armv8-a_cortex-a73_core_com.android.runtime.debug/crtbegin_so.o @out/soong/.intermediates/external/chromium-libpac/libpac/android_arm_armv8-a_cortex-a73_core_shared_com.android.runtime.debug/unstripped/libpac.so.rsp out/soong/.intermediates/external/v8/libv8/android_arm_armv8-a_cortex-a73_core_static_com.android.runtime.debug/libv8.a out/soong/.intermediates/external/libunwind_llvm/libunwind_llvm/android_arm_armv8-a_cortex-a73_core_static_com.android.runtime.debug/libunwind_llvm.a prebuilts/clang/host/linux-x86/clang-r353983d/lib64/clang/9.0.4/lib/linux/libclang_rt.builtins-arm-android.a prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/arm-linux-androideabi/lib/libatomic.a out/soong/.intermediates/build/soong/libgcc_stripped/android_arm_armv8-a_cortex-a73_core_static_com.android.runtime.debug/libgcc_stripped.a out/soong/.intermediates/system/core/liblog/liblog/android_arm_armv8-a_cortex-a73_core_shared_10000_com.android.runtime.debug/liblog.so out/soong/.intermediates/external/icu/icu4c/source/common/libicuuc/android_arm_armv8-a_cortex-a73_core_shared_com.android.runtime.debug/libicuuc.so out/soong/.intermediates/external/icu/icu4c/source/i18n/libicui18n/android_arm_armv8-a_cortex-a73_core_shared_com.android.runtime.debug/libicui18n.so out/soong/.intermediates/external/libcxx/libc++/android_arm_armv8-a_cortex-a73_core_shared_com.android.runtime.debug/libc++.so out/soong/.intermediates/bionic/libc/libc/android_arm_armv8-a_cortex-a73_core_shared_com.android.runtime.debug/libc.so out/soong/.intermediates/bionic/libm/libm/android_arm_armv8-a_cortex-a73_core_shared_com.android.runtime.debug/libm.so out/soong/.intermediates/bionic/libdl/libdl/android_arm_armv8-a_cortex-a73_core_shared_com.android.runtime.debug/libdl.so out/soong/.intermediates/bionic/libc/crtend_so/android_arm_armv8-a_cortex-a73_core_com.android.runtime.debug/obj/bionic/libc/arch-common/bionic/crtend_so.o -o out/soong/.intermediates/external/chromium-libpac/libpac/android_arm_armv8-a_cortex-a73_core_shared_com.android.runtime.debug/unstripped/libpac.so -nostdlib -Wl,--gc-sections -shared -Wl,-soname,libpac.so -target armv7a-linux-androideabi -Bprebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/arm-linux-androideabi/bin -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--build-id=md5 -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--no-undefined-version -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_stripped.a -fuse-ld=lld -Wl,--pack-dyn-relocs=android+relr -Wl,--use-android-relr-tags -Wl,--no-undefined -Wl,--icf=safe -Wl,--hash-style=gnu -Wl,-m,armelf  -Wl,--exclude-libs,libunwind_llvm.a
ld.lld: error: undefined symbol: v8::internal::RuntimeCallStats::Enter(v8::internal::RuntimeCallStats*, v8::internal::RuntimeCallTimer*, v8::internal::RuntimeCallCounter v8::internal::RuntimeCallStats::*)
>>> referenced by counters.h:924 (external/v8/src/counters.h:924)
>>>               api.o:(v8::V8::GlobalizeReference(v8::internal::Isolate*, v8::internal::Object**)) in archive out/soong/.intermediates/external/v8/libv8/android_arm_armv8-a_cortex-a73_core_static_com.android.runtime.debug/libv8.a

ld.lld: error: undefined symbol: v8::internal::RuntimeCallStats::Leave(v8::internal::RuntimeCallStats*, v8::internal::RuntimeCallTimer*)
>>> referenced by counters.h:916 (external/v8/src/counters.h:916)
>>>               api.o:(v8::V8::GlobalizeReference(v8::internal::Isolate*, v8::internal::Object**)) in archive out/soong/.intermediates/external/v8/libv8/android_arm_armv8-a_cortex-a73_core_static_com.android.runtime.debug/libv8.a

ld.lld: error: undefined symbol: v8::internal::RuntimeCallStats::Enter(v8::internal::RuntimeCallStats*, v8::internal::RuntimeCallTimer*, v8::internal::RuntimeCallCounter v8::internal::RuntimeCallStats::*)
>>> referenced by counters.h:924 (external/v8/src/counters.h:924)
>>>               api.o:(v8::ObjectTemplateNew(v8::internal::Isolate*, v8::Local<v8::FunctionTemplate>, bool)) in archive out/soong/.intermediates/external/v8/libv8/android_arm_armv8-a_cortex-a73_core_static_com.android.runtime.debug/libv8.a

ld.lld: error: undefined symbol: v8::internal::RuntimeCallStats::Leave(v8::internal::RuntimeCallStats*, v8::internal::RuntimeCallTimer*)
>>> referenced by counters.h:916 (external/v8/src/counters.h:916)
>>>               api.o:(v8::ObjectTemplateNew(v8::internal::Isolate*, v8::Local<v8::FunctionTemplate>, bool)) in archive out/soong/.intermediates/external/v8/libv8/android_arm_armv8-a_cortex-a73_core_static_com.android.runtime.debug/libv8.a

ld.lld: error: undefined symbol: v8::internal::RuntimeCallStats::Enter(v8::internal::RuntimeCallStats*, v8::internal::RuntimeCallTimer*, v8::internal::RuntimeCallCounter v8::internal::RuntimeCallStats::*)
>>> referenced by counters.h:924 (external/v8/src/counters.h:924)
>>>               api.o:(v8::FunctionTemplate::New(v8::Isolate*, void (*)(v8::FunctionCallbackInfo<v8::Value> const&), v8::Local<v8::Value>, v8::Local<v8::Signature>, int, v8::ConstructorBehavior)) in archive out/soong/.intermediates/external/v8/libv8/android_arm_armv8-a_cortex-a73_core_static_com.android.runtime.debug/libv8.a

ld.lld: error: undefined symbol: v8::internal::RuntimeCallStats::Leave(v8::internal::RuntimeCallStats*, v8::internal::RuntimeCallTimer*)
>>> referenced by counters.h:916 (external/v8/src/counters.h:916)
>>>               api.o:(v8::FunctionTemplate::New(v8::Isolate*, void (*)(v8::FunctionCallbackInfo<v8::Value> const&), v8::Local<v8::Value>, v8::Local<v8::Signature>, int, v8::ConstructorBehavior)) in archive out/soong/.intermediates/external/v8/libv8/android_arm_armv8-a_cortex-a73_core_static_com.android.runtime.debug/libv8.a

ld.lld: error: undefined symbol: v8::internal::HistogramTimer::Start()
>>> referenced by counters.h:287 (external/v8/src/counters.h:287)
>>>               api.o:(v8::Script::Run(v8::Local<v8::Context>)) in archive out/soong/.intermediates/external/v8/libv8/android_arm_armv8-a_cortex-a73_core_static_com.android.runtime.debug/libv8.a

ld.lld: error: undefined symbol: v8::internal::Histogram::AddSample(int)
>>> referenced by counters.h:330 (external/v8/src/counters.h:330)
>>>               api.o:(v8::Script::Run(v8::Local<v8::Context>)) in archive out/soong/.intermediates/external/v8/libv8/android_arm_armv8-a_cortex-a73_core_static_com.android.runtime.debug/libv8.a

ld.lld: error: undefined symbol: v8::internal::HistogramTimer::Stop()
>>> referenced by counters.h:296 (external/v8/src/counters.h:296)
>>>               api.o:(v8::Script::Run(v8::Local<v8::Context>)) in archive out/soong/.intermediates/external/v8/libv8/android_arm_armv8-a_cortex-a73_core_static_com.android.runtime.debug/libv8.a

ld.lld: error: undefined symbol: v8::internal::RuntimeCallStats::Enter(v8::internal::RuntimeCallStats*, v8::internal::RuntimeCallTimer*, v8::internal::RuntimeCallCounter v8::internal::RuntimeCallStats::*)
>>> referenced by counters.h:924 (external/v8/src/counters.h:924)
>>>               api.o:(v8::Script::Run(v8::Local<v8::Context>)) in archive out/soong/.intermediates/external/v8/libv8/android_arm_armv8-a_cortex-a73_core_static_com.android.runtime.debug/libv8.a

ld.lld: error: undefined symbol: v8::internal::RuntimeCallStats::Leave(v8::internal::RuntimeCallStats*, v8::internal::RuntimeCallTimer*)
>>> referenced by counters.h:916 (external/v8/src/counters.h:916)
>>>               api.o:(v8::Script::Run(v8::Local<v8::Context>)) in archive out/soong/.intermediates/external/v8/libv8/android_arm_armv8-a_cortex-a73_core_static_com.android.runtime.debug/libv8.a

ld.lld: error: undefined symbol: v8::internal::HistogramTimer::Start()
>>> referenced by counters.h:287 (external/v8/src/counters.h:287)
>>>               api.o:(v8::ScriptCompiler::CompileUnboundInternal(v8::Isolate*, v8::ScriptCompiler::Source*, v8::ScriptCompiler::CompileOptions)) in archive out/soong/.intermediates/external/v8/libv8/android_arm_armv8-a_cortex-a73_core_static_com.android.runtime.debug/libv8.a

ld.lld: error: undefined symbol: v8::internal::HistogramTimer::Stop()
>>> referenced by counters.h:296 (external/v8/src/counters.h:296)
>>>               api.o:(v8::ScriptCompiler::CompileUnboundInternal(v8::Isolate*, v8::ScriptCompiler::Source*, v8::ScriptCompiler::CompileOptions)) in archive out/soong/.intermediates/external/v8/libv8/android_arm_armv8-a_cortex-a73_core_static_com.android.runtime.debug/libv8.a

ld.lld: error: undefined symbol: v8::internal::HistogramTimer::Stop()
>>> referenced by counters.h:296 (external/v8/src/counters.h:296)
>>>               api.o:(v8::ScriptCompiler::CompileUnboundInternal(v8::Isolate*, v8::ScriptCompiler::Source*, v8::ScriptCompiler::CompileOptions)) in archive out/soong/.intermediates/external/v8/libv8/android_arm_armv8-a_cortex-a73_core_static_com.android.runtime.debug/libv8.a

ld.lld: error: undefined symbol: v8::internal::RuntimeCallStats::Enter(v8::internal::RuntimeCallStats*, v8::internal::RuntimeCallTimer*, v8::internal::RuntimeCallCounter v8::internal::RuntimeCallStats::*)
>>> referenced by counters.h:924 (external/v8/src/counters.h:924)
>>>               api.o:(v8::ScriptCompiler::CompileUnboundInternal(v8::Isolate*, v8::ScriptCompiler::Source*, v8::ScriptCompiler::CompileOptions)) in archive out/soong/.intermediates/external/v8/libv8/android_arm_armv8-a_cortex-a73_core_static_com.android.runtime.debug/libv8.a

ld.lld: error: undefined symbol: v8::internal::RuntimeCallStats::Enter(v8::internal::RuntimeCallStats*, v8::internal::RuntimeCallTimer*, v8::internal::RuntimeCallCounter v8::internal::RuntimeCallStats::*)
>>> referenced by counters.h:924 (external/v8/src/counters.h:924)
>>>               api.o:(v8::Value::ToString(v8::Local<v8::Context>) const) in archive out/soong/.intermediates/external/v8/libv8/android_arm_armv8-a_cortex-a73_core_static_com.android.runtime.debug/libv8.a

ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
clang-9: error: linker command failed with exit code 1 (use -v to see invocation)

I have removed a few ld.ldd:error: undefined symbol as they are similar to the ones already posted in the above section.

AOSP master breaks frequenty. Usually the problem is transient.
Try a known good manifest: https://github.com/96boards/aosp-known-good-manifests