Skip to content

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

Description

@kaans

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:

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:

os.platform() === 'win32' ? `${this.runCommand}.cmd` : this.runCommand,

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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