facebookincubator / below

A time traveling resource monitor for modern Linux systems
Apache License 2.0
1.08k stars 61 forks source link

unable to build on ubuntu 22.04 #8202

Closed numerodix closed 1 year ago

numerodix commented 1 year ago

I followed the ubuntu instructions and what I'm seeing is this:

$ cargo build --release
warning: /home/martin/inspect/below/below/store/Cargo.toml: version requirement `5.0.1+zstd.1.5.2` for dependency `zstd-safe` includes semver metadata which will be ignored, removing the metadata is recommended to avoid confusion
warning: /home/martin/inspect/below/below/store/Cargo.toml: version requirement `0.11.2+zstd.1.5.2` for dependency `zstd` includes semver metadata which will be ignored, removing the metadata is recommended to avoid confusion
    Updating crates.io index
  Downloaded io-lifetimes v0.7.4
  Downloaded erased-serde v0.3.23
  Downloaded equivalent v1.0.0
  Downloaded enum-map v2.4.1
  Downloaded camino v1.1.1
  Downloaded scroll_derive v0.11.0
  Downloaded darling_macro v0.14.2
  Downloaded enumset_derive v0.6.1
  Downloaded os_info v3.5.1
  Downloaded terminal_size v0.2.1
  Downloaded terminal_size v0.1.17
  Downloaded is-terminal v0.4.7
  Downloaded enumset v1.0.12
  Downloaded cargo-platform v0.1.2
  Downloaded darling v0.14.2
  Downloaded console v0.15.2
  Downloaded time-macros v0.2.5
  Downloaded portable-atomic v0.3.20
  Downloaded tempfile v3.5.0
  Downloaded once_cell v1.15.0
  Downloaded ahash v0.8.0
  Downloaded jobserver v0.1.25
  Downloaded io-lifetimes v1.0.10
  Downloaded clap_complete v4.3.2
  Downloaded toml v0.5.8
  Downloaded darling_core v0.14.2
  Downloaded tar v0.4.38
  Downloaded indicatif v0.17.3
  Downloaded time v0.3.16
  Downloaded toml_edit v0.19.12
  Downloaded libm v0.2.5
  Downloaded portable-atomic v1.3.2
  Downloaded winnow v0.4.9
  Downloaded cursive_core v0.3.5
  Downloaded nix v0.25.0
  Downloaded rustix v0.35.12
  Downloaded rustix v0.37.11
  Downloaded libc v0.2.141
  Downloaded zstd-sys v2.0.1+zstd.1.5.2
  Downloaded linux-raw-sys v0.0.46
  Downloaded linux-raw-sys v0.3.1
  Downloaded libbpf-sys v1.0.4+v1.0.1
  Downloaded enum-map-derive v0.10.0
  Downloaded 43 crates (6.4 MB) in 1.93s
   Compiling libc v0.2.141
   Compiling autocfg v1.1.0
   Compiling proc-macro2 v1.0.64
   Compiling quote v1.0.29
   Compiling unicode-ident v1.0.5
   Compiling cfg-if v1.0.0
   Compiling serde v1.0.177
   Compiling serde_derive v1.0.177
   Compiling syn v1.0.109
   Compiling version_check v0.9.4
   Compiling bitflags v1.3.2
   Compiling memchr v2.5.0
   Compiling thiserror v1.0.43
   Compiling libm v0.2.5
   Compiling io-lifetimes v1.0.10
   Compiling log v0.4.17
   Compiling crossbeam-utils v0.8.12
   Compiling scopeguard v1.1.0
   Compiling rustix v0.37.11
   Compiling once_cell v1.15.0
   Compiling unicode-width v0.1.10
   Compiling num-traits v0.2.15
   Compiling num-integer v0.1.45
   Compiling memoffset v0.6.5
   Compiling ident_case v1.0.1
   Compiling io-lifetimes v0.7.4
   Compiling fnv v1.0.7
   Compiling anyhow v1.0.71
   Compiling lazy_static v1.4.0
   Compiling lock_api v0.4.9
   Compiling num-iter v0.1.43
   Compiling num-rational v0.4.1
   Compiling itoa v1.0.4
   Compiling signal-hook v0.3.14
   Compiling time-core v0.1.0
   Compiling crossbeam-channel v0.5.6
   Compiling smallvec v1.10.0
   Compiling parking_lot_core v0.9.4
   Compiling rustix v0.35.12
   Compiling time-macros v0.2.5
   Compiling ahash v0.8.0
   Compiling num_threads v0.1.6
   Compiling syn v2.0.25
   Compiling unicase v2.6.0
   Compiling serde_json v1.0.100
   Compiling pin-utils v0.1.0
   Compiling stable_deref_trait v1.2.0
   Compiling erased-serde v0.3.23
   Compiling unicode-segmentation v1.10.0
   Compiling owning_ref v0.4.1
   Compiling xi-unicode v0.3.0
   Compiling slog v2.7.0
   Compiling getrandom v0.2.8
   Compiling jobserver v0.1.25
   Compiling signal-hook-registry v1.4.0
   Compiling mio v0.8.5
   Compiling num-complex v0.4.2
   Compiling cc v1.0.73
   Compiling time v0.3.16
   Compiling dirs-sys-next v0.1.2
   Compiling parking_lot v0.12.1
   Compiling signal-hook-mio v0.2.3
   Compiling dirs-next v2.0.0
   Compiling memoffset v0.7.1
   Compiling heck v0.4.0
   Compiling crossterm v0.25.0
   Compiling num v0.4.0
   Compiling term v0.7.0
   Compiling rand_core v0.6.4
   Compiling atty v0.2.14
   Compiling num_cpus v1.13.1
   Compiling aho-corasick v0.7.19
   Compiling thread_local v1.1.4
   Compiling regex-syntax v0.6.27
   Compiling pkg-config v0.3.26
   Compiling iana-time-zone v0.1.53
   Compiling ppv-lite86 v0.2.16
   Compiling same-file v1.0.6
   Compiling chrono v0.4.22
   Compiling walkdir v2.3.2
   Compiling libbpf-sys v1.0.4+v1.0.1
   Compiling toml v0.5.8
   Compiling vsprintf v2.0.0
   Compiling rand_chacha v0.3.1
   Compiling nix v0.25.0
   Compiling openat v0.1.21
   Compiling linux-raw-sys v0.3.1
   Compiling humantime v2.1.0
   Compiling rand v0.8.5
   Compiling slog-term v2.9.0
   Compiling regex v1.6.0
   Compiling futures-core v0.3.28
   Compiling rustversion v1.0.9
   Compiling zstd-sys v2.0.1+zstd.1.5.2
   Compiling rand_distr v0.4.3
   Compiling darling_core v0.14.2
   Compiling async-trait v0.1.71
   Compiling utf8parse v0.2.1
   Compiling linux-raw-sys v0.0.46
   Compiling anstyle-parse v0.2.1
   Compiling threadpool v1.8.1
   Compiling thiserror-impl v1.0.43
   Compiling clap_derive v4.3.2
   Compiling crossbeam-epoch v0.9.11
   Compiling colorchoice v1.0.0
   Compiling match_cfg v0.1.0
   Compiling hashbrown v0.14.0
   Compiling anstyle-query v1.0.0
   Compiling semver v1.0.14
   Compiling equivalent v1.0.0
   Compiling anstyle v1.0.1
   Compiling is-terminal v0.4.7
   Compiling ryu v1.0.11
   Compiling camino v1.1.1
   Compiling anstream v0.3.2
   Compiling indexmap v2.0.0
   Compiling terminal_size v0.2.1
   Compiling hostname v0.3.1
   Compiling proc-macro-crate v1.2.1
   Compiling cgroupfs v0.7.1 (/home/martin/inspect/below/below/cgroupfs)
   Compiling fb_procfs v0.7.1 (/home/martin/inspect/below/below/procfs)
   Compiling enum-map-derive v0.10.0
   Compiling strum_macros v0.24.3
   Compiling darling_macro v0.14.2
   Compiling below_derive v0.7.1 (/home/martin/inspect/below/below/below_derive)
   Compiling num_enum_derive v0.5.7
   Compiling bytes v1.2.1
   Compiling enum-map v2.4.1
   Compiling os_info v3.5.1
   Compiling toml_datetime v0.6.3
   Compiling darling v0.14.2
   Compiling enumset_derive v0.6.1
   Compiling serde_spanned v0.6.3
   Compiling slab v0.4.7
   Compiling futures-channel v0.3.28
   Compiling strsim v0.10.0
   Compiling rayon-core v1.9.3
   Compiling zstd-safe v5.0.2+zstd.1.5.2
   Compiling futures-task v0.3.28
   Compiling pin-project-lite v0.2.9
   Compiling static_assertions v1.1.0
   Compiling clap_lex v0.5.0
   Compiling winnow v0.4.9
   Compiling clap_builder v4.3.11
   Compiling nix v0.26.2
   Compiling num_enum v0.5.7
   Compiling enumset v1.0.12
   Compiling cursive_core v0.3.5
   Compiling cargo-platform v0.1.2
   Compiling futures-util v0.3.28
   Compiling half v1.8.2
   Compiling fastrand v1.8.0
   Compiling futures-sink v0.3.28
   Compiling portable-atomic v1.3.2
   Compiling either v1.8.0
   Compiling tempfile v3.5.0
   Compiling cargo_metadata v0.15.4
   Compiling serde_cbor v0.11.2
   Compiling crossbeam-deque v0.8.2
   Compiling scroll_derive v0.11.0
   Compiling toml_edit v0.19.12
   Compiling futures-macro v0.3.28
   Compiling memmap2 v0.5.10
   Compiling tokio v1.21.2
   Compiling rayon v1.5.3
   Compiling clap v4.3.11
   Compiling scroll v0.11.0
   Compiling cursive v0.20.0
   Compiling futures-io v0.3.28
   Compiling futures v0.1.31
   Compiling maplit v1.0.2
   Compiling portable-atomic v0.3.20
   Compiling below-common v0.7.1 (/home/martin/inspect/below/below/common)
   Compiling below-btrfs v0.7.1 (/home/martin/inspect/below/below/btrfs)
   Compiling below-gpu-stats v0.7.1 (/home/martin/inspect/below/below/gpu_stats)
   Compiling below-model v0.7.1 (/home/martin/inspect/below/below/model)
   Compiling toml v0.7.6
   Compiling xattr v0.2.3
   Compiling rand v0.4.6
   Compiling terminal_size v0.1.17
   Compiling filetime v0.2.18
   Compiling remove_dir_all v0.5.3
   Compiling tar v0.4.38
   Compiling tempdir v0.3.7
   Compiling console v0.15.2
   Compiling cursive_buffered_backend v0.6.1
   Compiling itertools v0.10.5
   Compiling crossterm v0.23.2
   Compiling below-render v0.7.1 (/home/martin/inspect/below/below/render)
   Compiling futures-executor v0.3.28
   Compiling number_prefix v0.4.0
   Compiling futures v0.3.28
   Compiling below-config v0.7.1 (/home/martin/inspect/below/below/config)
   Compiling clap_complete v4.3.2
   Compiling indicatif v0.17.3
   Compiling users v0.11.0
   Compiling plain v0.2.3
   Compiling libbpf-rs v0.21.2
   Compiling libbpf-cargo v0.21.2
   Compiling below v0.7.1 (/home/martin/inspect/below/below)
error: failed to run custom build command for `below v0.7.1 (/home/martin/inspect/below/below)`

Caused by:
  process didn't exit successfully: `/home/martin/inspect/below/target/release/build/below-2d28fc00088dc975/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Build(Failed to compile /tmp/.tmpbchdUC/exitstat.o from ./src/bpf/exitstat.bpf.c

  Caused by:
      0: Command `clang -I/tmp/.tmpsndTSM/bpf/src -fno-stack-protector -D__TARGET_ARCH_x86 -g -O2 -target bpf -c ./src/bpf/exitstat.bpf.c -o /tmp/.tmpbchdUC/exitstat.o` failed (exit status: 70)
      1: ./src/bpf/exitstat.bpf.c:153:55: warning: passing 'const struct mm_struct *' to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
             data.stats.active_rss_pages = mm_active_rss_pages(mm);
                                                               ^~
         ./src/bpf/exitstat.bpf.c:98:31: note: passing argument to parameter 'arg' here
         u64 mm_active_rss_pages(void *arg) {
                                       ^
         fatal error: error in backend: Incorrect flag for llvm.bpf.preserve.type.info intrinsic
         PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
         Stack dump:
         0.     Program arguments: clang -I/tmp/.tmpsndTSM/bpf/src -fno-stack-protector -D__TARGET_ARCH_x86 -g -O2 -target bpf -c ./src/bpf/exitstat.bpf.c -o /tmp/.tmpbchdUC/exitstat.o
         1.     <eof> parser at end of file
         2.     Optimizer
         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):
         /lib/x86_64-linux-gnu/libLLVM-14.so.1(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamEi+0x31)[0x7ff10083fd01]
         /lib/x86_64-linux-gnu/libLLVM-14.so.1(_ZN4llvm3sys17RunSignalHandlersEv+0xee)[0x7ff10083da3e]
         /lib/x86_64-linux-gnu/libLLVM-14.so.1(_ZN4llvm3sys15CleanupOnSignalEm+0xfb)[0x7ff10083f0ab]
         /lib/x86_64-linux-gnu/libLLVM-14.so.1(+0xd6bbea)[0x7ff10076bbea]
         /lib/x86_64-linux-gnu/libLLVM-14.so.1(+0xd6bb8b)[0x7ff10076bb8b]
         /lib/x86_64-linux-gnu/libLLVM-14.so.1(_ZN4llvm3sys7Process4ExitEib+0x27)[0x7ff10083a007]
         clang[0x4136d2]
         /lib/x86_64-linux-gnu/libLLVM-14.so.1(_ZN4llvm18report_fatal_errorERKNS_5TwineEb+0x113)[0x7ff10077a673]
         /lib/x86_64-linux-gnu/libLLVM-14.so.1(+0xd7a556)[0x7ff10077a556]
         /lib/x86_64-linux-gnu/libLLVM-14.so.1(+0x2f5f224)[0x7ff10295f224]
         /lib/x86_64-linux-gnu/libLLVM-14.so.1(+0x2f5aad4)[0x7ff10295aad4]
         /lib/x86_64-linux-gnu/libLLVM-14.so.1(+0x2f5a845)[0x7ff10295a845]
         /lib/x86_64-linux-gnu/libLLVM-14.so.1(+0x2f6e79d)[0x7ff10296e79d]
         /lib/x86_64-linux-gnu/libLLVM-14.so.1(_ZN4llvm11PassManagerINS_8FunctionENS_15AnalysisManagerIS1_JEEEJEE3runERS1_RS3_+0x19e)[0x7ff1009aea0e]
         /lib/x86_64-linux-gnu/libLLVM-14.so.1(+0x2b9924d)[0x7ff10259924d]
         /lib/x86_64-linux-gnu/libLLVM-14.so.1(_ZN4llvm27ModuleToFunctionPassAdaptor3runERNS_6ModuleERNS_15AnalysisManagerIS1_JEEE+0x1d1)[0x7ff1009b29d1]
         /lib/x86_64-linux-gnu/libLLVM-14.so.1(+0x2b9907d)[0x7ff10259907d]
         /lib/x86_64-linux-gnu/libLLVM-14.so.1(_ZN4llvm11PassManagerINS_6ModuleENS_15AnalysisManagerIS1_JEEEJEE3runERS1_RS3_+0x19e)[0x7ff1009ad60e]
         /lib/x86_64-linux-gnu/libclang-cpp.so.14(+0x1862b9b)[0x7ff107c62b9b]
         /lib/x86_64-linux-gnu/libclang-cpp.so.14(_ZN5clang17EmitBackendOutputERNS_17DiagnosticsEngineERKNS_19HeaderSearchOptionsERKNS_14CodeGenOptionsERKNS_13TargetOptionsERKNS_11LangOptionsEN4llvm9StringRefEPNSE_6ModuleENS_13BackendActionESt10unique_ptrINSE_17raw_pwrite_streamESt14default_deleteISK_EE+0x412)[0x7ff107c56a52]
         /lib/x86_64-linux-gnu/libclang-cpp.so.14(+0x1b7c855)[0x7ff107f7c855]
         /lib/x86_64-linux-gnu/libclang-cpp.so.14(_ZN5clang8ParseASTERNS_4SemaEbb+0x244)[0x7ff106e04824]
         /lib/x86_64-linux-gnu/libclang-cpp.so.14(_ZN5clang13CodeGenAction13ExecuteActionEv+0xb1)[0x7ff107f78b71]
         /lib/x86_64-linux-gnu/libclang-cpp.so.14(_ZN5clang14FrontendAction7ExecuteEv+0x67)[0x7ff108914b57]
         /lib/x86_64-linux-gnu/libclang-cpp.so.14(_ZN5clang16CompilerInstance13ExecuteActionERNS_14FrontendActionE+0x336)[0x7ff10886c3a6]
         /lib/x86_64-linux-gnu/libclang-cpp.so.14(_ZN5clang25ExecuteCompilerInvocationEPNS_16CompilerInstanceE+0x29b)[0x7ff10898e45b]
         clang(_Z8cc1_mainN4llvm8ArrayRefIPKcEES2_Pv+0x99b)[0x41328b]
         clang[0x4114bc]
         /lib/x86_64-linux-gnu/libclang-cpp.so.14(+0x20eaed2)[0x7ff1084eaed2]
         /lib/x86_64-linux-gnu/libLLVM-14.so.1(_ZN4llvm20CrashRecoveryContext9RunSafelyENS_12function_refIFvvEEE+0xdd)[0x7ff10076bb6d]
         /lib/x86_64-linux-gnu/libclang-cpp.so.14(_ZNK5clang6driver10CC1Command7ExecuteEN4llvm8ArrayRefINS2_8OptionalINS2_9StringRefEEEEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb+0x140)[0x7ff1084ea9c0]
         /lib/x86_64-linux-gnu/libclang-cpp.so.14(_ZNK5clang6driver11Compilation14ExecuteCommandERKNS0_7CommandERPS3_+0x3f3)[0x7ff1084b5183]
         /lib/x86_64-linux-gnu/libclang-cpp.so.14(_ZNK5clang6driver11Compilation11ExecuteJobsERKNS0_7JobListERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEE+0x8a)[0x7ff1084b540a]
         /lib/x86_64-linux-gnu/libclang-cpp.so.14(_ZN5clang6driver6Driver18ExecuteCompilationERNS0_11CompilationERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEE+0x1a7)[0x7ff1084cf507]
         clang(main+0x2816)[0x410f26]
         /lib/x86_64-linux-gnu/libc.so.6(+0x29d90)[0x7ff0ff229d90]
         /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80)[0x7ff0ff229e40]
         clang(_start+0x25)[0x40e3b5]
         clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
         Ubuntu clang version 14.0.0-1ubuntu1.1
         Target: bpf
         Thread model: posix
         InstalledDir: /usr/bin
         clang: note: diagnostic msg: 
         ********************

         PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
         Preprocessed source(s) and associated run script(s) are located at:
         clang: note: diagnostic msg: /tmp/exitstat-2c6bd1.c
         clang: note: diagnostic msg: /tmp/exitstat-2c6bd1.sh
         clang: note: diagnostic msg: 

         ********************
         )', below/build.rs:38:39
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...

This is from main, at a1b257d91677637063c1eb359097d53078f7272a. I also tried the tag v0.7.1 with the same error message.

mmynk commented 1 year ago

Make sure, you have clang-16.

export CLANG=clang-16
cargo build --release
brianc118 commented 1 year ago

Yeah sorry about that. I should have updated the instructions earlier. Looks like @mmynk is already on to it.