avr-rust / libc

Bindings to avr-libc
MIT License
15 stars 4 forks source link

[atmega328] build.rs failed with "libclang error" #5

Open jsen- opened 4 years ago

jsen- commented 4 years ago

I'm using rust nightly from 2020-09-02

$ rustup default nightly-2020-09-02-x86_64-unknown-linux-gnu
$ rustc -Z unstable-options --print target-spec-json --target avr-unknown-gnu-atmega328 > atmega328.json
$ LLVM_CONFIG_PATH=/usr/lib/llvm-8/bin/llvm-config cargo build --target atmega328.json
   Compiling avr-libc v0.2.0 (/home/max/projects/rust-arduino-blink/deps/libc)
error: failed to run custom build command for `avr-libc v0.2.0 (/home/max/projects/rust-arduino-blink/deps/libc)`

Caused by:
  process didn't exit successfully: `/home/max/projects/rust-arduino-blink/deps/libc/target/debug/build/avr-libc-78b126eedfe0d9fc/build-script-build` (exit code: 101)
  --- stdout
  loading pack '/home/max/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/avr-mcu-0.3.4/packs/atmega/ATmega328.atdf'

  --- stderr
  thread 'main' panicked at 'libclang error; possible causes include:
  - Invalid flag syntax
  - Unrecognized flags
  - Invalid flag arguments
  - File I/O errors
  - Host vs. target architecture mismatch
  If you encounter an error missing from this list, please file an issue or a PR!', /home/max/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.54.0/src/ir/context.rs:573:15
  stack backtrace:
     0: rust_begin_unwind
               at /rustc/130359cb05246fcacdde61baa2613419ef6570c7/library/std/src/panicking.rs:483
     1: core::panicking::panic_fmt
               at /rustc/130359cb05246fcacdde61baa2613419ef6570c7/library/core/src/panicking.rs:85
     2: core::option::expect_failed
               at /rustc/130359cb05246fcacdde61baa2613419ef6570c7/library/core/src/option.rs:1213
     3: core::option::Option<T>::expect
               at /home/max/.local/share/rustup/toolchains/nightly-2020-09-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:333
     4: bindgen::ir::context::BindgenContext::new
               at /home/max/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.54.0/src/ir/context.rs:567
     5: bindgen::Bindings::generate
               at /home/max/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.54.0/src/lib.rs:2109
     6: bindgen::Builder::generate
               at /home/max/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.54.0/src/lib.rs:1422
     7: build_script_build::generate_bindings
               at ./build.rs:190
     8: build_script_build::main
               at ./build.rs:61
     9: core::ops::function::FnOnce::call_once
               at /home/max/.local/share/rustup/toolchains/nightly-2020-09-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
dylanmckay commented 4 years ago

Unlikely to be related to AVR directly - perhaps https://github.com/rust-lang/rust-bindgen/issues/1771

I have updated bindgen from 0.54 to 0.55 and published avr-libc version 0.2.1 which may fix the issue for you

jsen- commented 4 years ago

Got the same exact error :( I tried latest nightly rustc as well. Can I help you troubleshoot this somehow? Anyway, just to let you know, this is not really blocking me with anything, so feel free to postpone or even close :)

imrekuti commented 4 years ago

Hello. I got the same exact problem with the latest versions. Can you help me find a solution?

dylanmckay commented 3 years ago

@imrekuti Are you also using LLVM_CONFIG_PATH=/usr/lib/llvm-8/bin/llvm-config?

What is your OS?

Also, could you run clang --version and llvm-config --version and post results?

Cheers