-
Notifications
You must be signed in to change notification settings - Fork 191
mini_racer: `rb_context_init_unsafe': External function cannot be found. #1827
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
Comments
So the v8 library or its functions seem to not be found for some reason. |
I think it is something to do with libv8 being c++, the mix of c++ with c appears a bit challenging for truffle. |
When I tried to install The issue might be that libv8 doesn't have bitcode, and that's currently required if the C/C++ extension directly links against it (not though FFI). We should probably relax that in Sulong and allow to use the native version of libv8. |
When trying to install libv8 locally with
With means I need to instal GLib 2, and the only reason it works for me locally on MRI is that it's precompiled on MRI. Maybe we could use the precompiled version on TruffleRuby, but that would need support in Sulong to mix bitcode functions and native functions. |
|
@eregon not on macOS though :( (yes, GLib 2 is installed via homebrew) |
@deepj And |
BTW, it looks like the
So we can't just set CC/CXX/PATH to compile it with our LLVM toolchain.
Which is the same error as above, |
@eregon hm, no. I guess rubyjs/libv8#280 can be related to this. Though, I have macOS 10.14 (Mojave), not 10.15 (Catalina). And what I remember, older libv8 gm was able to compile with TruffleRuby. Because I could run |
Previously TruffleRuby would install the precompiled However, To make the situation a little better I'll try to get TruffleRuby to install the precompiled version of So to get
It's unclear what's best currently. |
My 2 cents, I really have no idea how complex either options are but my strong pref would be to go with adding support in Sulong for libs with some bitcode and some native. GraalVM JS is going to have gaps compared to v8, v8 also has a big pile of features which people consume that are more around framework of operation like snapshots, memory limits and so on. Discourse leverages some mini racer specific things and does not use execjs at runtime. |
To give a bit more context, if It looks like libv8 might have support to use a system, I would assume dynamically-linked, libv8 but that doesn't really seem connected to anything: https://github.com/rubyjs/libv8/blob/5fc4ac7aba79e56acd37c46584a1d63a6bc362d0/ext/libv8/location.rb#L54 GraalVM actually contains a full |
With daea9b7 TruffleRuby will use the precompiled version of libv8, like MRI. So at least it will |
Notes:
There are no npm packages or |
There has been some progress on running mini_racer with libv8 which we can now compile as a shared library. The next blocker on running this is a Sulong limitation where it does not currently support returning struct-by-value yet at the boundary between Sulong and native code. |
@eregon look at rubyjs/libv8#304 if that doesn't have impact on TruffleRuby |
A bit more details, the current blocker is struct-by-value support in Sulong (which is being worked on). Looks like it's StartupData, defined as: class V8_EXPORT StartupData {
public:
const char* data;
int raw_size;
}; in V8. And CreateBlob returns StartupData: https://v8docs.nodesource.com/node-7.10/d6/d77/classv8_1_1_snapshot_creator.html#a45faf27c079e8d42b75d2799d9d497a5 We could try to execute V8 as bitcode on top of Sulong to workaround that not-yet-implemented feature in Sulong, but that's probably not the best idea. Looking at https://github.com/discourse/discourse/blob/bd3c0dd59f9034688d3ab70ff2317d4b910e9513/lib/pretty_text.rb#L67 |
mini_racer 0.6.3 works on TruffleRuby now 🎉 |
To reproduce:
Error:
The text was updated successfully, but these errors were encountered: