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

Cargo expand fails on windows within deeply nested folders #903

Closed
TomzBench opened this issue Nov 22, 2023 · 4 comments
Closed

Cargo expand fails on windows within deeply nested folders #903

TomzBench opened this issue Nov 22, 2023 · 4 comments

Comments

@TomzBench
Copy link

Hello,

Cargo-expand fails on windows when building the project in a deeply nested folder. I noticed this issue first on a CI for which i do not easily control the directories used, so i can't simply change my directory to work around the issue.

It seems like every build script.exe file is failing to link. Speaking in chat with somebody alluded to the fact that large link commands will some times fail. I suspect something like this is happening. Im not sure.

I created a minimum repository which reproduces the issue here.

Clone the repository into a pretty deep folder on a windows system. (For example C:\Users\tom\Git\gitlab-runners\atx-zdk\GjRA6MGh9\0\software-engineering\this\is\a\superlong\dir) and run the command cargo build --target thumbv7em-none-eabi --no-default-features --release. You will see some cargo-expand failure with error code 1104 file not found errors. And note that build_script.exe's are not found.

Run the same command in a more sensible windows directory, and the project will compile fine...

@TomzBench
Copy link
Author

TomzBench commented Nov 22, 2023

This workaround seems to work for me.

from: #347

    let crate_dir = env::var("CARGO_MANIFEST_DIR").expect("invalid manifest dir");
    env::set_var("CARGO_EXPAND_TARGET_DIR", crate_dir.clone());

Could be a cargo expand issue perhaps, or the way cbindgen is invoking cargo-expand 🤷‍♂️

@emilio
Copy link
Collaborator

emilio commented Apr 15, 2024

Yeah this seems unlikely to be a cbindgen bug per se, and more of a windows limitation with long command line arguments / paths...

@TomzBench
Copy link
Author

Yeah this seems unlikely to be a cbindgen bug per se, and more of a windows limitation with long command line arguments / paths...

ya. I run into permutations of this in various different ways in rust/javascript ecosystems. Should windows "be better"... Of course. Will it? ...no

@emilio
Copy link
Collaborator

emilio commented Apr 15, 2024

I don't think this is actionable on cbindgen's side unless we can somehow shorten the window paths or something... If you think there's anything we could do better here let me know and we can re-open / fix it :)

@emilio emilio closed this as completed Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants