-
Notifications
You must be signed in to change notification settings - Fork 83
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
Ocra not properly including Gems #174
Comments
Apparently that command just randomly started working. I don't know what I did, but whatever it was, it fixed something. |
Nevermind, this is still very busted as I cannot get any other gems to require in without tinkering with
Nowhere in here is Ocra actually logging that it is copying the lib folder over, rather it is instead copying everything BUT the lib folder. Ok, so my workaround (roughly) involves forcing Ocra to include with You should then go ahead and point Ocra to that file by adding the flag Repeat the above for every gem you need and you should be good! (Do note you will most likely end up with a very long command, especially when including gems that require other gems) Edit: Hm, I've run into something where I'm getting a loaderror even when the specific file it's looking for is there. I think something else may be going on here? I guess I'll have to look at the source code for Ocra potentially to get a better idea of what is actually going on here. Though, I really do not understand C whatsoever, so that probably won't really be of much use? |
Is it possible that you are running Ruby 2.7.3-1? I'm getting something similar after an upgrade from 2.7.2. I downgraded and it started working again. |
I just checked, and I'm using 2.7.2. |
I wonder, does ocra bundle in msvc ruby or msys2 ruby? |
Update: I just added all dlls manually using --dll for now. things then work. Some of my observations:
If you want to use sqlite
My command to compile including sqlite:
Current version of ocra is a bit janky, still very useful software though. My ruby versions: 2.7.2 and 2.7.3 |
@Largo thanks a lot for sharing this. From my side I can add that some gems may require |
Thanks a lot everyone for the investigation. @Speak2Erase I went into the same issue tonight. Ocra will compile in both Ruby 3.1 x86 and Ruby 3.1 x64 (after adding fiber.so where it has to, see). But, only in x86 my script ran. In x64 it asked for zlib.so. So I grabbed the unzip that Ocra does, and actually zlib.so is being included!!! So the error message is wrong and misdirects. So I saw @Largo and several other ppl talking about problems with the dlls (I also had to implement this solution) and ocurred to me to check the ruby_builtin_dlls directory. There are a couple of dlls, around 10. And one of those is: zlib1.dll. So I added that one with I suggest ocra to include all of this dlls, together they make ~4 MB. When you compile they become less than 1 MB. Or they could be taken into account if you select the I hope this help someone. Cheers. |
I believe ocra is no longer being maintained |
It's clunky but it still works. Maybe some day when I have plenty of extra time I can collab with the code, but that won't happen soon :/ |
I wouldn't mind maintaining something like this either, but I really don't have the time at the moment. I've got too many unfinished projects, annoyingly. |
@damian-m-g Your comment just saved me. My compiled exe kept throwing an exception like this:
But adding |
UPDATE: see my fork ocranwhere this should not be necessary anymore Ruby 3.1 Update with sqlite3:
How I figured out which dll was missing? |
I came across multiple open issues (168, 184, and 174) due to the same cause. Proposed solutions, involving bundling missing DLLs, are inconsistent across environments, working for some but not others. In some cases, the code compiles, but the executable either crashes at runtime or runs and does nothing. For those facing this issue, the solution mentioned above by @Largo includes a combination of DLLs that worked for
|
ocran is an actively maintained fork of ocra. For anyone else who stumbles onto this issue, you should try ocran instead! |
Thanks for the shoutout. We accept PRs as well! The OCRAN gem is built using github actions for safety. |
I've got a script for reading and dumping serialized ruby files into text files, and I need to share this script with people who don't have ruby installed and would rather not go through the process. This script needs the zlib gem to function properly, and Ocra appears to be ignoring any command arguments and does not include
zlib.so
no matter how much I try.I already had to force it to load zlib by including it in a Gemfile, and including it with
--gem-file
has no effect.I am beginning to think Ocra is incredibly broken.
Here's the command I'm running, and ocra's output:
ocra .\mklangsrc.rb --dll ruby_builtin_dlls\libssp-0.dll --dll ruby_builtin_dlls\zlib1.dll --no-enc --no-dep-run --console --verbose --gemfile .\Gemfile --gem-files C:\Ruby27-x64\lib\ruby\gems\2.7.0\gems\zlib-1.1.0\lib\zlib.so
Here's the error:
The text was updated successfully, but these errors were encountered: