-
Notifications
You must be signed in to change notification settings - Fork 8
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
Compilation error : failed to run custom build command for 'ring v0.16.20' #78
Comments
Hello @albanducos87, thank you for openning the issue. I did not test (yet) the compilation or serverless deployment from Windows, as I do all the development from Linux. But I suspect that the error is related to cross-compiling (from a windows machine to produce a binary suitable for lambda deployment). Something may be need to be installed for the cross compilation to work from Windows. I really do not have much experience with such setup, but solution may be related to something like:
Posssible workaround: If setting up a Rust + serverless environment on Windows is too much complication, a simpler workaroound could be either to
Sadly, I may not be able to give you much support in the coming days, because I'm traveling and do not have a Windows laptop with me to do the tests. |
Hi, I reproduced the problem. This is a problem related to cross compilation of the ring crate while targetting linux-musl (the target that is set in serverless) from windows. I don't know serverless very well, but it might be more robust to compile the rust part inside a linux container with the proper toolchain (musl & co :) ) See for example: briansmith/ring/#1472 The workaround seems to be to use WSL when you want to cross-compile... |
Thanks @jfaixo, I realize that I used the Line 26 in 5ace291
According to serverless-rust plugin doc, it means that I had to add the I probably did this initially with the following command: |
Rust is usually very good at cross compilation, but the ring crate embeds C code I think, which require to have a fully blown toolchain for compiling C for the target platform, so it's becoming way more complex.. containerizing is the way ! |
I finally tested building or deploying the serverless app from Windows using WSL2 + Ubuntu. It works ⚡, Added procedure here: https://boavizta.github.io/cloud-scanner/how-to/building-cli.html and https://boavizta.github.io/cloud-scanner/how-to/deploy-sls.html. |
Long story short,:
1. Check availability and install if needed musl# Warning: musl-gcc may be missing, wich results in error:
# error: failed to run custom build command for `ring v0.16.20`
# it can be verified by trying to call musl-gcc on command prompt
# $ musl-gcc
# Which results in:
# Command 'musl-gcc' not found, but can be installed with:
# This musl-gcc is not available (preventing cross compilation)
# On linux Need to install musl-gcc
sudo apt update && sudo apt install -y musl-tools musl-dev 2. Install x86_64-unknown-linux-musl as rustup target# Add Linux musl target (needed for cross compilation for aws lambda)
rustup target add x86_64-unknown-linux-musl |
Not yet mentionned in the docs but I published a docker image to use Rust + Serverless in CI: # get image
docker pull ghcr.io/demeringo/rust-serverless-ci:latest |
Hello everyone
I hava an issue when I want to execute this command :
serverless deploy
My terminal show me an error and after many and many attempts, I don't know what to do.
Here's the error :
The text was updated successfully, but these errors were encountered: