Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ctaggart opened this issue Oct 31, 2019 · 4 comments
Open

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

ctaggart opened this issue Oct 31, 2019 · 4 comments
Labels

Comments

@ctaggart
Copy link

ctaggart commented Oct 31, 2019

I ran into this a week ago ctaggart/octh#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"
@emilio
Copy link
Contributor

emilio commented Nov 13, 2019

Thanks for filing, this should be investigated.

@ctaggart
Copy link
Author

I've reduced it to 32 lines. I finally have the Octave bindings working on Linux! 2 years after I first tried. It really helps that I'm doing Rust at my day job now. This is blocking it from working on Mac and that is where I mainly want to use it.

@ctaggart
Copy link
Author

This blocks the building of Octave plugins in Rust on a Mac. 😭

@pvdrz
Copy link
Contributor

pvdrz commented Apr 19, 2023

Not sure if it is the same issue but the following reduced input fails with the same error message:

template < typename > class allocator;
template < typename > struct b;
template < typename c > struct b< allocator< c > > {
  using d = c;
};
template < typename > struct e : b< allocator< int > > {};
template < typename > struct f {
  typedef int g;
};
template < typename h = int > class i {
public:
  typedef typename e< typename f< h >::g >::d d;
};
class j : i<> {
  typedef d k;
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants