cotag / http-parser

A super fast http parser for ruby
MIT License
18 stars 17 forks source link

Cannot build http-parser native extension on Heroku #16

Open arbales opened 2 years ago

arbales commented 2 years ago

I've been unable to build the http-parser gem on Heroku with Ruby 3.0+. Have tried bumping my Ruby version to no avail.

remote:        Installing http-parser 1.2.3 with native extensions
remote:        Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
remote:
remote:        current directory:
remote:        /tmp/build_54efc73d/vendor/bundle/ruby/3.1.0/gems/http-parser-1.2.3/ext
remote:        /tmp/build_54efc73d/vendor/ruby-3.1.0/bin/ruby
remote:        -I/tmp/build_54efc73d/vendor/ruby-3.1.0/lib/ruby/3.1.0 -rrubygems
remote:        /tmp/build_54efc73d/vendor/bundle/ruby/3.1.0/gems/rake-12.3.3/exe/rake
remote:        RUBYARCHDIR\=/tmp/build_54efc73d/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0/http-parser-1.2.3
remote:        RUBYLIBDIR\=/tmp/build_54efc73d/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0/http-parser-1.2.3
remote:        rake aborted!
remote:        ArgumentError: wrong number of arguments (given 2, expected 1)
remote:        /tmp/build_54efc73d/vendor/bundle/ruby/3.1.0/gems/rake-12.3.3/exe/rake:27:in
remote:        `<main>'
remote:        Tasks: TOP => default => x86_64-linux/libhttp-parser-ext.so =>
remote:        x86_64-linux/http-parser/http_parser.o => x86_64-linux/http-parser
remote:        (See full trace by running task with --trace)
remote:
remote:        rake failed, exit code 1
remote:
remote:        Gem files will remain installed in
remote:        /tmp/build_54efc73d/vendor/bundle/ruby/3.1.0/gems/http-parser-1.2.3 for
remote:        inspection.
remote:        Results logged to
remote:        /tmp/build_54efc73d/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0/http-parser-1.2.3/gem_make.out
…
remote:
remote:        An error occurred while installing http-parser (1.2.3), and Bundler cannot
remote:        continue.
remote:
remote:        In Gemfile:
remote:          http was resolved to 4.4.1, which depends on
remote:            http-parser
robert-damoc commented 2 years ago

Have you managed to find a fix for this? I have kind of the same issue, where on local it works, but it fails on the CI, with the same message.

It worked on ruby 2.7.5. Now I am trying to go to 3.0.3, and it's failing.

arbales commented 2 years ago

Yes! Bump your http gem version or build it from source, it removes this dependency.

erwinwolff commented 2 years ago

I have this same problem. What was your fix?

arbales commented 2 years ago

See above, just use the gem from GitHub.

erwinwolff commented 2 years ago

Still doesnt really work

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /****/vendor/ruby/3.0.0/bundler/gems/http-parser-4a0db044c746/ext
/usr/bin/ruby -I/usr/lib/ruby/site_ruby/3.0.0 -rrubygems /****/vendor/ruby/3.0.0/gems/rake-13.0.6/exe/rake RUBYARCHDIR\=/******/vendor/ruby/3.0.0/bundler/gems/extensions/x86_64-linux/3.0.0-static/http-parser-4a0db044c746
RUBYLIBDIR\=/*****/vendor/ruby/3.0.0/bundler/gems/extensions/x86_64-linux/3.0.0-static/http-parser-4a0db044c746
gcc -shared -o x86_64-linux/libhttp-parser-ext.so  -fexceptions
gcc: fatal error: no input files
compilation terminated.
rake aborted!
Command failed with status (1): [gcc -shared -o x86_64-linux/libhttp-parser...]
/*****/vendor/ruby/3.0.0/gems/ffi-compiler-1.0.1/lib/ffi-compiler/compile_task.rb:153:in `block in define_task!'
/*****/vendor/ruby/3.0.0/gems/rake-13.0.6/exe/rake:27:in `<main>'
Tasks: TOP => default => x86_64-linux/libhttp-parser-ext.so
(See full trace by running task with --trace)

rake failed, exit code 1

Gem files will remain installed in /****/vendor/ruby/3.0.0/bundler/gems/http-parser-4a0db044c746 for inspection.
Results logged to /****/vendor/ruby/3.0.0/bundler/gems/extensions/x86_64-linux/3.0.0-static/http-parser-4a0db044c746/gem_make.out

An error occurred while installing http-parser (1.2.3), and Bundler cannot continue.
erwinwolff commented 2 years ago
rake --version
rake, version 13.0.6
arbales commented 2 years ago

Ah sorry, you know -- I updated the http gem not this parser gem. The http gem removes this dep in their update. I wasn't able to build http-parser.