Skip to content

Cargo-lambda 1.8.5 issue with sam builds (reopening) #865

@jlizen

Description

@jlizen

Hi @calavera, I think that #856 was closed prematurely - I can't reopen it at this point, sorry for the dupe issue.

This relates to cargo-lambda SAM build failing at some version greater than 1.8.1 (possible only since 1.8.5, unknown), with:

Error: RustCargoLambdaBuilder:CargoLambdaBuild - Cargo Lambda failed: Error:   × Failed to collect `zig cc` options

This comment diagnosed the issue as due to missing library directories in the author's dockerfile. They were only copying the binary in. They seem to have fixed their issue by copying the supporting /lib directory.

However, Failed to collect 'zig cc' options is a fairly broad error message that could come from various failure modes.

As part of aws/aws-lambda-rust-runtime#1006, I attempted to unpin aws-lambda-runtime-rust from cargo-lambda@1.8.1 and saw the same issue: sample run

Thing is, I am using mlugg@setup-zig which definitely does include the /lib directory (and which I validated by tinkering with that action locally).

The author of the action was kind enough to poke around, and confirmed that:

The theory about the Zig lib/ directory being missing from the installation is definitely not correct. That would be a severe bug, which would prevent any Zig usage at all from working with this Action (since the lib/ directory is essential to every non-trivial zig subcommand

They suggested that:

  1. There is likely a bug in cargo-zigbuild (or else the way that cargo-lambda calls it, perhaps)
  2. We seem to be eating the full error message that includes the cause being chained along with failed to collect 'zig cc' options, so probably getting that back in would be a good place to start.
  3. Cargo-lambda 1.8.5 issue with sam builds? #856 was indeed prematurely closed

I haven't gone as far as bisecting cargo-lambda versions vs cargo-zigbuild versions, reading either code path in depth, etc. I'll try to find time coming up but don't have cycles right this moment.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions