-
Notifications
You must be signed in to change notification settings - Fork 185
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
Problems compiling the rice gem #3357
Comments
Have you tried installing the gem?
And it also works fine when using I tried to
I would recommend to try with a build of truffleruby-dev, e.g. using ruby-build as described in the README. |
According to https://github.com/jasonroelofs/rice/blob/master/.github/workflows/testing.yml, one needs:
(that's rather unusual, but anyway) Using
So the first issue there is the usage of RBasic->klass, which should be replaced by the |
If I comment out that line in
I don't think embedding Ruby using Rice is something used much, so I would suggest to ignore that part and focus on what Rice is mainly used for: C++ extensions for Ruby. BTW, what do you want to use Rice for on truffleruby? Some specific gem using Rice I guess, which one? Regarding the missing symbols which TruffleRuby does implement like So instead I would suggest to focus on a specific gem using Rice, and the errors/issues when installing/using it on TruffleRuby. |
First of all, thank you so very much for your kind response (and your time). Second, thank you for making me realize I was thoughtlessly and unnecessarily banging my head against the wall. Of course, as you correctly guessed, I am not interested in making Truffleruby embeddable like MRI for the purpose of running the rice test set. My objective is instead to get the torch.rb gem working on Truffleruby. I think Truffleruby has a great potential for a lot of ML use cases and it would be nice being able to run what is arguably the leading ML library on top of it. After your feedback, I created a new setup with a simple script using torch.rb. Doing so, I realized that the first step towards getting torch.rb working on Truffleruby was to implement the rb_frame_method_and_id internal. So I did just that and submitted PR #3363. The patch seems to work for me. However, I am not sure if my code is 100% correct and I am not sure what kind of spec - if any - one could add to test this code in an effective way. Could I please ask you to give it a look? |
I might have spoken too soon. It looks like torch.rb has other issues in addition to the lack of rb_frame_method_id_and_class internal API. For instance, take a look at this:
I am willing to try to fix these bugs, but I wouldn't know where to start. Do you have any suggestions? |
I also tried to run the rice sample_callback example and ran into another issue (the lines before the exception are $stderr.puts/System.err.printlns that I added to the code to try understanding what is going on):
Apparently, the member variable srcArgIdx of a SourceArgumentInformation instance is somehow assigned the value -1 and causes everything to blow up. However, I don't understand Truffleruby and rice enough to understand how to fix this. Also, I don't see any correlation to the problem I reported above. I think I hit a wall here. I really wouldn't know how to proceed. I would really appreciate some hints. |
Note that this is related to #3205. |
As I traced the problem down to a condition in LLVMForeignCallNode where bitcodeParameterInfo is not null and srcArgIndex is -1, I tried to apply (bovinely, as I really don't know what I am doing here) the following patch:
but it doesn't work. I still get an internal exception:
(Note that this trace belongs to the enum sample of rice, which I tried because I thought it might be easier to run than the callback sample.) |
I am trying to get the rice gem working with truffleruby. I know that rice leverges MRI internals, but I wanted to check if it was possible to make it work with truffleruby with a moderate development effort.
Unfortunately, before I even arrived to identify which MRI internal functions required by rice are missing in truffleruby, I got some very weird compilation errors. It seems that the linker does not find functions that should be in the truffleruby dynamic library. Here is an example of the (many) errors I get:
I checked with nm and most of the symbols that the linker complains about are apparently in the truffleruby dynamic library:
Here is what I did, in details:
I compiled truffleruby using the instructions in the Truffleruby Contributor Workflow document:
I then did install the new version of truffleruby in rbenv for convenience:
I downloaded rice and I set up rbenv to use truffleruby-jvm-ce:
I then tried to build rice:
I am using the system compiler (clang) on a 2020 M1 MacbookPro:
The text was updated successfully, but these errors were encountered: