Skip to content

bindgen infinite loop preventing build from progressing #1489

@znoble360

Description

@znoble360

Describe the bug
A clear and concise description of what the bug is.

I have a cmake project that successfully builds in my environment, but when trying to build my bindings in rust, the build process gets stuck with no progress. I have been able to drill down through the calls to find an infinite loop in autocxx-bindgen/ir/item.rs where the "name_target" function is never exiting.

To Reproduce
Steps to reproduce the behavior with appropriate Rust and C++ code snippets. Ideally, please raise a new pull request with a failing test - instructions are here. If that isn't possible, a few other options are listed too.

About half of the time people report bugs, they're not readily reproducible. That wastes time for everyone. That's why it's incredibly useful to have a test case which definitely fails. Thanks!

Unfortunately it seems like other systems that I have tried this on do work, so I'm not sure what it is about my environment that is making it fail. I'm depending on autocxx-bindgen v0.65.1 and autocxx v0.26.0.

hashes for my currently used versions:

  • autocxx-engine: 0.26.0: 60230d2
  • autocxx-bindgen: 0.65.1: 8b2a664c3681d296940123027261117c0ef1677c

The call stack for this infinite loop is as follows:

- project build.rs file: 			call build() on an autocxx_engine::builder::Builder (b.build())
- autocxx-engine-0.26.0/src/builder.rs:193: 	inside the impl<CTX: BuilderContext> Builder<'_, CTX> is the build fn that calls self.build_listing_files()
- autocxx-engine-0.26.0/src/builder.rs:237:	inside the impl<CTX: BuilderContext> Builder<'_, CTX> is the build_listing_files fn that calls autocxx_engine::parse_file::ParsedFile::resolve_all on parsed_file
- autocxx-engine-0.26.0/src/parse_file.rs:403:	resolve_all calls autocxx_engine::IncludeCppEngine::generate on include_cpp
- autocxx-engine-0.26.0/src/lib.rs:455: 	generate calls autocxx_bindgen::Builder::generate on builder
- autocxx-bindgen-0.65.1/lib.rs:340: 		generate calls autocxx_bindgen::Bindings::generate
- autocxx-bindgen-0.65.1/lib.rs:889: 		generate calls autocxx_bindgen::codegen::codegen
- autocxx-bindgen-0.65.1/codegen/mod.rs:4943: 	codegen calls autocxx_bindgen::ir::context::BindgenContext::gen on context
- autocxx-bindgen-0.65.1/ir/context.rs:1172: 	gen calls autocxx_bindgen::ir::context::BindgenContext::compute_allowlisted_and_codegen_items on self
- autocxx-bindgen-0.65.1/ir/context.rs:2351:	compute_allowlisted_and_codegen_items calls autocxx_bindgen::ir::item::Item::path_for_allowlisting on item
- autocxx-bindgen-0.65.1/ir/item.rs:1075: 	path_for_allowlisting calls autocxx_bindgen::ir::item::Item::compute_path on self
- autocxx-bindgen-0.65.1/ir/item.rs:1090: 	compute_path calls autocxx_bindgen::ir::item::Item::name_target on self
- autocxx-bindgen-0.65.1/ir/item.rs:689: 	infinite loop here never exits

Expected behavior
A clear and concise description of what you expected to happen.

Eventually I would expect name_target to exit the build to finish, but it never exits and so never finishes the build

Additional context
Add any other context about the problem here.

I'm not sure how else to get more information on what might be happening, but I can see that it seems to be getting stuck on a particular type, because it seems like I am getting through that loop plenty of other times, but then it get stuck on one. How might I go about trying to figure out what particular token or item is getting stuck?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions