(compilation) search_libclang_directories panic after upgrading to ubuntu 19.04

HI,

After my system upgrade to 19.04, some of my project failed to compile with this error.

Blockquote
process didn’t exit successfully: /home/angelofskies/workspace_rust/PVRService/target/debug/build/pvr_service-587bc30ae401904e/build-script-build (exit code: 101)
— stderr
thread ‘main’ panicked at ‘called Option::unwrap() on a None value’, src/libcore/option.rs:345:21
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
1: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:70
2: std::panicking::default_hook::{{closure}}
at src/libstd/sys_common/backtrace.rs:58
at src/libstd/panicking.rs:200
3: std::panicking::default_hook
at src/libstd/panicking.rs:215
4: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:478
5: std::panicking::continue_panic_fmt
at src/libstd/panicking.rs:385
6: rust_begin_unwind
at src/libstd/panicking.rs:312
7: core::panicking::panic_fmt
at src/libcore/panicking.rs:85
8: core::panicking::panic
at src/libcore/panicking.rs:49
9: <core::option::Option>::unwrap
at /rustc/91856ed52c58aa5ba66a015354d1cc69e9779bdf/src/libcore/macros.rs:11
10: clang_sys::load_manually::build::common::search_libclang_directories
at ./target/debug/build/clang-sys-6bdc33ce097a676d/out/common.rs:120
11: clang_sys::load_manually::build::dynamic::search_libclang_directories
at ./target/debug/build/clang-sys-6bdc33ce097a676d/out/dynamic.rs:132
12: clang_sys::load_manually::build::dynamic::find
at ./target/debug/build/clang-sys-6bdc33ce097a676d/out/dynamic.rs:159
13: clang_sys::load_manually
at /home/angelofskies/.cargo/registry/src/github.com-1ecc6299db9ec823/clang-sys-0.28.0/src/link.rs:128
14: clang_sys::load
at /home/angelofskies/.cargo/registry/src/github.com-1ecc6299db9ec823/clang-sys-0.28.0/src/link.rs:157
15: core::ops::function::FnOnce::call_once
at /home/angelofskies/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.49.0/src/lib.rs:1674
at /rustc/91856ed52c58aa5ba66a015354d1cc69e9779bdf/src/libcore/ops/function.rs:231
16: <lazy_static::lazy::Lazy>::get::{{closure}}
at /home/angelofskies/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.3.0/src/inline_lazy.rs:28
17: std::sync::once::Once::call_once::{{closure}}
at /rustc/91856ed52c58aa5ba66a015354d1cc69e9779bdf/src/libstd/sync/once.rs:220
18: std::sync::once::Once::call_inner
at src/libstd/sync/once.rs:387
19: std::sync::once::Once::call_once
at /rustc/91856ed52c58aa5ba66a015354d1cc69e9779bdf/src/libstd/sync/once.rs:220
20: <bindgen::ensure_libclang_is_loaded::LIBCLANG as core::ops::deref::Deref>::deref
at /home/angelofskies/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.3.0/src/inline_lazy.rs:27
at /home/angelofskies/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.49.0/<::lazy_static::__lazy_static_internal macros>:12
at /home/angelofskies/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.49.0/<::lazy_static::__lazy_static_internal macros>:13
21: bindgen::ensure_libclang_is_loaded
at /home/angelofskies/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.49.0/src/lib.rs:1681
22: bindgen::Bindings::generate
at /home/angelofskies/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.49.0/src/lib.rs:1696
23: bindgen::Builder::generate
at /home/angelofskies/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.49.0/src/lib.rs:1204
24: build_script_build::main
at ./build.rs:12
25: std::rt::lang_start::{{closure}}
at /rustc/91856ed52c58aa5ba66a015354d1cc69e9779bdf/src/libstd/rt.rs:64
26: std::panicking::try::do_call
at src/libstd/rt.rs:49
at src/libstd/panicking.rs:297
27: __rust_maybe_catch_panic
at src/libpanic_unwind/lib.rs:87
28: std::rt::lang_start_internal
at src/libstd/panicking.rs:276
at src/libstd/panic.rs:388
at src/libstd/rt.rs:48
29: std::rt::lang_start
at /rustc/91856ed52c58aa5ba66a015354d1cc69e9779bdf/src/libstd/rt.rs:64
30: main
31: __libc_start_main
32: _start

[package]
edition = "2018"

[dependencies]
libc = "0.2"
serde = "1"
serde_derive = "1"
serde_json = "1"
futures = "0.1"
hyper = "0.12"
tokio = "=0.1.11"
tokio-core = "0.1"
tokio-timer = "0.2"
hyper-tls = "0.3"
chrono = "0.4"
getopts = "0.2"
postgres = {version = "0.15", features = ["with-chrono","with-serde_json"] }
quick-xml = "0.13"
crossbeam-utils = "0.6"
regex = "1"
uuid = "0.7"
base64 = "0.10"
libloading = "0.5"
mp4parse = { path = "../mp4parse-rust/mp4parse" }
mse_fmp4 = { path = "../mse_fmp4" }
galil-seiferas = "0.1"
rand = "0.6"
indicatif = "0.11"
metered = "0.1"
serde_yaml = "0.8"
protobuf = { version = "2.*", features = ["with-bytes"] }
socket2 = { version = "0.3", features = ["reuseport"] }

[dev-dependencies]
criterion = "0.2"

[[bench]]
name = "benchmarks"
harness = false

[build-dependencies]
bindgen = "0.*"
protoc-rust = "2.0"

[profile.release]
lto = true

[profile.bench]
lto = true

I tried to replicate it within a container and it compile, so the issue occur only on my main system and I can see where to investigate.

Thanks

What happens if you run bindgen utlity from command line? May be there is more verbose message, if not you can run strace -f bindgen -o bindgen.log and then grep open bindgen.log to find out which files are missed.

thanks a lot for the tips, I had to install the missing library (libllvm7) to make it compile.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.