New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add GMP Linker Support #289
Comments
the problem might be that this project is still using an old version of cargo-zigbuild. I took a look at it last weekend, and it would require significant changes because it also requires updating Clap. |
@calavera Few questions:
|
if That won't fix your runtime error which is probably caused because the Lambda environment doesn't have the shared libraries that you need. I cannot help you with that. |
@calavera This approach did not work for me. Using
|
I just released Cargo Lambda 0.13.0 that upgrades cargo-zigbuild to 0.14.1 which should soport GMP. |
@calavera Thanks for the update. Unfortunately, this did not seem to fix the problem.
Are there linking nuances in relation to the zigbuild? |
no difference, it's exactly the same code. Are you sure you're not using docker or some other host to run zigbuild?
This error is caused because there is a library missing in your host. |
@calavera Yep, I am running In
To
You should see that in both MacOS and Linux, |
I did some investigation and I found why You can test this by running this command:
In theory, you should get the same output than running I think this might be a problem in Zig itself, it looks very similar to ziglang/zig#8103 @messense do you have any idea how to solve this? |
Does settings |
IMO zig might not help with the glibc version issue when linking external dylibs since the GMP shared library might require a higher glibc version. |
Adding RUSTFLAGS="-L /usr/lib/x86_64-linux-gnu" I'm closing this issue since it looks like we can compile the code correctly with the library path in the flags. @daryakaviani as we mentioned earlier, the fact that this code compiles doesn't mean that it will work on Lambda. I don't know if GMP is necessary at runtime, but if it is, you'll have to find a way to bundle it with your binary, or in a layer. |
I am attempting to use the multi-party-ecdsa library which uses GMP in my Rust lambda function. GMP is a precision arithmetic library which is commonly used in cryptography research, especially via Rust, so its support would be widely useful for the systems, security, and applied cryptography communities.
Running
cargo lambda build
causes the following error:This is specific to
cargo-lambda
's usage of thezigbuild
linker becausecargo build
works successfully whengmp
is installed. Also,cargo zigbuild
works, so it could be the specific waycargo-lambda
handles environment variables in relation to thezigbuild
linker. This error is exclusively introduced when I importmulti-party-ecdsa
insrc/main.rs
. To confirm that this is a machine-agnostic issue, I tried it on x86-64 Ubuntu, x86-64 Amazon Linux, x86-64 MacOS, and ARM M1 MacOS and received the same results. I attempted a workaround on Linux by disabling thezigbuild
linker:This successfully compiled my artifacts and deployed the function, but invocation caused:
Is it possible for
cargo-zigbuild
orcargo-lambda
to be updated for GMP support? If there is an existent workaround, please let me know and feel free to move this to Discussions!@calavera @messense
The text was updated successfully, but these errors were encountered: