AFLplusplus / LibAFL

Advanced Fuzzing Library - Slot your Fuzzer together in Rust! Scales across cores and machines. For Windows, Android, MacOS, Linux, no_std, ...
Other
1.97k stars 303 forks source link

libafl_cc build error #2517

Closed benmanzhh closed 1 week ago

benmanzhh commented 1 week ago

cargo build --release Compiling libafl_cc v0.13.2 (/home/zhh12138/libafl/LibAFL/libafl_cc) warning: libafl_cc@0.13.2: Skipping non-required compiler pass src/dump-cfg-pass.cc - Reason: Exit status exit status: 1. You can ignore this error. warning: libafl_cc@0.13.2: Skipping non-required compiler pass src/profiling-pass.cc - Reason: Exit status exit status: 1. You can ignore this error. Finished release profile [optimized + debuginfo] target(s) in 2m 24s

llvm-config --version && clang --version
16.0.6 Debian clang version 16.0.6 (27+b1) Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin

This problem has been bothering me for a week, how can I solve it, help me.

tokatoka commented 1 week ago

if you are talking about

warning: libafl_cc@0.13.2: Skipping non-required compiler pass src/dump-cfg-pass.cc - Reason: Exit status exit status: 1. You can ignore this error.
warning: libafl_cc@0.13.2: Skipping non-required compiler pass src/profiling-pass.cc - Reason: Exit status exit status: 1. You can ignore this error.

then you should install nlohman-json

domenukk commented 1 week ago

nlohman-json

Can we make this use a rust json parser somehow? Otherwise, should we list the dependencies somewhere / in the error?

tokatoka commented 1 week ago

why would we want a rust parser? This json parser is used in a C++ code.

domenukk commented 1 week ago

Because we can pull in rust dependencies via Cargo, we can't pull in Cpp ones.

tokatoka commented 1 week ago

ah ok. but it's difficult to integrate with the cpp code

benmanzhh commented 1 week ago

如果你谈论的是

warning: libafl_cc@0.13.2: Skipping non-required compiler pass src/dump-cfg-pass.cc - Reason: Exit status exit status: 1. You can ignore this error.
warning: libafl_cc@0.13.2: Skipping non-required compiler pass src/profiling-pass.cc - Reason: Exit status exit status: 1. You can ignore this error.

那么你应该安装 nlohman-json

libafl_cc)

Why should projects built in Rust use JSON for C++ tools? What should I do with this nlohman-json? I don't know how to use this nlohman-json to solve my dilemma. why only libafl_cc can't build?It's weird.I'd like to try libpng but it's just missing libafl_cc and libafl_cxx compiler. It's already simple for you, but it's a bit difficult for me. Please help me, thank you.

tokatoka commented 1 week ago

sudo apt install nlohman-json3-dev

benmanzhh commented 1 week ago

sudo apt install nlohman-json3-dev

After installation, rebuild still does not generate libafl_cc. Can you make it clear?Although I know your time is precious.

tokatoka commented 1 week ago

can you git pull origin main and try again?

benmanzhh commented 1 week ago

can you git pull origin main and try again?

That's what I did, but unfortunately, it didn't work.

domenukk commented 1 week ago

You could try to debug this by adding more logs or by using strace with on the whole build

tokatoka commented 1 week ago

but what exactly is the error you see? in the first message of yours

Finished release profile [optimized + debuginfo] target(s) in 2m 24s

It says it successfully builds?

benmanzhh commented 1 week ago

but what exactly is the error you see? in the first message of yours

Finished release profile [optimized + debuginfo] target(s) in 2m 24s

It says it successfully builds?

