jruby / jruby

JRuby, an implementation of Ruby on the JVM
https://www.jruby.org
Other
3.76k stars 918 forks source link

JRuby-9.2.1.0 on Windows 10 + Cygwin + RVM #6270

Open AndyObtiva opened 4 years ago

AndyObtiva commented 4 years ago

(originally reported at the rvm repo: https://github.com/rvm/rvm/issues/4946)

Environment Information

Provide at least:

jruby 9.2.9.0 (2.5.7)

Windows 10 (Free VM obtained from here: https://developer.microsoft.com/en-us/windows/downloads/virtual-machines/)

Other relevant info you may wish to add:

Cygwin (latest version downloaded from here: https://www.cygwin.com/)

Expected Behavior

I expect it to install properly like it does on the Mac.

Actual Behavior

Here is a dump of what happened on the command line:

$ rvm install jruby-9.2.9.0
Searching for binary rubies, this might take some time.
Found remote file https://repo1.maven.org/maven2/org/jruby/jruby-dist/9.2.9.0/jruby-dist-9.2.9.0-bin.tar.gz
Checking requirements for cygwin.
Need Java
Requirements installation successful.
jruby-9.2.9.0 - #configure
jruby-9.2.9.0 - #download
jruby-9.2.9.0 - #validate archive
jruby-9.2.9.0 - #extract
jruby-9.2.9.0 - #validate binary
CYGWIN_NT-10.0 libraries validation not yet implemented
jruby-9.2.9.0 - #setup
jruby-9.2.9.0 - #gemset created /home/User/.rvm/gems/jruby-9.2.9.0@global
jruby-9.2.9.0 - #importing gemset /home/User/.rvm/gemsets/jruby/global.gems.....
Error running 'gemset_import_list jruby-openssl jruby-launcher gem-wrappers rubygems-bundler rake rvm bundler',
please read /home/User/.rvm/log/1591391509_jruby-9.2.9.0/gemsets.import.global.log
jruby-9.2.9.0 - #generating global wrappers.................
Error running 'run_gem_wrappers regenerate',
please read /home/User/.rvm/log/1591391509_jruby-9.2.9.0/gemset.wrappers.global.log
jruby-9.2.9.0 - #gemset created /home/User/.rvm/gems/jruby-9.2.9.0
jruby-9.2.9.0 - #importing gemsetfile /home/User/.rvm/gemsets/default.gems evaluated to empty gem list
jruby-9.2.9.0 - #generating default wrappers.................
Error running 'run_gem_wrappers regenerate',
please read /home/User/.rvm/log/1591391608_jruby-9.2.9.0/gemset.wrappers.default.log

User@WinDev2005Eval /cygdrive/c/Users/User/code/glimmer-cs-calculator
$ jruby -v
jruby 9.2.9.0 (2.5.7) 2019-10-30 458ad3e Java HotSpot(TM) 64-Bit Server VM 10.0.2+13 on 10.0.2+13 +jit [mswin32-x86_64]

User@WinDev2005Eval /cygdrive/c/Users/User/code/glimmer-cs-calculator
$

User@WinDev2005Eval /cygdrive/c/Users/User/code/glimmer-cs-calculator
$ rvm list
=* jruby-9.2.9.0 [ x86_64 ]
   ruby-2.7.1 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

Here is the log file mentioned (/home/User/.rvm/log/1591391509_jruby-9.2.9.0/gemsets.import.global.log):

$ cat /home/User/.rvm/log/1591391509_jruby-9.2.9.0/gemsets.import.global.log
[2020-06-05 14:11:50] gemset_import_list
gemset_import_list ()
{
    case "${rvm_ruby_string}" in
        *jruby*)
            \command \gem install "$@"
        ;;
        *)
            \typeset line;
            for line in "$@";
            do
                gem_install $line || rvm_error "there was an error installing gem $line";
            done
        ;;
    esac
}
current path: /cygdrive/c/Users/User/code/glimmer-cs-calculator
GEM_HOME=/home/User/.rvm/gems/jruby-9.2.9.0@global
GEM_PATH=/home/User/.rvm/gems/jruby-9.2.9.0@global
PATH=/home/User/.rvm/gems/jruby-9.2.9.0@global/bin:/home/User/.rvm/rubies/jruby-9.2.9.0/bin:/home/User/.rvm/bin:/usr/local/bin:/usr/bin:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Windows/System32/OpenSSH:/cygdrive/c/Program Files/dotnet:/cygdrive/c/Program Files/Microsoft SQL Server/130/Tools/Binn:/cygdrive/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/170/Tools/Binn:/cygdrive/c/Program Files/Git/cmd:/cygdrive/c/jruby-9.2.11.1/bin:/cygdrive/c/Java/jdk-10.0.2/bin:/cygdrive/c/Users/User/AppData/Local/Microsoft/WindowsApps:/cygdrive/c/Users/User/AppData/Local/Programs/Microsoft VS Code/bin:/cygdrive/c/Users/User/Downloads
command(8): gemset_import_list jruby-openssl jruby-launcher gem-wrappers rubygems-bundler rake rvm bundler
+ case "${rvm_ruby_string}" in
+ command gem install jruby-openssl jruby-launcher gem-wrappers rubygems-bundler rake rvm bundler
+ gem install jruby-openssl jruby-launcher gem-wrappers rubygems-bundler rake rvm bundler
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jruby.ext.openssl.SecurityHelper (file:/C:/home/User/.rvm/gems/jruby-9.2.9.0@global/gems/jruby-openssl-0.10.4-java/lib/jopenssl.jar) to field java.security.MessageDigest.provider
WARNING: Please consider reporting this to the maintainers of org.jruby.ext.openssl.SecurityHelper
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Successfully installed jruby-openssl-0.10.4-java
Building native extensions. This could take a while...
/usr/bin/sh: /c: No such file or directory
ERROR:  Error installing jruby-launcher:
        ERROR: Failed to build gem native extension.

    current directory: C:/home/User/.rvm/gems/jruby-9.2.9.0@global/gems/jruby-launcher-1.1.13-java
C:/cygwin64/home/User/.rvm/rubies/jruby-9.2.9.0/bin/jruby.exe -r ./siteconf20200605-12932-1cyzrbn.rb extconf.rb

extconf failed, exit code 127

Gem files will remain installed in C:/home/User/.rvm/gems/jruby-9.2.9.0@global/gems/jruby-launcher-1.1.13-java for inspection.
Results logged to C:/home/User/.rvm/gems/jruby-9.2.9.0@global/extensions/universal-java-10/2.5.0/jruby-launcher-1.1.13-java/gem_make.out
Building native extensions. This could take a while...
/usr/bin/sh: /c: No such file or directory
ERROR:  Error installing gem-wrappers:
        ERROR: Failed to build gem native extension.

    current directory: C:/home/User/.rvm/gems/jruby-9.2.9.0@global/gems/gem-wrappers-1.4.0/ext/wrapper_generator
C:/cygwin64/home/User/.rvm/rubies/jruby-9.2.9.0/bin/jruby.exe -r ./siteconf20200605-12932-o3ggmu.rb extconf.rb

extconf failed, exit code 127

Gem files will remain installed in C:/home/User/.rvm/gems/jruby-9.2.9.0@global/gems/gem-wrappers-1.4.0 for inspection.
Results logged to C:/home/User/.rvm/gems/jruby-9.2.9.0@global/extensions/universal-java-10/2.5.0/gem-wrappers-1.4.0/gem_make.out
Building native extensions. This could take a while...
/usr/bin/sh: /c: No such file or directory
ERROR:  Error installing rubygems-bundler:
        ERROR: Failed to build gem native extension.

    current directory: C:/home/User/.rvm/gems/jruby-9.2.9.0@global/gems/executable-hooks-1.6.0/ext/wrapper_installer
C:/cygwin64/home/User/.rvm/rubies/jruby-9.2.9.0/bin/jruby.exe -r ./siteconf20200605-12932-1l199nm.rb extconf.rb

extconf failed, exit code 127

Gem files will remain installed in C:/home/User/.rvm/gems/jruby-9.2.9.0@global/gems/executable-hooks-1.6.0 for inspection.
Results logged to C:/home/User/.rvm/gems/jruby-9.2.9.0@global/extensions/universal-java-10/2.5.0/executable-hooks-1.6.0/gem_make.out
Successfully installed rake-13.0.1
Successfully installed rvm-1.11.3.9
Successfully installed bundler-2.1.4
4 gems installed

I am User by the way.

I am not sure if JRuby is supported on Windows 10 + Cygwin + RVM. I didn't read anywhere that it is not, but maybe I'll learn otherwise here.

Thank you.

p.s. I am able to install JRuby just fine using the Windows Installer without RVM. I was wondering if I could use via RVM on Cygwin though for convenience and the advantages RVM offers.

AndyObtiva commented 4 years ago

I assume you guys are very busy, so I’m gonna take a look at jruby’s code myself when I get a chance to see if I can get this working.

My goal behind it is to provide unified instructions for setting up JRuby and Glimmer on Mac, Linux, and Windows via RVM. Still, there are many other options on Windows, I’m aware of that (e.g. chocolatey and uru). So, I’m not stuck in any way.

Cheers.

mohits commented 3 years ago

@AndyObtiva - I don't use Cygwin but is Cygwin a must in your mind? I have decent instructions for installing JRuby on WIndows on my blog at https://notepad.onghu.com/tags/#JRuby and I recommend using pik for switching between Rubies, including JRuby. Would that help in your case?

(Also, happy to help you try something on Windows if you want)

headius commented 3 years ago

I am wondering if this issue is really relevant anymore. Yes, there are still folks out there using Cygwin but I would expect that most of them have already moved on to WSL for their unix-on-Windows needs. We still support Cygwin and I will take a brief look at this but maybe it is time to start saying goodbye.

headius commented 3 years ago

So it seems the problems here are all related to building native libraries. I can't see exactly why these builds fail from this output.

RVM by default will try to install the jruby-launcher gem, which builds a native jruby executable to avoid the bash script version. Normally this is not needed for the Windows install, since we ship a jruby.exe in the distribution. We also do not support installing the gem on Windows since it is not set up for Windows build environments. In the future the gem will just ship prebuilt binaries for all supported platforms.

The gem-wrappers gem has an extension build but it appears to just be faking out the system to regenerate the wrapper scripts, I think? The fact that it fails tells me that basic build tools may not be set up in your environment, since it generates a dummy Makefile but does not actually build any native code.

And I think the rubygems-bundler failure is caused by the aforementioned wrapper generator being hooked into the install process but failing to work.

I do not know the purpose of the latter two gems, but jruby-launcher is unnecessary for JRuby on Windows or Cygwin because we already ship a native binary there. I think this needs to get kicked back to RVM to remove jruby-launcher and explain the purpose of these other gems (which only appear to install on Cygwin?).