All of lore.kernel.org
 help / color / mirror / Atom feed
* Failed to build bpf selftest testcases based on upstream master branch
@ 2021-08-01 16:47 范开喜
  2021-08-01 21:46 ` Vincent Li
  0 siblings, 1 reply; 3+ messages in thread
From: 范开喜 @ 2021-08-01 16:47 UTC (permalink / raw)
  To: bpf; +Cc: daniel, ast

Hi all,

I failed to make bpf selftest testcases based on the upstream master
branch. And I need help to fix it.

After installing the new kernel and modules,  I have tried following
commands to build bpf testcases:
"
cd ~/dev/linux/tools/testing/selftests/bpf
make
"

Then error message shows up as follows:
"
INSTALL bpftool
  GEN      vmlinux.h
  CLNG-BPF [test_maps] btf__core_reloc_primitives___err_non_ptr.o
  CLNG-BPF [test_maps] test_global_data.o
  CLNG-BPF [test_maps] test_global_func8.o
  CLNG-BPF [test_maps] test_ksyms_btf_null_check.o
  CLNG-BPF [test_maps] linked_funcs2.o
  CLNG-BPF [test_maps] bpf_iter_test_kern5.o
  CLNG-BPF [test_maps] test_static_linked2.o
  CLNG-BPF [test_maps] test_global_func13.o
  CLNG-BPF [test_maps] test_cls_redirect_subprogs.o
  CLNG-BPF [test_maps] test_core_reloc_nesting.o
  CLNG-BPF [test_maps] tailcall_bpf2bpf1.o
  CLNG-BPF [test_maps] test_endian.o
  CLNG-BPF [test_maps] test_cls_redirect.o
  CLNG-BPF [test_maps] btf__core_reloc_type_based___incompat.o
  CLNG-BPF [test_maps] test_btf_newkv.o
  CLNG-BPF [test_maps] pyperf600.o
  CLNG-BPF [test_maps] test_btf_nokv.o
  CLNG-BPF [test_maps] atomics.o
fatal error: error in backend: line 27: Invalid usage of the XADD return value
PLEASE submit a bug report to https://bugs.llvm.org/ and include the
crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.        Program arguments: clang -g -D__TARGET_ARCH_x86
-mlittle-endian
-I/root/dev/linux/tools/testing/selftests/bpf/tools/include
-I/root/dev/linux/tools/testing/selftests/bpf
-I/root/dev/linux/tools/include/uapi
-I/root/dev/linux/tools/testing/selftests/usr/include -idirafter
/usr/local/include -idirafter
/usr/lib/llvm-11/lib/clang/11.1.0/include -idirafter
/usr/include/x86_64-linux-gnu -idirafter /usr/include
-Wno-compare-distinct-pointer-types -DENABLE_ATOMICS_TESTS -O2 -target
bpf -c progs/atomics.c -o
/root/dev/linux/tools/testing/selftests/bpf/atomics.o -mcpu=v3
1.        <eof> parser at end of file
2.        Code generation
3.        Running pass 'Function Pass Manager' on module 'progs/atomics.c'.
4.        Running pass 'BPF PreEmit Checking' on function '@add'
 #0 0x00007f81ec29ee8f llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xbbae8f)
 #1 0x00007f81ec29d200 llvm::sys::RunSignalHandlers()
(/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xbb9200)
 #2 0x00007f81ec29e5dd llvm::sys::CleanupOnSignal(unsigned long)
(/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xbba5dd)
 #3 0x00007f81ec1e6d2a (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xb02d2a)
 #4 0x00007f81ec1e6ccb (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xb02ccb)
 #5 0x00007f81ec299d4e (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xbb5d4e)
 #6 0x00000000004134f2 (/usr/lib/llvm-11/bin/clang+0x4134f2)
 #7 0x00007f81ec1f2d4f llvm::report_fatal_error(llvm::Twine const&,
bool) (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xb0ed4f)
 #8 0x00007f81ec1f2e27 (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xb0ee27)
 #9 0x00007f81edd55595 (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0x2671595)
#10 0x00007f81ec57339e
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xe8f39e)
#11 0x00007f81ec3ae889
llvm::FPPassManager::runOnFunction(llvm::Function&)
(/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xcca889)
#12 0x00007f81ec3b3eb3 llvm::FPPassManager::runOnModule(llvm::Module&)
(/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xccfeb3)
#13 0x00007f81ec3aeea0
llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xccaea0)
#14 0x00007f81ea068e96
clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&,
llvm::DataLayout const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x164de96)
#15 0x00007f81ea329a36 (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x190ea36)
#16 0x00007f81e93e9093 clang::ParseAST(clang::Sema&, bool, bool)
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x9ce093)
#17 0x00007f81ea9c9c38 clang::FrontendAction::Execute()
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1faec38)
#18 0x00007f81ea97ff11
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1f64f11)
#19 0x00007f81eaa2f6b0
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x20146b0)
#20 0x00000000004131bf cc1_main(llvm::ArrayRef<char const*>, char
const*, void*) (/usr/lib/llvm-11/bin/clang+0x4131bf)
#21 0x00000000004115fe (/usr/lib/llvm-11/bin/clang+0x4115fe)
#22 0x00007f81ea6a9a02 (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1c8ea02)
#23 0x00007f81ec1e6cad
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xb02cad)
#24 0x00007f81ea6a8f2f
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1c8df2f)
#25 0x00007f81ea680d5f
clang::driver::Compilation::ExecuteCommand(clang::driver::Command
const&, clang::driver::Command const*&) const
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1c65d5f)
#26 0x00007f81ea680f07
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>
>&) const (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1c65f07)
#27 0x00007f81ea694a7c
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>
>&) (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1c79a7c)
#28 0x00000000004110a3 main (/usr/lib/llvm-11/bin/clang+0x4110a3)
#29 0x00007f81e855b09b __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2409b)
#30 0x000000000040e89a _start (/usr/lib/llvm-11/bin/clang+0x40e89a)
make: *** [Makefile:470:
/root/dev/linux/tools/testing/selftests/bpf/atomics.o] Error 1
"

I am using a virtual machine with 8 cpus. The kernel and clang version are:
"
kernel: 5.14.0-rc3.bm.1-amd64 #4 SMP Sun Aug 1 23:28:24 CST 2021
x86_64 GNU/Linux
clang: Debian clang version
11.1.0-++20210622113218+1fdec59bffc1-1~exp1~20210622213839.163
"

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Failed to build bpf selftest testcases based on upstream master branch
  2021-08-01 16:47 Failed to build bpf selftest testcases based on upstream master branch 范开喜
@ 2021-08-01 21:46 ` Vincent Li
  2021-08-03 11:46   ` [External] " 范开喜
  0 siblings, 1 reply; 3+ messages in thread
From: Vincent Li @ 2021-08-01 21:46 UTC (permalink / raw)
  To: 范开喜; +Cc: bpf, daniel, ast

On Sun, Aug 1, 2021 at 9:48 AM 范开喜 <fankaixi.li@bytedance.com> wrote:
>
> Hi all,
>
> I failed to make bpf selftest testcases based on the upstream master
> branch. And I need help to fix it.
>
> After installing the new kernel and modules,  I have tried following
> commands to build bpf testcases:
> "
> cd ~/dev/linux/tools/testing/selftests/bpf
> make
> "
>
> Then error message shows up as follows:
> "
> INSTALL bpftool
>   GEN      vmlinux.h
>   CLNG-BPF [test_maps] btf__core_reloc_primitives___err_non_ptr.o
>   CLNG-BPF [test_maps] test_global_data.o
>   CLNG-BPF [test_maps] test_global_func8.o
>   CLNG-BPF [test_maps] test_ksyms_btf_null_check.o
>   CLNG-BPF [test_maps] linked_funcs2.o
>   CLNG-BPF [test_maps] bpf_iter_test_kern5.o
>   CLNG-BPF [test_maps] test_static_linked2.o
>   CLNG-BPF [test_maps] test_global_func13.o
>   CLNG-BPF [test_maps] test_cls_redirect_subprogs.o
>   CLNG-BPF [test_maps] test_core_reloc_nesting.o
>   CLNG-BPF [test_maps] tailcall_bpf2bpf1.o
>   CLNG-BPF [test_maps] test_endian.o
>   CLNG-BPF [test_maps] test_cls_redirect.o
>   CLNG-BPF [test_maps] btf__core_reloc_type_based___incompat.o
>   CLNG-BPF [test_maps] test_btf_newkv.o
>   CLNG-BPF [test_maps] pyperf600.o
>   CLNG-BPF [test_maps] test_btf_nokv.o
>   CLNG-BPF [test_maps] atomics.o
> fatal error: error in backend: line 27: Invalid usage of the XADD return value
> PLEASE submit a bug report to https://bugs.llvm.org/ and include the
> crash backtrace, preprocessed source, and associated run script.
> Stack dump:
> 0.        Program arguments: clang -g -D__TARGET_ARCH_x86
> -mlittle-endian
> -I/root/dev/linux/tools/testing/selftests/bpf/tools/include
> -I/root/dev/linux/tools/testing/selftests/bpf
> -I/root/dev/linux/tools/include/uapi
> -I/root/dev/linux/tools/testing/selftests/usr/include -idirafter
> /usr/local/include -idirafter
> /usr/lib/llvm-11/lib/clang/11.1.0/include -idirafter
> /usr/include/x86_64-linux-gnu -idirafter /usr/include
> -Wno-compare-distinct-pointer-types -DENABLE_ATOMICS_TESTS -O2 -target
> bpf -c progs/atomics.c -o
> /root/dev/linux/tools/testing/selftests/bpf/atomics.o -mcpu=v3
> 1.        <eof> parser at end of file
> 2.        Code generation
> 3.        Running pass 'Function Pass Manager' on module 'progs/atomics.c'.
> 4.        Running pass 'BPF PreEmit Checking' on function '@add'
>  #0 0x00007f81ec29ee8f llvm::sys::PrintStackTrace(llvm::raw_ostream&)
> (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xbbae8f)
>  #1 0x00007f81ec29d200 llvm::sys::RunSignalHandlers()
> (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xbb9200)
>  #2 0x00007f81ec29e5dd llvm::sys::CleanupOnSignal(unsigned long)
> (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xbba5dd)
>  #3 0x00007f81ec1e6d2a (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xb02d2a)
>  #4 0x00007f81ec1e6ccb (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xb02ccb)
>  #5 0x00007f81ec299d4e (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xbb5d4e)
>  #6 0x00000000004134f2 (/usr/lib/llvm-11/bin/clang+0x4134f2)
>  #7 0x00007f81ec1f2d4f llvm::report_fatal_error(llvm::Twine const&,
> bool) (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xb0ed4f)
>  #8 0x00007f81ec1f2e27 (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xb0ee27)
>  #9 0x00007f81edd55595 (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0x2671595)
> #10 0x00007f81ec57339e
> llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
> (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xe8f39e)
> #11 0x00007f81ec3ae889
> llvm::FPPassManager::runOnFunction(llvm::Function&)
> (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xcca889)
> #12 0x00007f81ec3b3eb3 llvm::FPPassManager::runOnModule(llvm::Module&)
> (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xccfeb3)
> #13 0x00007f81ec3aeea0
> llvm::legacy::PassManagerImpl::run(llvm::Module&)
> (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xccaea0)
> #14 0x00007f81ea068e96
> clang::EmitBackendOutput(clang::DiagnosticsEngine&,
> clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
> clang::TargetOptions const&, clang::LangOptions const&,
> llvm::DataLayout const&, llvm::Module*, clang::BackendAction,
> std::unique_ptr<llvm::raw_pwrite_stream,
> std::default_delete<llvm::raw_pwrite_stream> >)
> (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x164de96)
> #15 0x00007f81ea329a36 (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x190ea36)
> #16 0x00007f81e93e9093 clang::ParseAST(clang::Sema&, bool, bool)
> (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x9ce093)
> #17 0x00007f81ea9c9c38 clang::FrontendAction::Execute()
> (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1faec38)
> #18 0x00007f81ea97ff11
> clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
> (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1f64f11)
> #19 0x00007f81eaa2f6b0
> clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
> (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x20146b0)
> #20 0x00000000004131bf cc1_main(llvm::ArrayRef<char const*>, char
> const*, void*) (/usr/lib/llvm-11/bin/clang+0x4131bf)
> #21 0x00000000004115fe (/usr/lib/llvm-11/bin/clang+0x4115fe)
> #22 0x00007f81ea6a9a02 (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1c8ea02)
> #23 0x00007f81ec1e6cad
> llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
> (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xb02cad)
> #24 0x00007f81ea6a8f2f
> clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
> >, std::__cxx11::basic_string<char, std::char_traits<char>,
> std::allocator<char> >*, bool*) const
> (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1c8df2f)
> #25 0x00007f81ea680d5f
> clang::driver::Compilation::ExecuteCommand(clang::driver::Command
> const&, clang::driver::Command const*&) const
> (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1c65d5f)
> #26 0x00007f81ea680f07
> clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
> llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>
> >&) const (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1c65f07)
> #27 0x00007f81ea694a7c
> clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
> llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>
> >&) (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1c79a7c)
> #28 0x00000000004110a3 main (/usr/lib/llvm-11/bin/clang+0x4110a3)
> #29 0x00007f81e855b09b __libc_start_main
> (/lib/x86_64-linux-gnu/libc.so.6+0x2409b)
> #30 0x000000000040e89a _start (/usr/lib/llvm-11/bin/clang+0x40e89a)
> make: *** [Makefile:470:
> /root/dev/linux/tools/testing/selftests/bpf/atomics.o] Error 1
> "
>
> I am using a virtual machine with 8 cpus. The kernel and clang version are:
> "
> kernel: 5.14.0-rc3.bm.1-amd64 #4 SMP Sun Aug 1 23:28:24 CST 2021
> x86_64 GNU/Linux
> clang: Debian clang version
> 11.1.0-++20210622113218+1fdec59bffc1-1~exp1~20210622213839.163
> "

I think I ran into same issue if I recall correctly, I downloaded
llvm-project 12.0.1 and follow the instruction in kernel
Documentation/bpf/bpf_devel_QA.rst

"
Q: Got it, so how do I build LLVM manually anyway?
....You need ninja, cmake and gcc-c++ as build requisites for LLVM.
Once you
have that set up, proceed with building the latest LLVM and clang
version
from the git repositories::

    $ git clone https://github.com/llvm/llvm-project.git
     $ mkdir -p llvm-project/llvm/build
     $ cd llvm-project/llvm/build
     $ cmake .. -G "Ninja" -DLLVM_TARGETS_TO_BUILD="BPF;X86" \
                -DLLVM_ENABLE_PROJECTS="clang"    \
                -DCMAKE_BUILD_TYPE=Release        \
                -DLLVM_BUILD_RUNTIME=OFF
     $ ninja
"

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [External] Re: Failed to build bpf selftest testcases based on upstream master branch
  2021-08-01 21:46 ` Vincent Li
