LoginSignup
6
5

More than 1 year has passed since last update.

Mailcatcherインストール時のエラー

Posted at

環境

Mac OS Monterey 12.3
Ruby on Rails 7.0.2.2

Mailcatcherがインストールできない

Mailcatcherはsmtpサーバを立てて、Mailerで送信するメールをブラウザ上で確認することができるgemです。

Mailcatcherはbundleコマンドでインストールすると正常に動作しないとのことで、

$ gem install mailcatcher

を実行しました。

しかし、エラー。。。

Building native extensions. This could take a while...
ERROR:  Error installing mailcatcher:
        ERROR: Failed to build gem native extension.

    current directory: /Users/xxxx/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/thin-1.5.1/ext/thin_parser
/Users/xxxx/.rbenv/versions/3.1.0/bin/ruby -I /Users/xxxx/.rbenv/versions/3.1.0/lib/ruby/site_ruby/3.1.0 -r ./siteconf20220316-25856-2wb19k.rb extconf.rb
checking for main() in -lc... yes
creating Makefile

current directory: /Users/xxxx/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/thin-1.5.1/ext/thin_parser
make DESTDIR\= clean

current directory: /Users/xxxx/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/thin-1.5.1/ext/thin_parser
make DESTDIR\=
compiling parser.c
parser.rl:112:17: warning: comparison of integers of different signs: 'long' and 'unsigned long' [-Wsign-compare]
  assert(pe - p == len - off && "pointers aren't same distance");
         ~~~~~~ ^  ~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/assert.h:99:25: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __ASSERT_FILE_NAME, __LINE__, #e) : (void)0)
                        ^
parser.rl:142:7: error: implicit declaration of function 'thin_http_parser_has_error' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  if (thin_http_parser_has_error(parser) ) {
      ^
parser.rl:142:7: note: did you mean 'http_parser_has_error'?
./parser.h:44:5: note: 'http_parser_has_error' declared here
int http_parser_has_error(http_parser *parser);
    ^
parser.rl:144:14: error: implicit declaration of function 'thin_http_parser_is_finished' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  } else if (thin_http_parser_is_finished(parser) ) {
             ^
1 warning and 2 errors generated.
make: *** [parser.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/xxxx/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/thin-1.5.1 for inspection.
Results logged to /Users/xxxx/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/extensions/x86_64-darwin-21/3.1.0/thin-1.5.1/gem_make.out

thin_parserのエラー? よくわかりません

Thinのインストールで解決

GitHubにIssueが上がっていました。

https://github.com/sj26/mailcatcher/issues/430

アプリケーションサーバのThinをインストールしたら解決!

$ gem install thin -v '1.5.1' -- --with-cflags="-Wno-error=implicit-function-declaration"
$ gem install mailcatcher

Thinはアプリケーションサーバーで、RailsではデフォルトでPumaが使われています。

6
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
5