Skip to content

[regression] couldn\'t find any valid shared libraries matching: [\'libclang.so\', \'libclang-*.so\'] #1712

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jyn514 opened this issue Jan 15, 2020 · 2 comments

Comments

@jyn514
Copy link
Member

jyn514 commented Jan 15, 2020

Bindgen Invocation

    let bindings = bindgen::Builder::default()
        .header("wrapper.h")
        .clang_arg(include_path)
        .blacklist_item("YDB_NOTTP")
        // Finish the builder and generate the bindings.
        .generate()
        // Unwrap the Result and panic on failure.
        .expect("Unable to generate bindings");

Actual Results

error: failed to run custom build command for `clang-sys v0.28.1`

Caused by:
  process didn't exit successfully: `/home/joshua/Documents/Programming/yottadb/ydbrust/target/debug/build/clang-sys-0bef6ce726fcb6d1/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "couldn\'t find any valid shared libraries matching: [\'libclang.so\', \'libclang-*.so\'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"', src/libcore/result.rs:1165:5
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:77
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:61
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1028
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1412
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:65
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:50
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:188
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:205
  10: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:464
  11: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:373
  12: rust_begin_unwind
             at src/libstd/panicking.rs:302
  13: core::panicking::panic_fmt
             at src/libcore/panicking.rs:139
  14: core::result::unwrap_failed
             at src/libcore/result.rs:1165
  15: core::result::Result<T,E>::unwrap
             at /rustc/73528e339aae0f17a15ffa49a8ac608f50c6cf14/src/libcore/result.rs:933
  16: build_script_build::dynamic::link
             at ./build/dynamic.rs:194
  17: build_script_build::main
             at ./build.rs:78
  18: std::rt::lang_start::{{closure}}
             at /rustc/73528e339aae0f17a15ffa49a8ac608f50c6cf14/src/libstd/rt.rs:61
  19: std::rt::lang_start_internal::{{closure}}
             at src/libstd/rt.rs:48
  20: std::panicking::try::do_call
             at src/libstd/panicking.rs:287
  21: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:78
  22: std::panicking::try
             at src/libstd/panicking.rs:265
  23: std::panic::catch_unwind
             at src/libstd/panic.rs:396
  24: std::rt::lang_start_internal
             at src/libstd/rt.rs:47
  25: std::rt::lang_start
             at /rustc/73528e339aae0f17a15ffa49a8ac608f50c6cf14/src/libstd/rt.rs:61
  26: main
  27: __libc_start_main
  28: _start

Expected Results

bindgen should successfully find clang in one of the following places:

$ echo $(llvm-config --libdir)/libclang*
/usr/lib/llvm-8/lib/libclang-8.so.1 /usr/lib/llvm-8/lib/libclang.so.1

This works fine with bindgen 0.51, it only breaks with 0.52.

See also KyleMayes/clang-sys#98.

@emilio
Copy link
Contributor

emilio commented Jan 16, 2020

I think this is likely a regression from #1649. Do you use bindgen with default-features = false? If so, you probably want to add the dynamic feature to restore behavior.

@jyn514
Copy link
Member Author

jyn514 commented Jan 17, 2020

I do use default-features = false, adding the runtime feature fixed the problem! I didn't see documentation for this on docs.rs, possibly because the latest build failed: https://docs.rs/crate/bindgen/0.52.0. It would be nice to document this somewhere for the next person :)

@emilio emilio closed this as completed in 56b18d6 Feb 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants