-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
is it possible to get stuff from compiler_rt to be in the modules? #9964
Comments
How are you linking the wasm module? compiler-rt, just like libc should be linked into the wasm file. |
Firstly I compile with the flags "-s MODULAR=1 -s EXPORT_ES6=1 -s LINKABLE=1" then I generate bitcode static file and take that file and link against it |
It's working fine with C++ projects (linked harfbuzz and Bullet successfully) |
So it sounds like you are not linking at all, basically building a big object file? So that result won't have any libc or copiler-rt of any library as part of it. And then how do you link the resulting library/object? Are you trying to link it with emscripten or with some other linker? Or are you actually doing a link step to produce that bitcode? I believe that "-s MODULAR=1 -s EXPORT_ES6=1 -s LINKABLE=1" are all link-time only flags that should not be needed if you are just building an object file.. i.e. only effect the linker output, not the compiler output. |
Oah I see what you mean I used to use these flags on my other emscripten projects so didn't think much of it ; and I am then linking the bitcode file with rust |
I'm not sure how the rust+emscripten thing works. Perhaps @tlively knows more. But in general emscripten-generated code can end up depending on emscripten's compiler-rt and other core libraries being available at link time. |
Is there anyway to have this inside the bitcode file ? |
@GreatIndieDeveloper how are you linking Emscripten's output with your rust code? Are you using the |
Nope I am using the wasm32-unknown-unknown and I been able to get C++ libs linking successfully |
Ah, that is not expected to work right now due to a mismatch between the C ABI used by Rust with the wasm32-unknown-unknown target and the actual C ABI used by clang and Emscripten. If you want to link C/C++ objects into your Rust wasm project, you have to use the wasm32-unknown-emscripten Rust target for now. |
Is there any plans to have this working in the near future ? :) As this would be extremely useful |
And this is actually a bit weird as I got Bullet linking successfully before |
With extern C for the interface I will be using and a custom malloc |
.. |
There are plans to resolve the ABI mismatch by introducing a new C ABI that will be used by both Rust and C, but there is a lot of work that will have to happen first, so this is not going to be a short term solution. See WebAssembly/tool-conventions#88 for more details. |
This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant. |
i am having an attempt at creating a wasm module from emscripten and then linking it to rust and for the most part it works p good but i tried to do it with "FreeType" and then noticed that when trying to link it in rust i get "undefined symbol : THREW" which if i understand correctly makes sense because such function is only added at the final stages so how can i get such thing to be embedded in the module
The text was updated successfully, but these errors were encountered: