warbler icon indicating copy to clipboard operation
warbler copied to clipboard

Warbler 1.4.1 fails to compile on Windows

Open sanelson2000 opened this issue 11 years ago • 6 comments

Warbler 1.4.1 fails to compile on Windows. 1.4.0 and earlier worked fine. here is the output:

>bundle exec warble --trace
** Invoke default (first_time)
** Invoke war (first_time)
** Execute war
** Invoke war:compiled (first_time)
** Execute war:compiled
warble aborted!
Compile failed
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/warbler-1.4.1/lib/warbler/jar.rb:54:in `run_javac'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/warbler-1.4.1/lib/warbler/jar.rb:42:in `compile'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/warbler-1.4.1/lib/warbler/task.rb:109:in `define_compiled_task'
org/jruby/RubyProc.java:271:in `call'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/task.rb:236:in `execute'
org/jruby/RubyArray.java:1613:in `each'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/task.rb:231:in `execute'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/task.rb:175:in `invoke_with_call_chain'
C:/jruby/jruby-1.7.10/lib/ruby/1.9/monitor.rb:211:in `mon_synchronize'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/task.rb:168:in `invoke_with_call_chain'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/task.rb:161:in `invoke'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/warbler-1.4.1/lib/warbler/task.rb:88:in `define_main_task'
org/jruby/RubyArray.java:1613:in `each'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/warbler-1.4.1/lib/warbler/task.rb:82:in `define_main_task'
org/jruby/RubyProc.java:271:in `call'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/task.rb:236:in `execute'
org/jruby/RubyArray.java:1613:in `each'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/task.rb:231:in `execute'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/task.rb:175:in `invoke_with_call_chain'
C:/jruby/jruby-1.7.10/lib/ruby/1.9/monitor.rb:211:in `mon_synchronize'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/task.rb:168:in `invoke_with_call_chain'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/task.rb:197:in `invoke_prerequisites'
org/jruby/RubyArray.java:1613:in `each'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/task.rb:195:in `invoke_prerequisites'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/task.rb:174:in `invoke_with_call_chain'
C:/jruby/jruby-1.7.10/lib/ruby/1.9/monitor.rb:211:in `mon_synchronize'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/task.rb:168:in `invoke_with_call_chain'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/task.rb:161:in `invoke'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/application.rb:149:in `invoke_task'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/application.rb:106:in `top_level'
org/jruby/RubyArray.java:1613:in `each'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/application.rb:106:in `top_level'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/application.rb:115:in `run_with_threads'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/application.rb:100:in `top_level'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/application.rb:78:in `run'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/application.rb:165:in `standard_exception_handling'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/application.rb:75:in `run'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/warbler-1.4.1/lib/warbler/application.rb:77:in `run'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/warbler-1.4.1/bin/warble:11:in `(root)'
org/jruby/RubyKernel.java:1099:in `load'
C:\jruby\jruby-1.7.10\lib\ruby\gems\shared\bin\warble:23:in `(root)'
Tasks: TOP => war:compiled

Interestingly enough, it fails differently on my development machine which has GnuWin32 installed. It looks like warbler is trying to call the env command, which doesn't exist on Windows (and must have slightly different output with GnuWin32)

>bundle exec warble --trace
** Invoke default (first_time)
** Invoke war (first_time)
** Execute war
** Invoke war:compiled (first_time)
** Execute war:compiled
C:\Program Files (x86)\GnuWin32\bin\env.exe: java: No such file or directory
warble aborted!
Compile failed
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/warbler-1.4.1/lib/warbler/jar.rb:54:in `run_javac'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/warbler-1.4.1/lib/warbler/jar.rb:42:in `compile'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/warbler-1.4.1/lib/warbler/task.rb:109:in `define_compiled_task'
org/jruby/RubyProc.java:271:in `call'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/task.rb:236:in `execute'
org/jruby/RubyArray.java:1613:in `each'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/task.rb:231:in `execute'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/task.rb:175:in `invoke_with_call_chain'
C:/jruby/jruby-1.7.10/lib/ruby/1.9/monitor.rb:211:in `mon_synchronize'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/task.rb:168:in `invoke_with_call_chain'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/task.rb:161:in `invoke'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/warbler-1.4.1/lib/warbler/task.rb:88:in `define_main_task'
org/jruby/RubyArray.java:1613:in `each'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/warbler-1.4.1/lib/warbler/task.rb:82:in `define_main_task'
org/jruby/RubyProc.java:271:in `call'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/task.rb:236:in `execute'
org/jruby/RubyArray.java:1613:in `each'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/task.rb:231:in `execute'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/task.rb:175:in `invoke_with_call_chain'
C:/jruby/jruby-1.7.10/lib/ruby/1.9/monitor.rb:211:in `mon_synchronize'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/task.rb:168:in `invoke_with_call_chain'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/task.rb:197:in `invoke_prerequisites'
org/jruby/RubyArray.java:1613:in `each'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/task.rb:195:in `invoke_prerequisites'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/task.rb:174:in `invoke_with_call_chain'
C:/jruby/jruby-1.7.10/lib/ruby/1.9/monitor.rb:211:in `mon_synchronize'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/task.rb:168:in `invoke_with_call_chain'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/task.rb:161:in `invoke'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/application.rb:149:in `invoke_task'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/application.rb:106:in `top_level'
org/jruby/RubyArray.java:1613:in `each'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/application.rb:106:in `top_level'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/application.rb:115:in `run_with_threads'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/application.rb:100:in `top_level'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/application.rb:78:in `run'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/application.rb:165:in `standard_exception_handling'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/application.rb:75:in `run'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/warbler-1.4.1/lib/warbler/application.rb:77:in `run'
C:/jruby/jruby-1.7.10/lib/ruby/gems/shared/gems/warbler-1.4.1/bin/warble:11:in `(root)'
org/jruby/RubyKernel.java:1099:in `load'
C:\jruby\jruby-1.7.10\lib\ruby\gems\shared\bin\warble:23:in `(root)'
Tasks: TOP => war:compiled


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

sanelson2000 avatar Mar 06 '14 16:03 sanelson2000

Here is my warble.rb file (minus all the comments):

Warbler::Config.new do |config|
  config.features = %w(compiled)
  config.dirs = %w(app config lib log vendor tmp db_scripts)
  config.includes = FileList[
      'var/**',
      'public/assets/manifest-*.json'
  ]
  config.excludes = FileList[
    'sso.enabled',
    'consensus.db',
    'config/config.yml',
    'config/database.yml',
    'app/assets/**/*',
    'lib/assets/**/*',
    'vendor/assets/**/*',
    'vendor/src/**/*',
    'tmp/**/*'
  ]
  config.java_classes = FileList['log4j.xml', 'template.servermanager.log4j.xml']
  config.bundle_without = %w(development test assets build)
  config.jar_name = 'consensus'
  config.webxml.jruby.compat.version = '1.9'
end

sanelson2000 avatar Mar 06 '14 17:03 sanelson2000

This commit appears to be the culprit. https://github.com/jruby/warbler/commit/3c52f33948bb150b8b166639b200e78791fcbc97 Reverting it (removing "env -i") makes everything work again.

sanelson2000 avatar Mar 06 '14 17:03 sanelson2000

Oy! yea that needs to be fixed. Thanks for sniffing it out. I'll get something in soon and include it in the 1.4.2 release, which will also hopefully happen soon.

jkutner avatar Mar 06 '14 18:03 jkutner

Thanks, but this still fails on Windows if GnuWin32 CoreUtils (http://gnuwin32.sourceforge.net/packages/coreutils.htm) is installed, which does provide an env executable...

C:\Program Files (x86)\GnuWin32\bin\env.exe: java: No such file or directory
warble aborted!
Compile failed

It should not be trying to call env at all on Windows, whether it can find it or not.

sanelson2000 avatar Mar 10 '14 12:03 sanelson2000

The problem is that env -i is wiping out all of the environment variables, as it's supposed to... including the PATH variable. So the system has no idea where to find java, since it's no longer on the path. So, in order for this to work, you would need to provide the full path to the java executable in this command.

sanelson2000 avatar Mar 10 '14 13:03 sanelson2000

@sanelson2000 -- Thanks for the tip on when the env command is present on Windows. This is still present in Warbler 1.4.5. I ran into the same issue because Git for windows has its own env command which presumably does the same thing as the GnuWin32 variant. My sloppy workaround was simply to rename the env.exe binary temporarily while trying to compile my jar.

johnjameswhitman avatar Apr 09 '15 04:04 johnjameswhitman