cdklabs / cdklabs/aws-lambda-rust

Build Rust lambda on Windows fails due to invalid name of binaries

Open
#494 1 comment 0 reactions 1 assignee Claimed by @stevehouel View on GitHub
Dominant language
TypeScript
Stars
20
Forks
2
Avg merge
14m
Merged PRs (30d)
5

Description

When compiling a lambda for Rust using `cdk deploy` on Windows, the following error occurs:

```
bash: line 1: cargo-zigbuild.cmd: command not found
```

The following command is executed right before the error occurs:

```powershell
docker run --rm -u "1000:1000" -v "C:\\...\\lambda\\input-rust:/asset-input:delegated" -v "C:\\...\\cdk.out\\bundling-temp-03bd30f19334cab2ae18b7174c93b37693217b01635a7c8374264b1c777707ce-building:/asset-output:delegated" -w "/asset-input" cdk-17fb3785ac963db9e8320a984ec540bbbdbce8a3addc1c2485e82f5bb0639a94 bash -c "cargo-zigbuild.cmd zigbuild --manifest-path=/asset-input/Cargo.toml --target x86_64-unknown-linux-gnu --release --color always --bin input-rust && powershell -command Move-Item -Path /asset-input/target/x86_64-unknown-linux-gnu/release/input-rust -Destination /asset-output/bootstrap"
```

As can be seen in the output, the command `cargo-zigbuild.cmd` is supposed to be exeucted. After investigating the image, the command `cargo-zigbuild.cmd` is not part of the image. Only the command `cargo-zigbuild` can be found.

The same project compiles on WSL using Ubuntu 22 without any error.

Looking at the source code of aws-lambda-rust, it is hard coded that on Windows platform, that `.cmd` is always appended to the build command, see:

https://github.com/cdklabs/aws-lambda-rust/blob/6c9a60fcd966745e02949515393946029b78dc0e/src/package-manager.ts#L56

Apparently this leads to errors, because the binaries are not installed with .cmd ending but without it (same as on linux).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.