Info
This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Thread 'main' panicked at 'libclang error; possible causes include:
Hello,
I am trying to generate the C structs for Rust using the bindgen. Below is my build.rs file content
use std::env;
use std::path::PathBuf;
fn main()
{
let illd_include = r"<path>\Infineon_Libraries\iLLD\TC37A";
let bindings = bindgen::Builder::default()
.header("wrapper.h")
.use_core()
.ctypes_prefix("core::ffi")
.allowlist_type("IfxDma_Dma_Channel")
.allowlist_type("IfxDma_Dma_ChannelConfig")
.clang_arg(format!("-I{}", illd_include))
.generate()
.expect("Unable to generate bindings");
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
bindings
.write_to_file(out_path.join("bindings.rs"))
.expect("Couldn't write bindings!");
}
Wrapper.h
#include "IfxDma_Dma.h"
I am encountering the following error:
error: failed to run custom build command for
rust_code v0.1.0 (<path>\source_code\DMA_Data_Transfer\rust_code)
Caused by:
process didn't exit successfully: <path>\source_code\DMA_Data_Transfer\rust_code\target\debug\build\rust_code-4407a73162f37964\build-script-build
(exit code: 101)
--- stderr
thread 'main' panicked at 'libclang error; possible causes include:
RUST_BACKTRACE=1
environment variable to display a backtraceI am unable to fix the issue. It would be of great help to know the issue and fix it.
Thanks
1 post - 1 participant
🏷️ Rust_feed