0

We're converting a Rails project from 2.3 to 5.

One of the many changes is startup message:

Please add the following to your Gemfile to avoid polling for changes:
    gem 'wdm', '>= 0.1.0' if Gem.win_platform?

When trying to install the gem in my JRuby 9.2.8.0 instllation, I'm getting:

checking for main() in -lkernel32... RuntimeError: The compiler failed to
generate an executable file.
You have to install development tools first.
...
To see why this extension failed to compile, please check the mkmf.log which can
be found here:

M:/workspace/installations/jruby-9.2.8.0/lib/ruby/gems/shared/extensions/universal-java-1.8/2.5.0/wdm-0.1.1/mkmf.log

This file contains:

" -o conftest.exe -I/include/universal-java1.8 -IM:/workspace/installations/jruby-9.2.8.0/lib/ruby/include/ruby/backward -IM:/workspace/installations/jruby-9.2.8.0/lib/ruby/include -I.     -fno-omit-frame-pointer -fno-strict-aliasing  -fexceptions  conftest.c  -L. -LM:/workspace/installations/jruby-9.2.8.0/lib  -LM:/workspace/installations/jruby-9.2.8.0/lib/native/x86_64-Windows   -m64 -march=native -mtune=native      "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <ruby.h>
4: int main(int argc, char **argv)
5: {
6:   return 0;
7: }
/* end */

Note: I can install the gem fine on ruby 2.6.4p104 (2019-08-28 revision 67798) [x64-mingw32], but not in my JRuby installation

Any idea on how to get this gem to install?

Or if not, is there an alternative to wdm I can use? I notice my assets aren't reloading correctly in development now.

Alexander Malfait
  • 2,691
  • 1
  • 23
  • 23
  • Maybe https://github.com/Maher4Ever/wdm/issues/8 can help. Likely not, since the gem hasn't been updated in about four years. Perhaps [this](https://stackoverflow.com/a/32592278/3784008) or [this](https://github.com/HHS/voc-admin/wiki/JRuby-Windows-Install-Guide) can help. – anothermh Oct 18 '19 at 21:43
  • Thanks @anothermh, I found those pages too but they were no help. The first one is no longer relevant as JRuby does support C extensions nowadays. The second one I did execute, to no avail. The third one doesn't mention DevKit. – Alexander Malfait Oct 18 '19 at 22:24

1 Answers1

-2

The first one is no longer relevant as JRuby does support C extensions nowadays.

that is simply (no-longer) true: C-extensions were experimentally supported around JRuby 1.6, in 1.7 the removal process (they never really worked that well) started and 9.X does not support them. these days, most native gems instead have a Java specific ext backend on JRuby.

the linked issue tried to establish that a Java specific version when using JRuby, unfortunately it wasn't finished/merged but you could try the patch piece.

you will need to setup a fork repo with the patch with the C-ext compilation disabled. or you could disable the gem on JRuby (and handle the 'specific' backend code in your app) :

gem 'wdm', '>= 0.1.0', platform: [:mri, :mswin]
kares
  • 7,076
  • 1
  • 28
  • 38