While trying to package JRuby as a more ruby like package, I discovered that OSX does not support shebangs at the kernel level.
Running jruby (which is a bash script that starts java) works fine on any unix.
Trying to run gem which has jruby in it's shebang:
➭ /nix/store/5cxwjdd1izi7gk0i3csl1ifb2y6m69p1-jruby-9.0.4.0/bin/gem
zsh: exec format error: /nix/store/5cxwjdd1izi7gk0i3csl1ifb2y6m69p1-jruby-9.0.4.0/bin/gem
And apparantly bash has a fallback mode where it interprets the script as a bash script:
building path(s) ‘/nix/store/d64p6aq2hm1f8xz5smd4d7blzvygi2jc-tzinfo-1.2.2.gem’
unpacking sources
/nix/store/5cxwjdd1izi7gk0i3csl1ifb2y6m69p1-jruby-9.0.4.0/bin/gem: line 4: syntax error near unexpected token `('
/nix/store/5cxwjdd1izi7gk0i3csl1ifb2y6m69p1-jruby-9.0.4.0/bin/gem: line 4: `load File.join(File.dirname(__FILE__), 'jgem')'
builder for ‘/nix/store/nw9fwklp9jvp4bilvkhwcn45zgg51v1s-tzinfo-1.2.2.gem.drv’ failed with exit code 2
cannot build derivation ‘/nix/store/x99njf4xb10y21wbchj99667vfvwlyjh-fluentd-0.12.6.drv’: 1 dependencies couldn't be built
error: build of ‘/nix/store/x99njf4xb10y21wbchj99667vfvwlyjh-fluentd-0.12.6.drv’ failed
More details:
Suggested fix
If jruby were a binary, it would probably work fine. Maybe wrapProgram can generate and compile a tiny C program that runs the wrapped script.
While trying to package JRuby as a more ruby like package, I discovered that OSX does not support shebangs at the kernel level.
Running
jruby(which is a bash script that starts java) works fine on any unix.Trying to run
gemwhich hasjrubyin it's shebang:And apparantly bash has a fallback mode where it interprets the script as a bash script:
More details:
Suggested fix
If jruby were a binary, it would probably work fine. Maybe
wrapProgramcan generate and compile a tiny C program that runs the wrapped script.