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
Feature request: Rust and Cargo #151
Comments
|
Hi I have exactly the same question, that's the reason I am exploring the build process of a-shell. Any recommendations where to start ? |
|
Hi, these are very good questions. a-Shell does not have any deep dependency to python, python is just treated like one of the many commands available. To compile a command, you will need to:
The first step can be difficult if the package or command insists on guessing the compiler and flags rather than letting you set them. If your command is simple and fast (so, not rust or cargo) you can also compile it to webAssembly, which makes things a lot easier. If the command uses |
|
Thanks for the detailled instructions. But... rust is a llvm based compiler, cargo it's packaging and build system :=) Challenge is to support a different compiler. My proposal for a seperate app is not to enlarge the bulky and ressource heavy a-shell by adding the resource intensive rust compiler on top. If I understood correctly, the App Group Feature would make it possible to interact a "rust shell" with "a-Shell" , right? |
|
You probably want to have a look at https://github.com/holzschu/llvm-project, then. But compilers are just like other commands, only larger. For a compiler to create something that can be executed, it has to produce webAssembly, which should be feasible for rust. |
That’s very interesting, and I think I’ll have a look at that just for the learning experience. I think it might become handy down the road in my studies! I know there’s already a fair share of rust compatability with wasm, so I guess it should be somewhat possible to have something working. No idea about cargo though. |
|
I should probably have added a step 0 for compilers: first compile the compiler on your usual computer, and check that it can produce webAssembly programs that are compatible with the wasi-sdk: https://github.com/holzschu/wasi-sdk and https://github.com/holzschu/wasi-libc. |
|
I’ll look into this! Thank you so much, it’s very interesting and nice to get some more hands-on experience |
|
rust target wasm32-wasi works out of the box. That's really great. |
AFAIK, a-Shell already support clang and it is gcc that is not supported by a-Shell. So maybe it’s not that hard to support cargo, but you probably need to configure cargo to use existing llvm toolchain dynamically instead of compiling another one. |
|
It seems that |
|
This comment about compiling miri (and I think also rustc) to WASM is interesting: rust-lang/miri#722 (comment) |
|
Fun fact: cargo can actually can be used as a library. |
wasmer v2.1.0 can now compile wasm to native dynamic library. |
Replying here because it's the most relevant place regarding adding LLVM based languages. .I want to know if this seems possible to you? I've been trying to get Julia in a-shell. There was some work compiling (an older version) to wasm , but it's pretty limited if you want to use any real functionality.
|
|
I honestly have no idea. It's worth trying, though. |
|
@rquinn2 Think this might be relevant https://github.com/Keno/julia-wasm ? |
Well, yes and no. As I understand it, the version of julia they got running there is quite limited and compiling everything to WASM is a daunting task. Additionally, having everything in WASM adds another layer of emulation to things slowing it down. It's probably more realistic to take an approach like I mentioned above and go "half and half" - we have an LLVM here that targets WASM. So hopefully it's possible to build the rest of Julia natively to a static binary, which is nice because getting of all the dependencies built for WASM looks nasty. The Julia runtime and compiler are also able to be seperated now, if that helps us in any way. I don't have much time to try it, but I've taken a few shots so far and haven't gotten very far. The first goal would be to get a fully native julia running in a-Shell, which as @holzschu has mentioned would not be approved by Apple (but would at least us sign a dev copy ourselves and use it). From there we'd try to use the WASM capabilities here to export the offending bits and make it "Apple safe"...if that's at all possible. Another option is to accept the performance hit and try to use JuliaInterpreter rather than Julia's JIT. |

Hi!
Would it be possible to include Rust and Cargo in a-shell? As far as I know Rust has a lot of interoperability with C/C++, so I have no idea if it would be possible to include in a future version.
Thanks in advance!
The text was updated successfully, but these errors were encountered: