rnag / rust.aws-cdk-lambda

A CDK (v2) Construct Library for AWS Lambda in Rust
ISC License
83 stars 4 forks source link

Hardcode or specify a glibc version for compilation #6

Open rnag opened 2 years ago

rnag commented 2 years ago

This issue derives from an understandable concern in this Reddit thread. Essentially it can be summed up as follows:

[...] I'm just worried that this is just working so far by chance, because if the aarch64-unknown-linux-gnu default glibc version ever increases to a version higher than the AL2 glibc then everything will stop working.

So basically, in our case it would be a good idea to specify the glibc version - when running zigbuild at least, I'm not sure if cross supports it.

It might be worth it to hardcode glibc=2.26, as I believe that's what the docs on amazon linux 2 seem to indicate is the version of glibc that the AL2 runtime uses.

Resolution

As suggested in the same Reddit thread, we easily specify glibc version when running zigbuild - for example, to compile for glibc 2.26 (which is what AL2 uses) with the aarch64-unknown-linux-gnu target:

cargo zigbuild --target aarch64-unknown-linux-gnu.2.26