rust.aws-cdk-lambda
rust.aws-cdk-lambda copied to clipboard
Hardcode or specify a glibc version for compilation
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-gnudefault 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