-
Notifications
You must be signed in to change notification settings - Fork 15
Compile Rust code with lind-wasm #553
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
base: main
Are you sure you want to change the base?
Conversation
scripts/src/glibc/build/check.log
Outdated
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.
remove from commit
scripts/make_glibc_and_sysroot.sh
Outdated
| # rm -rf "$SYSROOT" | ||
|
|
||
| # # Find all .o files recursively in the source directory, ignoring stamp.o | ||
| # object_files=$(find "$BUILD" -type f -name '*.o' \ |
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 believe this is all math stuff, if so remove this file from commit
src/glibc/lind_syscall/crt1.o
Outdated
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.
binary needs to be removed from commit
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.
all the math things as well, i think all the glibc changes arent part of this
| for import in module.imports() { | ||
| if let Some(m) = import.ty().memory() { | ||
| if m.is_shared() { | ||
| // if m.is_shared() { |
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.
@qianxichen233 can you chime in here a bit about this fix?
we're going to need to do something besides just comment out the code and we need some context
| pid, | ||
| minimal_pages << PAGESHIFT, // size of first memory region | ||
| // minimal_pages << PAGESHIFT, // size of first memory region | ||
| 16777216, |
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.
this part as well
scripts/make_glibc_and_sysroot.sh
Outdated
| -MD -MP -MF $GLIBC/build/nptl/elision-unlock.o.dt \ | ||
| -MT $GLIBC/build/nptl/elision-unlock.o | ||
|
|
||
| $CC $CFLAGS $WARNINGS $EXTRA_FLAGS \ |
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.
why are we getting rid of these?
|
@stupendoussuperpowers Can you try this out and see if you can reproduce compiling fdtables for wasm? |
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.
remove file from PR
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.
Remove from PR
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| SYSROOT=/home/lind-wasm-rust/lind-wasm/src/glibc/sysroot |
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.
lind-wasm-rust -> lind-wasm
| target = "wasm32-wasip1" | ||
|
|
||
| [target.wasm32-wasip1] | ||
| linker = "/home/lind-wasm-rust/wasip1-clang.sh" |
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.
lind-wasm-rust -> lind-wasm
|
|
||
| [target.wasm32-wasip1] | ||
| linker = "/home/lind-wasm-rust/wasip1-clang.sh" | ||
| rustflags = [ |
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.
arguments need to be updated per new script
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.
lets move this file to src/scripts/rust/config.toml.template
|
Lets add a short explainer doc in docs/contributing/compiling-with-rust.md |
PURPOSE
This PR introduces initial support for compiling Rust programs into Lind-WASM, allowing Rust source code to be built into WebAssembly modules that run correctly within the Lind runtime environment. The goal is to extend Lind’s existing C toolchain so that Rust developers can write, compile, and execute programs using the same infrastructure and conventions used by other Lind-supported languages.
This work includes:
rustc/ Cargo targetingwasm32-wasi)RELATED ISSUE
Fixes: [lind-wasm #422](#422)
"Compile Rust code into Lind WASM"
This PR implements the functionality, providing a working pipeline to compile and run Rust programs in Lind.