rust-lang / rust-lang/rust-bindgen

error[E0428]: the name `__node_pointer` is defined multiple times

Open
#1,662 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I ran into this a week ago https://github.com/ctaggart/octh/issues/36 and have been trying to get creduce to minimize the test case before reporting here. It feels similar to #1048, but may not be. The error is:

error[E0428]: the name `__node_pointer` is defined multiple times
Input C/C++ Header

I'm still trying to reduce it, but it is not reducing very fast. It is currently at 145 78 43 32 lines.
https://github.com/ctaggart/octh/blob/octh36/__bindgen.ii

  
template < class > struct a;
template < class b > struct a< b * > {
  typedef b c;
  template < class i > using d = i *;
};
template < class e, class f > struct g {
  typedef typename a< e >::template d< f > h;
};
template < class k > struct l { typedef k h; };
template < class > struct m { typedef l< int * >::h n; };
template < class, class > class __tree_node;
template < class o, class = typename a< o >::c > struct p;
template < class o, class b, class q > struct p< o, __tree_node< b, q > > {
  typedef o __node_pointer;
};
template < class q > struct r {
  typedef p< typename g< q, __tree_node< int, q > >::h > h;
};
template < class > class s;
template < class t > class w {
  typedef typename r< typename m< t >::n >::h x;

public:
  typedef typename x::__node_pointer __node_pointer;
  typedef s< __node_pointer > u;
};
template < class > class y {};
namespace octave {
class stream {
  y< w< int >::u > v;
};
} 
Bindgen Invocation

Subset of https://github.com/ctaggart/octh/blob/octh36/build.rs#L16-L54

    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()
        // .raw_line("#![allow(warnings)]")
        // .raw_line("extern crate core;")
        .opaque_type("std::.*");

    match target {
        "x86_64-apple-darwin" => {
            // brew install octave
            builder = builder
                // failing tests on macOS https://github.com/rust-lang/rust-bindgen/issues/1619
                .layout_tests(false)
                .clang_arg("-isysroot")
                .clang_arg("/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk")
                // .clang_arg("/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk")
                // .clang_arg("-I/usr/local/opt/llvm/include")
                .clang_arg("-I/usr/local/opt/octave/include/octave-5.1.0")
                // .clang_arg("-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include");
        },
        _ => (),
    }

I'm using bingen master, currently on:
https://github.com/ctaggart/octh/blob/octh36/Cargo.lock#L29-L31

name = "bindgen"
version = "0.51.1"
source = "git+https://github.com/rust-lang/rust-bindgen#18a64e60b3b04eac7f0830e59a078b031b095096"

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 minimized C++ header at octh36/__bindgen.ii and the bindgen Builder options shown in build.rs lines 16-54; run the reported bindgen 0.51.1 configuration with the C++ flags and inspect the generated bindings for duplicate __node_pointer definitions. Done means the failure is reproduced and its behavior is covered by a regression test or other repository evidence.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, rust
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.