-
Notifications
You must be signed in to change notification settings - Fork 786
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
Build ruby with shared library #35
Comments
That seems like a good default. |
I just added support for passing options to configure with the
|
Thanks! |
diff_match_patch_native also requires the shared library. Upvote for --enable-shared by default? |
From my limited knowledge, it seems that @nathanaeljones You didn't argue for your case well enough. What is diff_match_patch_native and why do you need it? |
It's the only reasonably fast way to get accurate diffs between large strings in ruby. The native ruby version takes upwards of 30 seconds on a 33kb file. Any gem that depends on Rice will require |
Over the last two months we've wasted more than 80 hours due to this bug. CONFIGURE_OPTS does not work reliably; often it takes 4-5 re-installs before it works, with no clear difference as to why. Identical ~/.bash_profile and a clean shell state doesn't help. All 8 machines are brand-new MBPs with Mavericks. Another fails to build the shared libraries no matter how many attempts are made. I've compared the version numbers of all the build tools used during the process, and they're all the same. This is probably the most costly bug we've encountered in the last 5 years. C++ and Ruby interop is important, no? Shared libs are built reliably, by default, with RVM, and despite its multitude of flaws, that one detail turned out more important than anything else in the rvm/rbenv balance. |
I'm sorry that you lost a lot of time on this. Any idea why setting Do you have a Ruby script I could run on a freshly compiled Ruby to test whether it was successfully built with |
I haven't found an easier way to test for I don't have any solid leads on the inconsistent behavior. I lined up 6 of the laptops last week and did the full uninstall/reinstall on all of them. Multiple times. There were a few errors, but I excluded all those that I found. For example, The ruby build never fails - it always succeeds. The flag just isn't getting to the actual compilation step. My uneducated guess is that somehow the bash variable is going out of scope too early, and not making it to ruby-build. IMHO, this should be a default, not an unreliable flag. |
Ouch. Just switched to chruby + ruby-build from RVM last week. +1, no downside to building libruby & it's used by (e.g.) mapnik_ruby (via rice). |
why not add this as default? I fail to see the reason. Everyone seems to be in favor of rbenv adding this as default? |
This comment has been minimized.
This comment has been minimized.
What exactly requires the shared library and would there be any downsides to enabling it for all builds? |
Ruby doesn't build as a shared lib by default. Most things link fine against the static lib. Generally, those who need a shared lib know. We could expose a toplevel option to make it easier/more discoverable, though. Rice does explicitly state "Also Rice requires a Ruby built with –enable-shared and will not install properly against a Ruby with only static libraries." but it doesn't give any guidance on how to do that with rbenv, rvm, etc. A little more background: https://www.ruby-forum.com/topic/4422189 Also, can be more specific than blanket CONFIGURE_OPTS: RUBY_CONFIGURE_OPTS=--enable-shared rbenv install 2.2.3 |
Is there a short code snippet one could use in |
Shared libraries are libraries that are loaded by programs when they start. When a shared library is installed properly, all programs that start afterwards automatically use the new shared library. So basically if you have a program that needs a shared library (in this case ruby libruby.so.2.2.0 or similar) the program will fail (to start hopefully) if it doesn't exist. if you want to know if you have the shared library you can do a simple search for the file libruby.so*, but as jeremy indicated, you don't need it, and those that do will know. |
seems like you can test it with https://github.com/jasonroelofs/rice/blob/master/extconf.rb#L21 |
Or I just came across the same issue with the cwiid gem, that didn't compile until ruby was installed with |
I wasted several hours trying to install qtbindings before realizing |
Can this please be re-opened? Lack of shared by default breaks so many applications and gems. |
@nathanaeljones This issue was open all along. If someone wants to contribute a workaround that does |
Is the most desirable way to add this by adding an enable_shared package target? edit to add: Here is what I came up with, as you can see it is a minimalist approach without any safety checks: rubypanther@4f7e4c7 |
Why not just pass |
Something to consider is that |
Is this option still valid? I remember it was working, but trying it now throws me a
|
@megatux It's |
🤦♂️ thx @eregon (I copied it from a comment above). |
Hey, would love to try and move this forward. I think getting Rice and the rbenv defaults to play nicely would be a big/foundational step forward for the Ruby ML ecosystem (more context here: ruby-rice/rice#112 (comment)). @eregon it sounds like performance may be a concern. I'm happy to help test this. What's the best way to do that? To all: are there any other concerns with making Edit: from what I can tell, rvm, Ubuntu, and Heroku all enable this by default. |
Awesome, thanks @mislav (for this and all you do for JS and Rails)! That PR does the trick on my machine. |
Happy to see this, wanted to experiment with connecting directly with the Ruby c libraries with Go purego and finally build sensible access to ruby that doesn't involve embedding a binary. |
I'm not sure whether there is a good reason for this, but ruby-build does not build a ruby shared library.
This caused an issue for me when trying to build the zookeeper gem (ruby
1.9.2-p290
), which fails to compile.I solved the issue by recompiling ruby with
RVM appears to do this by default - can ruby-build do the same?
Thanks!
The text was updated successfully, but these errors were encountered: