-
Notifications
You must be signed in to change notification settings - Fork 5
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 compilation to NodeJS module #111
base: main
Are you sure you want to change the base?
Conversation
I guess it was an accident that you checked in the build outputs? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think after this initial PR you should look into cross language LTO to bring the code size down (for web). As of right now the release profile isn't even using LTO for the rust code. Adding wasm-opt to the pipeline will also help a lot.
I did it to share the output with @pgherveou |
# Install LLVM required for the compiler runtime, runtime-api and stdlib | ||
curl -sSL --output llvm.tar.xz https://github.com/llvm/llvm-project/releases/download/llvmorg-18.1.4/clang+llvm-18.1.4-x86_64-linux-gnu-ubuntu-18.04.tar.xz | ||
tar Jxf llvm.tar.xz | ||
mv clang+llvm-18.1.4-x86_64-linux-gnu-ubuntu-18.04 llvm18/ | ||
echo "$(pwd)/llvm18/bin" >> $GITHUB_PATH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I still don't understand what we need it for. Don't we build LLVM completely from source with emscripten? What is this binary version needed for? Shouldn't the emscripten build version be used for everything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need the RISC-V compiler-rt and also we compile some shared code (for example our "stdlib") into LLVM bitcode at this stage. Those bitcodes are bundled with the compiler and just linked into into contract code. The emscripten version does compile contract code but not those things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These crates are compiled on the host to the RISC-V target, to be linked into the contract binary when it is built using the WASM version of revive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
Cross-compile the
resolc
binary to WebAssembly (WASM) using Emscripten.