bpfcontain-rs icon indicating copy to clipboard operation
bpfcontain-rs copied to clipboard

Failed to generate skeleton: Error building BPF object file: Failed to compile obj=/run/user/1000/.tmpvVes12/bpfcontain.o

Open akshatagarwl opened this issue 4 years ago • 1 comments

On running cargo build

error: failed to run custom build command for `bpfcontain v0.0.6 (/home/humancalico/repos/bpfcontain-rs)`

Caused by:
  process didn't exit successfully: `/home/humancalico/repos/bpfcontain-rs/target/debug/build/bpfcontain-b628ed53c91943ad/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-changed=src/bpf/bpfcontain.bpf.c
  cargo:rerun-if-changed=bindings.h
  cargo:rerun-if-changed=src/bpf/include/allocator.h
  cargo:rerun-if-changed=src/bpf/include/audit.h
  cargo:rerun-if-changed=src/bpf/include/defs.h
  cargo:rerun-if-changed=src/bpf/include/kernel_defs.h
  cargo:rerun-if-changed=src/bpf/include/map_defs.h
  cargo:rerun-if-changed=src/bpf/include/maps.h
  cargo:rerun-if-changed=src/bpf/include/policy.h
  cargo:rerun-if-changed=src/bpf/include/state.h
  cargo:rerun-if-changed=src/bpf/include/structs.h
  cargo:rerun-if-changed=src/bpf/include/user_types.h
  cargo:rerun-if-changed=src/bpf/include/vmlinux.h
  cargo:rerun-if-changed=src/bpf/include/vmlinux_5.12.17.h
  cargo:rerun-if-changed=src/bpf/include/vmlinux_5.13.5.h

  --- stderr
  thread 'main' panicked at 'Failed to generate skeleton: Error building BPF object file: Failed to compile obj=/run/user/1000/.tmpvVes12/bpfcontain.o with status=exit status: 70
   stdout=

   stderr=
   fatal error: error in backend: Cannot select: intrinsic %llvm.preserve.struct.access.index
  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: /nix/store/yx6h6hvgpypzdmapqrcm02z2miklppzg-clang-12.0.0/bin/clang @/dev/fd/63
  1.	<eof> parser at end of file
  2.	Code generation
  3.	Running pass 'Function Pass Manager' on module 'src/bpf/bpfcontain.bpf.c'.
  4.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@sched_process_fork'
  Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
  //nix/store/l54mfi6x026ydhbky746590pzwrraqfy-llvm-12.0.0-lib/lib/libLLVM-12.so(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamEi+0x2d)[0x7fd4f7b15bdd]
  //nix/store/l54mfi6x026ydhbky746590pzwrraqfy-llvm-12.0.0-lib/lib/libLLVM-12.so(_ZN4llvm3sys17RunSignalHandlersEv+0x34)[0x7fd4f7b138e4]
  //nix/store/l54mfi6x026ydhbky746590pzwrraqfy-llvm-12.0.0-lib/lib/libLLVM-12.so(_ZN4llvm20CrashRecoveryContext10HandleExitEi+0x74)[0x7fd4f7a36fc4]
  //nix/store/l54mfi6x026ydhbky746590pzwrraqfy-llvm-12.0.0-lib/lib/libLLVM-12.so(_ZN4llvm3sys7Process4ExitEib+0x1e)[0x7fd4f7b0c15e]
  /nix/store/yx6h6hvgpypzdmapqrcm02z2miklppzg-clang-12.0.0/bin/clang[0x4159cd]
  //nix/store/l54mfi6x026ydhbky746590pzwrraqfy-llvm-12.0.0-lib/lib/libLLVM-12.so(_ZN4llvm18report_fatal_errorERKNS_5TwineEb+0x78)[0x7fd4f7a4a378]
  //nix/store/l54mfi6x026ydhbky746590pzwrraqfy-llvm-12.0.0-lib/lib/libLLVM-12.so(+0xc854fe)[0x7fd4f7a4a4fe]
  //nix/store/l54mfi6x026ydhbky746590pzwrraqfy-llvm-12.0.0-lib/lib/libLLVM-12.so(_ZN4llvm16SelectionDAGISel15CannotYetSelectEPNS_6SDNodeE+0x2c7)[0x7fd4f83d5787]
  //nix/store/l54mfi6x026ydhbky746590pzwrraqfy-llvm-12.0.0-lib/lib/libLLVM-12.so(_ZN4llvm16SelectionDAGISel16SelectCodeCommonEPNS_6SDNodeEPKhj+0x572)[0x7fd4f83d6b62]
  //nix/store/l54mfi6x026ydhbky746590pzwrraqfy-llvm-12.0.0-lib/lib/libLLVM-12.so(+0x3a36fe7)[0x7fd4fa7fbfe7]
  //nix/store/l54mfi6x026ydhbky746590pzwrraqfy-llvm-12.0.0-lib/lib/libLLVM-12.so(_ZN4llvm16SelectionDAGISel22DoInstructionSelectionEv+0x1bf)[0x7fd4f83d417f]
  //nix/store/l54mfi6x026ydhbky746590pzwrraqfy-llvm-12.0.0-lib/lib/libLLVM-12.so(_ZN4llvm16SelectionDAGISel17CodeGenAndEmitDAGEv+0x2a5)[0x7fd4f83dcc95]
  //nix/store/l54mfi6x026ydhbky746590pzwrraqfy-llvm-12.0.0-lib/lib/libLLVM-12.so(_ZN4llvm16SelectionDAGISel20SelectAllBasicBlocksERKNS_8FunctionE+0x149c)[0x7fd4f83df87c]
  //nix/store/l54mfi6x026ydhbky746590pzwrraqfy-llvm-12.0.0-lib/lib/libLLVM-12.so(+0x161cfbc)[0x7fd4f83e1fbc]
  //nix/store/l54mfi6x026ydhbky746590pzwrraqfy-llvm-12.0.0-lib/lib/libLLVM-12.so(+0x3a40ca9)[0x7fd4fa805ca9]
  //nix/store/l54mfi6x026ydhbky746590pzwrraqfy-llvm-12.0.0-lib/lib/libLLVM-12.so(_ZN4llvm19MachineFunctionPass13runOnFunctionERNS_8FunctionE+0xb4)[0x7fd4f7ee6854]
  //nix/store/l54mfi6x026ydhbky746590pzwrraqfy-llvm-12.0.0-lib/lib/libLLVM-12.so(_ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE+0x400)[0x7fd4f7c62b10]
  //nix/store/l54mfi6x026ydhbky746590pzwrraqfy-llvm-12.0.0-lib/lib/libLLVM-12.so(_ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE+0x2c)[0x7fd4f7c6402c]
  //nix/store/l54mfi6x026ydhbky746590pzwrraqfy-llvm-12.0.0-lib/lib/libLLVM-12.so(_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE+0x338)[0x7fd4f7c62428]
  /nix/store/cpgjiq780110cpsbl885q289zg5prpxl-clang-12.0.0-lib/lib/libclang-cpp.so.12(_ZN5clang17EmitBackendOutputERNS_17DiagnosticsEngineERKNS_19HeaderSearchOptionsERKNS_14CodeGenOptionsERKNS_13TargetOptionsERKNS_11LangOptionsERKN4llvm10DataLayoutEPNSE_6ModuleENS_13BackendActionESt10unique_ptrINSE_17raw_pwrite_streamESt14default_deleteISM_EE+0xb97)[0x7fd4feba8af7]
  /nix/store/cpgjiq780110cpsbl885q289zg5prpxl-clang-12.0.0-lib/lib/libclang-cpp.so.12(+0x1ca8804)[0x7fd4fef0f804]
  /nix/store/cpgjiq780110cpsbl885q289zg5prpxl-clang-12.0.0-lib/lib/libclang-cpp.so.12(_ZN5clang8ParseASTERNS_4SemaEbb+0x439)[0x7fd4fdc65969]
  /nix/store/cpgjiq780110cpsbl885q289zg5prpxl-clang-12.0.0-lib/lib/libclang-cpp.so.12(_ZN5clang14FrontendAction7ExecuteEv+0xc9)[0x7fd4ff66c379]
  /nix/store/cpgjiq780110cpsbl885q289zg5prpxl-clang-12.0.0-lib/lib/libclang-cpp.so.12(_ZN5clang16CompilerInstance13ExecuteActionERNS_14FrontendActionE+0x1eb)[0x7fd4ff604e7b]
  /nix/store/cpgjiq780110cpsbl885q289zg5prpxl-clang-12.0.0-lib/lib/libclang-cpp.so.12(_ZN5clang25ExecuteCompilerInvocationEPNS_16CompilerInstanceE+0xa4f)[0x7fd4ff6e73bf]
  /nix/store/yx6h6hvgpypzdmapqrcm02z2miklppzg-clang-12.0.0/bin/clang(_Z8cc1_mainN4llvm8ArrayRefIPKcEES2_Pv+0x634)[0x4163b4]
  /nix/store/yx6h6hvgpypzdmapqrcm02z2miklppzg-clang-12.0.0/bin/clang[0x4139e7]
  /nix/store/cpgjiq780110cpsbl885q289zg5prpxl-clang-12.0.0-lib/lib/libclang-cpp.so.12(+0x207a385)[0x7fd4ff2e1385]
  //nix/store/l54mfi6x026ydhbky746590pzwrraqfy-llvm-12.0.0-lib/lib/libLLVM-12.so(_ZN4llvm20CrashRecoveryContext9RunSafelyENS_12function_refIFvvEEE+0x23)[0x7fd4f7a36e53]
  /nix/store/cpgjiq780110cpsbl885q289zg5prpxl-clang-12.0.0-lib/lib/libclang-cpp.so.12(+0x207b4d3)[0x7fd4ff2e24d3]
  /nix/store/cpgjiq780110cpsbl885q289zg5prpxl-clang-12.0.0-lib/lib/libclang-cpp.so.12(_ZNK5clang6driver11Compilation14ExecuteCommandERKNS0_7CommandERPS3_+0x97)[0x7fd4ff2b5f97]
  /nix/store/cpgjiq780110cpsbl885q289zg5prpxl-clang-12.0.0-lib/lib/libclang-cpp.so.12(_ZNK5clang6driver11Compilation11ExecuteJobsERKNS0_7JobListERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEE+0x109)[0x7fd4ff2b69a9]
  /nix/store/cpgjiq780110cpsbl885q289zg5prpxl-clang-12.0.0-lib/lib/libclang-cpp.so.12(_ZN5clang6driver6Driver18ExecuteCompilationERNS0_11CompilationERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEE+0x81)[0x7fd4ff2c6661]
  /nix/store/yx6h6hvgpypzdmapqrcm02z2miklppzg-clang-12.0.0/bin/clang(main+0x1bd4)[0x4117b4]
  /nix/store/gk42f59363p82rg2wv2mfy71jn5w4q4c-glibc-2.32-48/lib/libc.so.6(__libc_start_main+0xed)[0x7fd4f68f7ded]
  /nix/store/yx6h6hvgpypzdmapqrcm02z2miklppzg-clang-12.0.0/bin/clang(_start+0x2a)[0x41339a]
  clang-12: error: clang frontend command failed with exit code 70 (use -v to see invocation)
  clang version 12.0.0
  Target: x86_64-unknown-linux-gnu
  Thread model: posix
  InstalledDir: /nix/store/yx6h6hvgpypzdmapqrcm02z2miklppzg-clang-12.0.0/bin
  clang-12: note: diagnostic msg:
  ********************

  PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
  Preprocessed source(s) and associated run script(s) are located at:
  clang-12: note: diagnostic msg: /run/user/1000/bpfcontain-a771ea.c
  clang-12: note: diagnostic msg: /run/user/1000/bpfcontain-a771ea.sh
  clang-12: note: diagnostic msg:

  ********************

  ', build.rs:72:19
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

https://gist.github.com/humancalico/70b3c22679b079be5a1770c633125b3d

akshatagarwl avatar Jul 28 '21 17:07 akshatagarwl

Hm, this looks like an LLVM issue. What is strange to me is that the target seems to be x86_64-unknown-linux-gnu based on your logs. The target should actually be something to do with bpf instead.

I'm currently quite busy for the rest of this week, but I'd be happy to help figure this out next week.

willfindlay avatar Jul 29 '21 15:07 willfindlay