I have just tried to recreate my local development environment for our Rails app, Supportress, and encountered an error installing a gem (
mailcatcher) that depends on native extensions that need to be built:
Building native extensions. This could take a while... ERROR: Error installing mailcatcher: ERROR: Failed to build gem native extension. current directory: /Users/petros/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/thin-1.5.1/ext/thin_parser [...] (__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] [...] 1 warning and 2 errors generated. make: *** [parser.o] Error 1 make failed, exit code 2
This is the problematic part:
parser.rl:142:7: error: implicit declaration of function ‘thin_http_parser_has_error’ is invalid in C99 [-Werror,-Wimplicit-function-declaration]
This seems to be a problem with the latest version of Xcode tools. It has a version of Clang that throws an error on implicit functions used on the native extension code of various gems.
gem install mailcatcher -- --build-flags --with-cflags="-Wno-error=implicit-function-declaration"
Notice that I am not using bundler in this instance as
mailcatcher needs to be installed separately, not as part of your Gemfile.
You can apply this to any of your gems that have the same problem.
What are you up to Petros?
Head of Support at GitBook. Building Supportress, an opinionated helpdesk for calm SaaS companies based on my 9 years working and shaping GitHub Support. Writing 2D retro games. Check what I am doing now.