rust-lang / rust-lang/rust-bindgen

layout tests failing for Octave bindings on Linux

Open
#1,682 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
5.3k
Forks
829
Avg merge
1d 1h
Merged PRs (30d)
15

Description

There are 7 layout tests failing for my Octave bindings on Linux. https://github.com/ctaggart/octh/issues/38

failures:
    root::__bindgen_test_layout_base_list_open0_regexp_match_element_close0_instantiation
    root::octave::bindgen_test_layout_diary_buf
    root::octave::bindgen_test_layout_diary_stream
    root::octave::bindgen_test_layout_output_system
    root::octave::bindgen_test_layout_pager_buf
    root::octave::bindgen_test_layout_pager_stream
    root::octave::bindgen_test_layout_regexp_match_data

test result: FAILED. 362 passed; 7 failed; 0 ignored; 0 measured; 0 filtered out

I'm not sure if it is released by diary_stream was also mentioned in #1051.

Input C/C++ Header

I've been reducing it for the the last couple of weeks on a small VM in Azure. Unfortunately, it may take 3 more months to reduce down completely at the current rate. It is at 2210 lines. I'm committing progress of the creduce here https://github.com/ctaggart/octh/pull/41:

https://github.com/ctaggart/octh/blob/octh38/__bindgen.ii

Bindgen Invocation

creduce ./issue/octh38.sh __bindgen.ii

https://github.com/ctaggart/octh/blob/octh38/issue/octh38.sh

#!/bin/bash
# time creduce ./issue/octh38.sh __bindgen.ii

cp $HOME/github/octh/Cargo.toml .
cp $HOME/github/octh/build.rs .
mkdir src
cp $HOME/github/octh/src/lib.rs src
cp $HOME/github/octh/src/octhelp.cc src
cp $HOME/github/octh/src/octhelp.h src
BINDGEN_HEADER="__bindgen.ii" cargo test \
2>&1 \
| grep "thread 'root::octave::bindgen_test_layout_output_system' panicked at 'assertion failed:"

https://github.com/ctaggart/octh/blob/octh38/build.rs#L16-L29

    let mut builder = bindgen::Builder::default()
        .header(header)
        .clang_arg("-v") // verbose
        .clang_arg("-x") // -x c++
        .clang_arg("c++")
        .clang_arg("-std=gnu++11")
        .enable_cxx_namespaces()
        .whitelist_type("octave.*")
        .whitelist_function("octave.*")
        .opaque_type("octave.refcount")
        .use_core()
        .opaque_type("std::.*");

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the seven failing layout tests and the reproduction script in issue/octh38.sh, using the reduced __bindgen.ii input and the bindgen configuration in build.rs lines 16-29. Run the shown cargo test command, then compare the generated layouts for the listed Octave types; done means explaining and resolving the seven Linux failures.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, rust
Domain
compilers, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.