Something else does build successfully, only the libafl_cc compiler builds don't. I pulled the stable version of 0.13.2 and the build was unsuccessful, it should be my problem, but it just can't be solved. How should i do?Can you give me some advice? It also says "cargo build --release Compiling proc-macro2 v1.0.86 Compiling unicode-ident v1.0.12 Compiling libc v0.2.158 Compiling autocfg v1.3.0 Compiling cfg-if v1.0.0 Compiling rustversion v1.0.17 Compiling serde v1.0.210 Compiling rustix v0.38.36 Compiling linux-raw-sys v0.4.14 Compiling either v1.13.0 Compiling bitflags v2.6.0 Compiling version_check v0.9.5 Compiling home v0.5.9 Compiling memchr v2.7.4 Compiling parking_lot_core v0.9.10 Compiling once_cell v1.19.0 Compiling glob v0.3.1 Compiling smallvec v1.13.2 Compiling shlex v1.3.0 Compiling log v0.4.22 Compiling scopeguard v1.2.0 Compiling zerocopy v0.7.35 Compiling prettyplease v0.2.22 Compiling signal-hook v0.3.17 Compiling regex-syntax v0.8.4 Compiling ryu v1.0.18 Compiling itoa v1.0.11 Compiling minimal-lexical v0.2.1 Compiling allocator-api2 v0.2.18 Compiling typeid v1.0.2 Compiling syn v1.0.109 Compiling cfg_aliases v0.2.1 Compiling serde_json v1.0.128 Compiling static_assertions v1.1.0 Compiling bindgen v0.69.4 Compiling adler2 v2.0.0 Compiling sdd v3.0.3 Compiling lock_api v0.4.12 Compiling memoffset v0.9.1 Compiling libloading v0.8.5 Compiling ahash v0.8.11 Compiling num-traits v0.2.19 Compiling nix v0.29.0 Compiling heck v0.5.0 Compiling paste v1.0.15 Compiling clang-sys v1.8.1 Compiling gimli v0.31.0 Compiling miniz_oxide v0.8.0 Compiling itertools v0.13.0 Compiling itertools v0.12.1 Compiling object v0.36.4 Compiling scc v2.1.17 Compiling aho-corasick v1.1.3 Compiling libm v0.2.8 Compiling lazycell v1.3.0 Compiling typewit_proc_macros v1.8.1 Compiling adler v1.0.2 Compiling quote v1.0.37 Compiling regex-automata v0.4.7 Compiling nom v7.1.3 Compiling unicode-width v0.1.13 Compiling cobs v0.2.3 Compiling rustc-hash v1.1.0 Compiling rustc-demangle v0.1.24 Compiling lazy_static v1.5.0 Compiling unicode-xid v0.2.5 Compiling unicode-segmentation v1.11.0 Compiling miniz_oxide v0.7.4 Compiling jobserver v0.1.32 Compiling typewit v1.9.0 Compiling castaway v0.2.3 Compiling libafl_bolts v0.13.2 (/home/zhh12138/libafl/LibAFL-0.13.2/libafl_bolts) Compiling libafl v0.13.2 (/home/zhh12138/libafl/LibAFL-0.13.2/libafl) Compiling rand_core v0.6.4 Compiling xxhash-rust v0.8.12 Compiling syn v2.0.77 Compiling signal-hook-registry v1.4.2 Compiling mio v0.8.11 Compiling getrandom v0.2.15 Compiling compact_str v0.7.1 Compiling cc v1.1.18 Compiling const_format_proc_macros v0.2.33 Compiling uds v0.4.2 Compiling hostname v0.4.0 Compiling cassowary v0.3.0 Compiling tuple_list v0.1.3 Compiling unicode-truncate v1.1.0 Compiling parking_lot v0.12.3 Compiling const_panic v0.2.9 Compiling wait-timeout v0.2.0 Compiling rangemap v1.5.1 Compiling addr2line v0.24.1 Compiling signal-hook-mio v0.2.4 Compiling which v4.4.2 Compiling which v6.0.3 Compiling crossterm v0.27.0 Compiling regex v1.10.6 Compiling cexpr v0.6.0 Compiling const_format v0.2.33 Compiling libafl_cc v0.13.2 (/home/zhh12138/libafl/LibAFL-0.13.2/libafl_cc) Compiling c2rust-bitfields-derive v0.18.0 Compiling backtrace v0.3.74 Compiling c2rust-bitfields v0.18.0 Compiling serde_derive v1.0.210 Compiling num_enum_derive v0.7.3 Compiling serial_test_derive v3.1.1 Compiling strum_macros v0.26.4 Compiling typed-builder-macro v0.18.2 Compiling libafl_derive v0.13.2 (/home/zhh12138/libafl/LibAFL-0.13.2/libafl_derive) Compiling stability v0.2.1 Compiling ctor v0.2.8 Compiling serial_test v3.1.1 Compiling num_enum v0.7.3 Compiling typed-builder v0.18.2 Compiling strum v0.26.3 Compiling libafl_targets v0.13.2 (/home/zhh12138/libafl/LibAFL-0.13.2/libafl_targets) Compiling hashbrown v0.14.5 Compiling erased-serde v0.4.5 Compiling postcard v1.0.10 Compiling uuid v1.10.0 Compiling meminterval v0.4.1 Compiling bincode v1.3.3 Compiling lru v0.12.4 Compiling ratatui v0.26.3 warning: libafl_cc@0.13.2: Skipping non-required compiler pass src/dump-cfg-pass.cc - Reason: Exit status exit status: 1 warning: libafl_cc@0.13.2: Skipping non-required compiler pass src/profiling-pass.cc - Reason: Exit status exit status: 1 Finished release profile [optimized + debuginfo] target(s) in 3m 03s" That's all the information where is my debuginfo?

tokatoka commented 1 week ago

you won't get a binary afl_cc like afl++. make sure to have src/bin/libafl_cc.rs and src/bin/libafl_cxx.rs.

also it's not "libafl_cc build error". it clearly builds

benmanzhh commented 1 week ago

you won't get a binary afl_cc like afl++. make sure to have src/bin/libafl_cc.rs and src/bin/libafl_cxx.rs.

also it's not "libafl_cc build error". it clearly builds I found that there are indeed no libafl_cc.rs and libafl_cxx.rs. However, there is no libafl_cc.rs file in the libafl_cc/src directory in the project.

benmanzhh commented 1 week ago

you won't get a binary afl_cc like afl++. make sure to have src/bin/libafl_cc.rs and src/bin/libafl_cxx.rs. also it's not "libafl_cc build error". it clearly builds I found that there are indeed no libafl_cc.rs and libafl_cxx.rs. However, there is no libafl_cc.rs file in the libafl_cc/src directory in the project.

Now my requirement is that I need to find the libafl_cc and libafl_cxx in the LibAFL/target/release directory. However I don't find them in the LibAFL/target/release directory. I guess this is the result of my question.

tokatoka commented 1 week ago

I think you are misunderstanding all the stuff. libafl_cc is a library, compiling libafl_cc won't generate any "libafl_cc" binary. likewise libafl is a library too, and you won't get any "libafl" binary.

to use it you must create your own rust target and write use libafl_cc as a lib to build your compiler wrapper

domenukk commented 1 week ago

Look at the fuzzers in ./fuzzers, most have ./bin/libafl_cc.rs and will result in a binary you can run

benmanzhh commented 1 week ago

I think you are misunderstanding all the stuff. libafl_cc is a library, compiling libafl_cc won't generate any "libafl_cc" binary. likewise libafl is a library too, and you won't get any "libafl" binary.

to use it you must create your own rust target and write use libafl_cc as a lib to build your compiler wrapper

wow.Understood, understood, thank you so much for your patient reply.You are my superman. You fascinate me.I wish you a happy family and a happy life.