rust-bindgen icon indicating copy to clipboard operation
rust-bindgen copied to clipboard

bindgen fails with SIGSEGV: invalid memory reference

Open tmvkrpxl0 opened this issue 1 year ago • 0 comments

Input C/C++ Header

it's entirely composed of #include statements

Bindgen Invocation

let bindings = bindgen::Builder::default()
    .header("cpp/bindings.h")
    .clang_args([
        "-x", "c++",
        "-Icpp/public",
        "-Icpp/public/tier0",
        "-Icpp/public/tier1",
        "-Icpp/public/bitmap",
        "-Wno-inconsistent-missing-override",
        "-D", "GNUC=1",
        "-D", "POSIX=1",
        "-D", "_LINUX=1",
        "-D", "LINUX=1",
    ])
    .parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
    .generate()
    .expect("Unable to generate bindings");

Actual Results

error: failed to run custom build command for `vgui-rs v0.1.0 (/home/tmvkrpxl0/CLionProjects/vgui-rs)`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.

Caused by:
  process didn't exit successfully: `/home/tmvkrpxl0/CLionProjects/vgui-rs/target/debug/build/vgui-rs-4610f4fb4fd62aea/build-script-build` (signal: 11, SIGSEGV: invalid memory reference)
  --- stdout
  (and then bunch of file paths for my project)

I recently decided to experiment with Valve's vgui so I extracted portion of Source Engine 2013 Multiplayer branch from here: https://github.com/ValveSoftware/source-sdk-2013/tree/master Code I'm currently working with is here. I can mirror it to github if it's needed: https://codeberg.org/tmvkrpxl0/vgui-rs/src/branch/master/src I was following tutorial from official book of rust-bindgen, and I added few clang flag as it didn't compile. In my repo I also included cmake config as well to see if it even compiles at all, and it does.

tmvkrpxl0 avatar Feb 16 '24 15:02 tmvkrpxl0