dfhack
dfhack copied to clipboard
Cannot initialize ruby plugin: failed to load ruby library after update to Big Sur
After updating to MacOS 11.1, I got this error: "Cannot initialize ruby plugin: failed to load ruby library". Game still runs tho. I updated ruby to 2.7.2p137 using rbenv... problem persists. My next course of action is to try and build from source, never done that before.
The Ruby plugin only looks for the Ruby library in the following two places on macOS, so updating your system-wide Ruby alone wouldn't be enough: https://github.com/DFHack/dfhack/blob/a7232499ac78ae85346cac43254eea4ee156dc90/plugins/ruby/ruby.cpp#L330-L331
Can you upload your stderr.log file?
Seems libruby.dylib is missing... but why
Does hack/libruby.dylib
exist? Looks like it might not, according to the log. If it does, can you try running xattr -d com.apple.quarantine hack/libruby.dylib
and see if that helps?
This particularly library is also pretty old, and there's a chance it doesn't work on macOS 11, but I would expect a different message other than image not found
if that were the case. I've been working on updating it, but I'm not sure if we have a stable build yet.
Disregard my comment about hack/libruby.dylib
- it looks like we've always relied on the system-provided Ruby on 64-bit macOS instead of distributing that file.
Does /System/Library/Frameworks/Ruby.framework/Ruby
or /System/Library/Frameworks/Ruby.framework
exist?
It does, but I did some digging around, turns out the symlink(alias) is broken between ...Ruby.framework/Ruby and the actual ruby install within the Versions folder. So dfhack worked in pointing out there was a problem with ruby. Any idea as to how I can go about fixing this?
Interesting - that's similar to #1613, but there wasn't a broken symlink issue there.
If you want to try out the Ruby build I've been working on for #1718, you can get a recent version from https://github.com/lethosor/ruby-build/actions/runs/447673168 (direct link to macOS download). Ruby scripts themselves will have issues without additional updates to the plugin itself, but it would be useful to me to know if this at least loads on macOS 11 successfully, and if simple scripts like multicmd
or startdwarf
work (or even just :rb puts RUBY_VERSION
).
Ok, so the macOS libruby.dylib
worked like a charm and is loaded. :rb puts RUBY_VERSION
prints 2.7.2
. startdwarf
and multicmd
works fine but print E: RuntimeError: too low
.
Oh, that error is expected if you run startdwarf without specifying a number above 7. The fact that it shows up every time you run a Ruby script after triggering that error is one of the bugs I was referring to that requires updates to the Ruby plugin.
Good to know that the library works for you, though! I plan to put out a wider call for testing a Ruby upgrade for a future release.
@lethosor Hey I have this exact same problem and this is the only thread on the entire internet that identifies it. I tried to download your Ruby build but the link is broken. Help me please.
Were you logged in to GitHub when you clicked on the link? You'll get a 404 if you're logged out, but it still works for me when I'm logged in.
Ah thanks it works now!
@lethosor hi, thanks for your work! I have the same issue, but putting libruby-2-7-2.dylib into the /hack folder does nothing. Any ideas what could be the reason? I might have symlink issues on my OS, but Ruby works fine from the Terminal.
Did you rename it to libruby.dylib
? And are you on macOS?
I'm on macOS Big Sur and after renaming to libruby.dylib
everything is working fine. Thanks!
For those who are late to the party (the artifacts from https://github.com/DFHack/dfhack/issues/1742#issuecomment-753686518 unfortunately appear to have expired): this prebuilt Ruby 2.7.3 binary from rubies.travis-ci.org seems to be working for me on 11.2:
Loading bindings from data/init/interface.txt
Resetting textures
DFHack is ready. Have a nice day!
DFHack version 0.47.05-r1 (release) on x86_64
Type in '?' or 'help' for general help, 'ls' to see all commands.
[DFHack]# :rb puts RUBY_VERSION
2.7.3
Just put the lib/libruby.2.7.dylib
from the archive as hack/libruby.dylib
, and you're good to go.
Sorry about that. ~~https://github.com/lethosor/ruby-build/runs/2349569885 should have binaries when it's done.~~ Some dependency broke, possibly due to a GitHub Actions upgrade.
A status update from #1718: currently, Ruby 2.7 has problems on Windows, and I have very limited bandwidth to troubleshoot those problems, so that is preventing us from moving to Ruby 2.7 across all platforms (which I would strongly prefer over the current setup). Unfortunately I don't have any estimate as to when these issues will be resolved.
Interesting - that's similar to #1613, but there wasn't a broken symlink issue there.
If you want to try out the Ruby build I've been working on for #1718, you can get a recent version from https://github.com/lethosor/ruby-build/actions/runs/447673168 (direct link to macOS download). Ruby scripts themselves will have issues without additional updates to the plugin itself, but it would be useful to me to know if this at least loads on macOS 11 successfully, and if simple scripts like
multicmd
orstartdwarf
work (or even just:rb puts RUBY_VERSION
).
Thanks for all the help you've been providing in this thread. I'm a new Mac user and am having the same issue as OP, however I can't download those Ruby files because it appears the link has expired. Any chance you could post a fresh link?
Thank you!
@pvtvega unfortunately I cannot, due to https://github.com/DFHack/dfhack/issues/1742#issuecomment-820093050. A change in the GitHub Actions environment (possibly an autotools upgrade) has broken the macOS build between December and now.
The instructions from https://github.com/DFHack/dfhack/issues/1742#issuecomment-819917573 might help you, though - specifically a Ruby 2.7 (not 3.0) build for a relatively recent macOS version should work.
I appreciate the quick reply, I’m replying by email so hopefully this makes it to you (I’m new to GitHub). I’ve successfully got the game to launch and properly load graphics now, but worldgen seems totally broken. I cannot get the world to generate past about the 15 year mark. But I suppose that would be an issue for a different forum. Oh well!
On May 9, 2021, at 16:46, Alan @.***> wrote:
@pvtvega https://github.com/pvtvega unfortunately I cannot, due to #1742 (comment) https://github.com/DFHack/dfhack/issues/1742#issuecomment-820093050. A change in the GitHub Actions environment (possibly an autotools upgrade) has broken the macOS build between December and now.
The instructions from #1742 (comment) https://github.com/DFHack/dfhack/issues/1742#issuecomment-819917573 might help you, though - specifically a Ruby 2.7 (not 3.0) build for a relatively recent macOS version should work.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/DFHack/dfhack/issues/1742#issuecomment-835885134, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUAIZSGCGBDUJR5Z6H2VK6LTM3YCZANCNFSM4VRSXIMA.
If you're running on an ARM machine, it could be an issue like https://www.bay12games.com/dwarves/mantisbt/view.php?id=11734 (unclear to me how widespread the issue is)
~~ I tried to download your Ruby build but it says its expired. Is there a newer version to try?~~
re-read you comment above and downloaded the 2.7 version to the hack directory and renamed it. working now. :D
Oh had to go to Prefs>>Security and unlock, Allow the lib there and run the command you mentioned:
xattr -d com.apple.quarantine hack/libruby.dylib
If your error didn't have anything to do with Ruby, this is definitely not the right place. I would recommend bringing it up in the Lazy Mac Pack thread.
For visibility: our current plan is to remove Ruby support because of issues like this being too difficult and time-consuming to address, and because Ruby doesn't play very well as an embedded language. See #2081 for more details.
Total noob. Trying to play DF for the first time on my M1 Macbook Air and I wanted the Isometric view with Stone Sense. Setting my "Print Mode" in Lazy Mac Pack to "2D" gives me this error too. And my DF screen also turns blank
I ran the command "brew install ruby" but that didn't solve it
The print mode setting has nothing to do with this issue, and this issue isn't related to stonesense. As for homebrew, it probably installs ruby somewhere that DFHack isn't looking.
For stonesense problems, please open a new issue.
Thanks for your help guys!
Installing Ruby 2.7.2 with rvm, copying libruby.2.7.dylib
to a /hack
folder and renaming the file to libruby.dylib
worked for me.
It was a pain to do, because at first brew was returning an error due to an old version of Xcode – I solved this by downloading 13.2.1 version from here: https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_13.2.1/Xcode_13.2.1.xip and placing the Xcode.app to my Applications folder. I'm not sure if it's necessary, but I also did this: https://developer.apple.com/forums/thread/677124 before installing the 13.2.1 Xcode.app
Then rvm was unable to compile Ruby 2.7.2 because Ruby 2.7.x doesn't support OpenSSL 3 – I've found a solution here https://stackoverflow.com/questions/76975314/rvm-error-while-running-make-install-in-ruby and used OpenSSL 1.
After all of this I finally was able to get a libruby.2.7.dylib
file from a /Users/[username]/.rvm/rubies/ruby-2.7.2/lib
directory and go to bed 😁
I hope this info will help somebody experiencing the same issue on Big Sur. Good luck fellow Urists!