JRuby/Windows and (native) extensions how do I distinguish them?

巧了我就是萌 提交于 2019-12-10 10:16:53

问题


I've tried to use EventMachine etc., with JRuby. I get errors about native extensions. I believe this is due to Java limitations. I think the fact that I am on Windows further complicates the issue. Some clarification would be appreciated. What extensions can/can't be used with JRuby? How can I tell? Thanks.


回答1:


there is no really easy way to use native extensions in jruby. native extensions are calling c code that cant be called in jruby without implementing it in java. aside from that a few extensions are seeing jruby ports, for example EventMachine that you mentioned.

and as far as i know the only way to see if you can use a gem/extension with jruby is to read the docs, try it or read the source




回答2:


JRuby does not support native extensions, unfortunately, because they depend on specific memory and runtime details specific to the C implementation.
Usually you can find an equivalent library on the JVM that will work well as a replacement...

To complete LDomagala's answer, you can also refer to this thread related to the same "native extension" issue

Some installation script may rely on RUBY_PLATFORM to determine whether to build the native extensions depending on your OS. If you are on windows it will not build them.

The other way to avoid native compilation is using the ENV var 'NORUBYEXT'.

But that still may involve some tweaking in the ruby installation script...



来源:https://stackoverflow.com/questions/526205/jruby-windows-and-native-extensions-how-do-i-distinguish-them

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!