jruby / warbler

Warbler chirpily constructs .war files of your Ruby applications.
Other
883 stars 203 forks source link

WAR files give error "Could not find http-parser-1.2.1 in any of the sources" #482

Open sandbergja opened 4 years ago

sandbergja commented 4 years ago

Warbler appears to not be playing nicely with the http-parser gem. I followed the following steps on jruby 9.2.11.1 to create a WAR file of a basic rails app with http-parser in the Gemfile:

rails new problem
cd problem
echo "gem 'warbler', github: 'jruby/warbler'" >> Gemfile
echo "gem 'http-parser'" >> Gemfile
bundle update
warble

I also tried warble compiled war. Both times, when I put the WAR file into tomcat, I got the following error in my browser:

Could not find http-parser-1.2.1 in any of the sources

I can run rails s no problem, and get no problems when I use http-parser in my app locally. It's only when I try to run the WAR file that I get problems.

I am using bundler 2.1.4. I tried this on both Windows and Linux.

headius commented 4 years ago

So it's only this library you seem to have trouble with?

I know that http-parser has a native component that has to be build and shipped... so that would definitely complicate putting it into a war file. Native libraries can't be loaded from within a war/jar so it would have to be installed on the filesystem somewhere.

sandbergja commented 4 years ago

http-parser is the only one that gave me that trouble. I tried a few other gems that also need some C code, like sassc, unf, and rb-fsevent. I do not get the same error in my browser when I include those in my Gemfile.

For what it's worth, it does look like the native C code made it into the WAR. Here is what I get from running ls -R in WEB-INF/gems/gems/http-parser-1.2.1/ext/:

http-parser  Rakefile  x86_64-linux

WEB-INF/gems/gems/http-parser-1.2.1/ext/http-parser:
http_parser.c  http_parser.h

WEB-INF/gems/gems/http-parser-1.2.1/ext/x86_64-linux:
http-parser  libhttp-parser-ext.so

WEB-INF/gems/gems/http-parser-1.2.1/ext/x86_64-linux/http-parser:
http_parser.o
headius commented 4 years ago

This has also been reported in a different form in #472, where the sassc library needs to be able to build and load a native library that it binds with FFI.

jlahtinen commented 4 years ago

I have similar problem with sassc. I debugged it to the point that sassc spec is skipped because it is missing extensions. gem.build_complete file is not included in application.war.

I am using warbler 2.0.5, jruby 9.2.11.0 with rvm. Bundler version 1.17.3

sassc gems installed into rvm gems has gem.build_complete files and everthing works when running rails with puma. Making application.war does not work inside tomcat and error is Bundler::GemNotFound: Could not find sassc-2.0.1 in any of the sources

this problem does not exist with bundler 2.1.4