Skip to content

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

Open
@jsen-

Description

@jsen-

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.

Activity

dylanmckay

dylanmckay commented on Oct 1, 2020

@dylanmckay
Member

Unlikely to be related to AVR directly - perhaps rust-lang/rust-bindgen#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-

jsen- commented on Oct 1, 2020

@jsen-
Author

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

imrekuti commented on Oct 20, 2020

@imrekuti

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

dylanmckay

dylanmckay commented on Oct 29, 2020

@dylanmckay
Member

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @jsen-@dylanmckay@imrekuti

        Issue actions

          [atmega328] build.rs failed with "libclang error" · Issue #5 · avr-rust/libc