安装 thin (1.7.2) 时发生了错误。

23

我尝试安装版本为1.7.2的Thin Web服务器,但遇到了错误。

以下是日志:

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.
3个回答

50
禁用该错误已解决:
bundle config build.thin --with-cflags="-Wno-error=implicit-function-declaration"

1
我也遇到了同样的错误,你的配置行起作用了,谢谢!但是我在想,禁用错误是否是最好的解决方案,因为错误可能是由于合法问题而发生的。有什么想法吗? - Fralcon
3
这是一个临时解决方案。请参考https://dev59.com/eOk5XIcBkEYKwwoY3dX9了解解释。看起来这个问题已经在thin的主分支中得到解决,请参考https://github.com/macournoyer/thin/issues/370。 - subelsky

8

对我有用的解决方案略有不同。我在Big Sur 11.3.1上使用rbenv,针对我的特定宝石版本运行了以下命令。我在这里添加了更详细的错误和解决方法的说明。

gem install thin -v '1.6.4' -- --with-cflags="-Wno-error=implicit-function-declaration"

1
这也适用于 asdf,谢谢! - Crysfel

2
arch -arm64 gem install thin -v '1.7.2' -- --with-cflags="-Wno-error=implicit-function-declaration"

在我的 M1 Mac Monterey 上运行良好


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接