Skip to content

Cannot build http-parser native extension on Heroku #16

Open

Description

@arbales

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

Activity

  1. robert-damoc commented on Feb 21, 2022

    @robert-damoc

    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.

  2. arbales commented on Feb 21, 2022

    @arbales
    Author

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

  3. erwinwolff commented on Mar 22, 2022

    @erwinwolff

    I have this same problem. What was your fix?

  4. arbales commented on Mar 22, 2022

    @arbales
    Author

    See above, just use the gem from GitHub.

  5. erwinwolff commented on Mar 22, 2022

    @erwinwolff

    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.
    
  6. erwinwolff commented on Mar 22, 2022

    @erwinwolff
    rake --version
    rake, version 13.0.6
    
  7. arbales commented on Mar 23, 2022

    @arbales
    Author

    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.

  8. ssinghi commented on May 1, 2025

    @ssinghi

    Bumping up the http version helped. Somehow, we had an older version of rake bound in the Gemfile, updating that helped us update http and get rid of this dependency.

    This repository should be archived.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions