zz85 / profile-bee

🐝🦀🔥 An ebpf based CPU profiler written in Rust
MIT License
28 stars 1 forks source link

Add compile instruction to compile profile-bee? #5

Open vincentmli opened 1 year ago

vincentmli commented 1 year ago

Hi,

Could you add instruction to compile profile-bee, sorry totally newbie to rust here :)

tippexs commented 1 year ago

Hi @vincentmli all you need to do is mentioned here. https://github.com/zz85/profile-bee#development

In case you are not familiar with cargo and friends you should read something about in the rust book. Let me drop a link. https://doc.rust-lang.org/cargo/

vincentmli commented 1 year ago

@tippexs thanks for the reply, I had this error

Compiling profile-bee v0.1.0 (/usr/src/profile-bee/profile-bee) warning: unused import: ObjItem --> profile-bee/src/process.rs:5:22 5 use crate::symbols::{ObjItem, StackFrameInfo}; ^^^^^^^

= note: #[warn(unused_imports)] on by default

Compiling xtask v0.1.0 (/usr/src/profile-bee/xtask) warning: profile-bee (lib) generated 1 warning error: couldn't read profile-bee/bin/../../target/bpfel-unknown-none/debug/profile-bee: No such file or directory (os error 2) --> profile-bee/bin/profile-bee.rs:109:16 109 let data = include_bytes_aligned!("../../target/bpfel-unknown-none/debug/profile-bee"); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the macro `include_bytes` which comes from the expansion of the macro `include_bytes_aligned` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: unused import: MapRefMut --> profile-bee/bin/profile-bee.rs:2:26 2 use aya::maps::{HashMap, MapRefMut, Queue, StackTraceMap}; ^^^^^^^^^

= note: #[warn(unused_imports)] on by default

warning: unused import: Bpf --> profile-bee/bin/profile-bee.rs:9:53 | 9 | use aya::{include_bytes_aligned, util::online_cpus, Bpf}; | ^^^

warning: unused import: log::info --> profile-bee/bin/profile-bee.rs:14:5 | 14 | use log::info; | ^^^^^^^^^

warning: unused import: signal --> profile-bee/bin/profile-bee.rs:18:13 | 18 | use tokio::{signal, task}; | ^^^^^^

error[E0277]: the size for values of type [u8] cannot be known at compilation time --> profile-bee/bin/profile-bee.rs:109:16 109 let data = include_bytes_aligned!("../../target/bpfel-unknown-none/debug/profile-bee"); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
= help: within `Aligned<[u8]>`, the trait `Sized` is not implemented for `[u8]`

note: required because it appears within the type Aligned<[u8]> --> profile-bee/bin/profile-bee.rs:109:16 | 109 | let data = include_bytes_aligned!("../../target/bpfel-unknown-none/debug/profile-bee"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: structs must have a statically known size to be initialized = note: this error originates in the macro include_bytes_aligned (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try rustc --explain E0277. warning: profile-bee (bin "profile-bee") generated 4 warnings error: could not compile profile-bee due to 2 previous errors; 4 warnings emitted warning: build failed, waiting for other jobs to finish...

vincentmli commented 1 year ago

root@vli-2004:/usr/src/profile-bee# cargo xtask build-ebpf Finished dev [unoptimized + debuginfo] target(s) in 0.06s Running target/debug/xtask build-ebpf error: "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/Cargo.lock" does not exist, unable to build with the standard library, try: rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu <===THIS corrected the error thread 'main' panicked at 'assertion failed: status.success()', xtask/src/build_ebpf.rs:62:5 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace root@vli-2004:/usr/src/profile-bee# rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu info: downloading component 'rust-src' info: installing component 'rust-src' root@vli-2004:/usr/src/profile-bee# cargo xtask build-ebpf

RoySunnySean007 commented 8 months ago

I like the profile-bee very much, but failed to compile it...:( I also encountered the similar error, could u please kindly suggest, @tippexs ?

Cargo build cargobuilderror.txt

cargo xtask build-ebpf cargo_xtask_build_ebpfError.txt