我在macOS Catalina 10.15.7
上,为我的项目使用rbenv(版本rbenv 1.1.2-36-g60c9339
)和ruby verion 2.6.3
(ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin19]
是ruby -v
的输出)。我需要安装mailcatcher来检查我的应用程序生成的电子邮件。在我的项目文件夹中运行gem install mailcatcher
时,命令失败,并出现以下错误:
➜ 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/karansapolia/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/thin-1.5.1/ext/thin_parser
/Users/karansapolia/.rbenv/versions/2.6.3/bin/ruby -I /Users/karansapolia/.rbenv/versions/2.6.3/lib/ruby/2.6.0 -r ./siteconf20201103-23665-1tzqkaj.rb extconf.rb
checking for main() in -lc... yes
creating Makefile
current directory: /Users/karansapolia/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/thin-1.5.1/ext/thin_parser
make "DESTDIR=" clean
current directory: /Users/karansapolia/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.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");
~~~~~~ ^ ~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/assert.h:93:25: note: expanded from macro 'assert'
(__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __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/karansapolia/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/thin-1.5.1 for inspection.
Results logged to /Users/karansapolia/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-19/2.6.0/thin-1.5.1/gem_make.out
安装其他宝石是完美的工作。gem install mailman
工作完美。只有失败的mailcatcher
。
如何安装mailcatcher而不出现错误?
3条答案
按热度按时间yv5phkfx1#
我运行了follow命令,它对我起作用了
gem安装邮件捕捉器-- --with-cflags ="-Wno-error=隐式函数声明”
5f0d552i2#
看起来在安装thin解析器时有一个问题,我在github上发现了一个已经打开的问题,这位贡献者在这里提出了一个解决方案。
请确保在安装mailcatcher之前安装Thinking。
v1uwarro3#
在Mac OS Big Sur 11.7上,我还必须添加
-fdeclspec
标志:gem install mailcatcher -- --with-cflags="-fdeclspec -Wno-error=implicit-function-declaration"
个(在阅读故障输出文件
mkmf.log
后尝试-fdeclspec
标志)