@ 2021-08-03 11:46   ` 范开喜
  0 siblings, 0 replies; 3+ messages in thread
From: 范开喜 @ 2021-08-03 11:46 UTC (permalink / raw)
  To: Vincent Li; +Cc: bpf, daniel, ast

Vincent Li <vincent.mc.li@gmail.com> 于2021年8月2日周一 上午5:46写道:
>
> On Sun, Aug 1, 2021 at 9:48 AM 范开喜 <fankaixi.li@bytedance.com> wrote:
> >
> > Hi all,
> >
> > I failed to make bpf selftest testcases based on the upstream master
> > branch. And I need help to fix it.
> >
> > After installing the new kernel and modules,  I have tried following
> > commands to build bpf testcases:
> > "
> > cd ~/dev/linux/tools/testing/selftests/bpf
> > make
> > "
> >
> > Then error message shows up as follows:
> > "
> > INSTALL bpftool
> >   GEN      vmlinux.h
> >   CLNG-BPF [test_maps] btf__core_reloc_primitives___err_non_ptr.o
> >   CLNG-BPF [test_maps] test_global_data.o
> >   CLNG-BPF [test_maps] test_global_func8.o
> >   CLNG-BPF [test_maps] test_ksyms_btf_null_check.o
> >   CLNG-BPF [test_maps] linked_funcs2.o
> >   CLNG-BPF [test_maps] bpf_iter_test_kern5.o
> >   CLNG-BPF [test_maps] test_static_linked2.o
> >   CLNG-BPF [test_maps] test_global_func13.o
> >   CLNG-BPF [test_maps] test_cls_redirect_subprogs.o
> >   CLNG-BPF [test_maps] test_core_reloc_nesting.o
> >   CLNG-BPF [test_maps] tailcall_bpf2bpf1.o
> >   CLNG-BPF [test_maps] test_endian.o
> >   CLNG-BPF [test_maps] test_cls_redirect.o
> >   CLNG-BPF [test_maps] btf__core_reloc_type_based___incompat.o
> >   CLNG-BPF [test_maps] test_btf_newkv.o
> >   CLNG-BPF [test_maps] pyperf600.o
> >   CLNG-BPF [test_maps] test_btf_nokv.o
> >   CLNG-BPF [test_maps] atomics.o
> > fatal error: error in backend: line 27: Invalid usage of the XADD return value
> > PLEASE submit a bug report to https://bugs.llvm.org/ and include the
> > crash backtrace, preprocessed source, and associated run script.
> > Stack dump:
> > 0.        Program arguments: clang -g -D__TARGET_ARCH_x86
> > -mlittle-endian
> > -I/root/dev/linux/tools/testing/selftests/bpf/tools/include
> > -I/root/dev/linux/tools/testing/selftests/bpf
> > -I/root/dev/linux/tools/include/uapi
> > -I/root/dev/linux/tools/testing/selftests/usr/include -idirafter
> > /usr/local/include -idirafter
> > /usr/lib/llvm-11/lib/clang/11.1.0/include -idirafter
> > /usr/include/x86_64-linux-gnu -idirafter /usr/include
> > -Wno-compare-distinct-pointer-types -DENABLE_ATOMICS_TESTS -O2 -target
> > bpf -c progs/atomics.c -o
> > /root/dev/linux/tools/testing/selftests/bpf/atomics.o -mcpu=v3
> > 1.        <eof> parser at end of file
> > 2.        Code generation
> > 3.        Running pass 'Function Pass Manager' on module 'progs/atomics.c'.
> > 4.        Running pass 'BPF PreEmit Checking' on function '@add'
> >  #0 0x00007f81ec29ee8f llvm::sys::PrintStackTrace(llvm::raw_ostream&)
> > (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xbbae8f)
> >  #1 0x00007f81ec29d200 llvm::sys::RunSignalHandlers()
> > (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xbb9200)
> >  #2 0x00007f81ec29e5dd llvm::sys::CleanupOnSignal(unsigned long)
> > (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xbba5dd)
> >  #3 0x00007f81ec1e6d2a (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xb02d2a)
> >  #4 0x00007f81ec1e6ccb (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xb02ccb)
> >  #5 0x00007f81ec299d4e (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xbb5d4e)
> >  #6 0x00000000004134f2 (/usr/lib/llvm-11/bin/clang+0x4134f2)
> >  #7 0x00007f81ec1f2d4f llvm::report_fatal_error(llvm::Twine const&,
> > bool) (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xb0ed4f)
> >  #8 0x00007f81ec1f2e27 (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xb0ee27)
> >  #9 0x00007f81edd55595 (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0x2671595)
> > #10 0x00007f81ec57339e
> > llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
> > (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xe8f39e)
> > #11 0x00007f81ec3ae889
> > llvm::FPPassManager::runOnFunction(llvm::Function&)
> > (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xcca889)
> > #12 0x00007f81ec3b3eb3 llvm::FPPassManager::runOnModule(llvm::Module&)
> > (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xccfeb3)
> > #13 0x00007f81ec3aeea0
> > llvm::legacy::PassManagerImpl::run(llvm::Module&)
> > (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xccaea0)
> > #14 0x00007f81ea068e96
> > clang::EmitBackendOutput(clang::DiagnosticsEngine&,
> > clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
> > clang::TargetOptions const&, clang::LangOptions const&,
> > llvm::DataLayout const&, llvm::Module*, clang::BackendAction,
> > std::unique_ptr<llvm::raw_pwrite_stream,
> > std::default_delete<llvm::raw_pwrite_stream> >)
> > (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x164de96)
> > #15 0x00007f81ea329a36 (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x190ea36)
> > #16 0x00007f81e93e9093 clang::ParseAST(clang::Sema&, bool, bool)
> > (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x9ce093)
> > #17 0x00007f81ea9c9c38 clang::FrontendAction::Execute()
> > (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1faec38)
> > #18 0x00007f81ea97ff11
> > clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
> > (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1f64f11)
> > #19 0x00007f81eaa2f6b0
> > clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
> > (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x20146b0)
> > #20 0x00000000004131bf cc1_main(llvm::ArrayRef<char const*>, char
> > const*, void*) (/usr/lib/llvm-11/bin/clang+0x4131bf)
> > #21 0x00000000004115fe (/usr/lib/llvm-11/bin/clang+0x4115fe)
> > #22 0x00007f81ea6a9a02 (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1c8ea02)
> > #23 0x00007f81ec1e6cad
> > llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
> > (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xb02cad)
> > #24 0x00007f81ea6a8f2f
> > clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
> > >, std::__cxx11::basic_string<char, std::char_traits<char>,
> > std::allocator<char> >*, bool*) const
> > (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1c8df2f)
> > #25 0x00007f81ea680d5f
> > clang::driver::Compilation::ExecuteCommand(clang::driver::Command
> > const&, clang::driver::Command const*&) const
> > (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1c65d5f)
> > #26 0x00007f81ea680f07
> > clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
> > llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>
> > >&) const (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1c65f07)
> > #27 0x00007f81ea694a7c
> > clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
> > llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>
> > >&) (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1c79a7c)
> > #28 0x00000000004110a3 main (/usr/lib/llvm-11/bin/clang+0x4110a3)
> > #29 0x00007f81e855b09b __libc_start_main
> > (/lib/x86_64-linux-gnu/libc.so.6+0x2409b)
> > #30 0x000000000040e89a _start (/usr/lib/llvm-11/bin/clang+0x40e89a)
> > make: *** [Makefile:470:
> > /root/dev/linux/tools/testing/selftests/bpf/atomics.o] Error 1
> > "
> >
> > I am using a virtual machine with 8 cpus. The kernel and clang version are:
> > "
> > kernel: 5.14.0-rc3.bm.1-amd64 #4 SMP Sun Aug 1 23:28:24 CST 2021
> > x86_64 GNU/Linux
> > clang: Debian clang version
> > 11.1.0-++20210622113218+1fdec59bffc1-1~exp1~20210622213839.163
> > "
>
> I think I ran into same issue if I recall correctly, I downloaded
> llvm-project 12.0.1 and follow the instruction in kernel
> Documentation/bpf/bpf_devel_QA.rst
>
> "
> Q: Got it, so how do I build LLVM manually anyway?
> ....You need ninja, cmake and gcc-c++ as build requisites for LLVM.
> Once you
> have that set up, proceed with building the latest LLVM and clang
> version
> from the git repositories::
>
>     $ git clone https://github.com/llvm/llvm-project.git
>      $ mkdir -p llvm-project/llvm/build
>      $ cd llvm-project/llvm/build
>      $ cmake .. -G "Ninja" -DLLVM_TARGETS_TO_BUILD="BPF;X86" \
>                 -DLLVM_ENABLE_PROJECTS="clang"    \
>                 -DCMAKE_BUILD_TYPE=Release        \
>                 -DLLVM_BUILD_RUNTIME=OFF
>      $ ninja
> "

Thanks. I have tried on branch v5.10 and it works. I found some issues:
1. On debian 10 default clang version is 7.0 which is not compatible.
I need to update clang to newer version like clang 12. You could
download newer version from clang repo.
2.  After updating clang version, I need to rebuild kernel and install
it. Then I could build bpf selftest cases successfully.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-03 11:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-01 16:47 Failed to build bpf selftest testcases based on upstream master branch 范开喜
2021-08-01 21:46 ` Vincent Li
2021-08-03 11:46   ` [External] " 范开喜

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.