FuzzAnything/Hopper

在测试re2库的时候使用hopper compile报错

Closed this issue · 2 comments

你好,我在使用hopper compile命令的时候报错

The following warnings were emitted during compilation:

warning: hopper-harness@1.0.0: dir=/hopper/examples/re2/output, lib=re2_fuzz

error: failed to run custom build command for `hopper-harness v1.0.0 (/hopper/hopper-harness)`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_RELEASE_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.

Caused by:
  process didn't exit successfully: `/hopper/examples/re2/output/release/build/hopper-harness-a59f80c74cb58da4/build-script-build` (exit status: 101)
  --- stdout

  cargo:warning=dir=/hopper/examples/re2/output, lib=re2_fuzz
  cargo:rustc-link-lib=dylib=re2_fuzz
  cargo:rustc-link-arg=-v,-Wl,-rpath,-std=c++11,-lc,/hopper/examples/re2/output
  cargo:rustc-link-search=native=/hopper/examples/re2/output
  cargo:rustc-link-arg=-v,-Wl,--allow-shlib-undefined,-std=c++,-lc
  cargo:rerun-if-changed=/hopper/examples/re2/re2/src/re2/re2.h

  --- stderr
  /hopper/examples/re2/re2/src/re2/re2.h:184:10: fatal error: 'algorithm' file not found
  thread 'main' panicked at hopper-harness/build.rs:255:10:
  Unable to generate bindings: ClangDiagnostic("/hopper/examples/re2/re2/src/re2/re2.h:184:10: fatal error: 'algorithm' file not found\n")
  stack backtrace:
     0: rust_begin_unwind
               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
     1: core::panicking::panic_fmt
               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
     2: core::result::unwrap_failed
               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/result.rs:1649:5
     3: core::result::Result<T,E>::expect
     4: build_script_build::main
     5: core::ops::function::FnOnce::call_once
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: failed to compile `hopper-harness v1.0.0 (/hopper/hopper-harness)`, intermediate artifacts can be found at `/hopper/examples/re2/output`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
09:33:14 [ERROR] Meets error: cargo install error
Error: cargo install error

Location:
    hopper-compiler/src/cargo.rs:112:5

我觉得主要是由于我没有链接上algorithm导致的,所以我修改了/hopper/hopper-harness/build.rslink_libraries()函数里的参数

  • cargo:rustc-link-arg=-Wl,-rpath,{dir}修改为了cargo:rustc-link-arg=-v,-Wl,-rpath,-std=c++11,-lc,{dir}
  • cargo:rustc-link-arg=-Wl,--allow-shlib-undefined修改为了cargo:rustc-link-arg=-v,-Wl,--allow-shlib-undefined,-std=c++,-lc
    但是还是报错了,想问下这个问题要怎么解决,谢谢

hopper do not support c++ api, please use cre2

Did you solve the problem