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

Build fails on Windows when the executable path has spaces on it #281

Closed
calavera opened this issue Oct 8, 2024 · 0 comments · Fixed by #282
Closed

Build fails on Windows when the executable path has spaces on it #281

calavera opened this issue Oct 8, 2024 · 0 comments · Fixed by #282

Comments

@calavera
Copy link
Contributor

calavera commented Oct 8, 2024

This was reported originally in awslabs/aws-lambda-rust-runtime#927, but after some investigation, I discovered that the problem lays on how cargo-zigbuild works on Windows.

If the path where cargo-zigbuild lives on Windows includes spaces, the build will fail because the path is not sanitized. When the linker is executed on Windows, Windows will interpret the first section of the path as the binary to execution, and it will fail because that path doesn't exist.

This is easily reproducible by putting the cargo-zigbuild.exe binary in a path with a space in it, and trying to build any rust project with it. You'll get an error like the screenshot below shows where Windows thinks that the first part of the path, until the space, is the command to execute:

image

I did some investigation, and it looks like the code to create the bat file on windows doesn't sanitize paths, but I don't know if that's the only problem:

pub fn prepare_zig_linker(target: &str) -> Result<ZigWrapper> {

PS: The screenshot say cargo-lambda.exe but that's a wrapper around cargo-zigbuild, which ultimately creates the linker script to execute and runs the command:

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

Successfully merging a pull request may close this issue.

1 participant