23

i tried to install the thin web server, version 1.7.2 but got an error

with the logs:

thin.c:359:10: error: implicit declaration of function 'thin_http_parser_has_error' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
  return thin_http_parser_has_error(http) ? Qtrue : Qfalse;
         ^
thin.c:374:10: error: implicit declaration of function 'thin_http_parser_is_finished' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
  return thin_http_parser_is_finished(http) ? Qtrue : Qfalse;
         ^
9 errors generated.
make: *** [thin.o] Error 1

make failed, exit code 2

Gem files will remain installed in
/Users/dorianmarie/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/thin-1.7.2 for inspection.
Results logged to
/Users/dorianmarie/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/extensions/x86_64-darwin-19/2.7.0/thin-1.7.2/gem_make.out

An error occurred while installing thin (1.7.2), and Bundler cannot continue.
Make sure that `gem install thin -v '1.7.2' --source 'https://rubygems.org/'` succeeds before bundling.
Dorian
  • 7,749
  • 4
  • 38
  • 57

3 Answers3

50

disabling the error fixed it:

bundle config build.thin --with-cflags="-Wno-error=implicit-function-declaration"
Dorian
  • 7,749
  • 4
  • 38
  • 57
  • 1
    I hit this same error as well and your config line worked, so thanks! However I am wondering if disabling the error is the best solution, as the error could be occurring because of a legitimate issue. Any thoughts? – Fralcon Sep 21 '20 at 23:51
  • 3
    this is a temporary fix. see https://stackoverflow.com/questions/63278694/thin-and-puma-fail-with-similar-issues-error-failed-to-build-gem-native-exten for the explanation. it looks like the issue has been fixed in the master branch of thin, see https://github.com/macournoyer/thin/issues/370 – subelsky Oct 06 '20 at 20:50
8

The solution that worked for me was slightly different. I had to run the following for my specific gem version, using rbenv on Big Sur 11.3.1. I added a more in depth explanation of my particular error and solution here.

gem install thin -v '1.6.4' -- --with-cflags="-Wno-error=implicit-function-declaration"
boyd
  • 331
  • 3
  • 8
2
arch -arm64 gem install thin -v '1.7.2' -- --with-cflags="-Wno-error=implicit-function-declaration"

worked for me on M1 mac Monterey

Jamshad Ahmad
  • 410
  • 1
  • 6
  • 16