ruby-on-rails - 我在安装 thrift (0.9.3.0) 时遇到错误,因为 bundle 安装也失败了

标签 ruby-on-rails ruby rubygems bundler

ruby '2.5.0' gem 'rails', '~> 5.1.2' bundle 版本 1.17.3 MAC OS 版本 MAC OS Big Sur 11.6

已经尝试过的解决方案 1)gem install thrift --with-cppflags="-D_FORTIFY_SOURCE=0 -Wno-shift-negative-value" 2)gem install thrift -v '0.9.3.0' -- --with-cppflags='-D_FORTIFY_SOURCE=0'

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/ijain/.rvm/gems/ruby-2.5.0/gems/thrift-0.9.3.0/ext
/Users/ijain/.rvm/rubies/ruby-2.5.0/bin/ruby -I /Users/ijain/.rvm/rubies/ruby-2.5.0/lib/ruby/site_ruby/2.5.0 -r
./siteconf20211001-29299-1tv02zv.rb extconf.rb --with-cflags\=-Wno-implicit-function-declaration
checking for strlcpy() in string.h... yes
creating Makefile

current directory: /Users/ijain/.rvm/gems/ruby-2.5.0/gems/thrift-0.9.3.0/ext
make DESTDIR\= clean

current directory: /Users/ijain/.rvm/gems/ruby-2.5.0/gems/thrift-0.9.3.0/ext
make DESTDIR\=
compiling binary_protocol_accelerated.c
binary_protocol_accelerated.c:404:68: error: '(' and '{' tokens introducing statement expression appear in different macro
expansion contexts [-Werror,-Wcompound-token-split-by-macro]
  VALUE thrift_binary_protocol_class = rb_const_get(thrift_module, rb_intern("BinaryProtocol"));
                                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/ijain/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0/ruby/ruby.h:1755:23: note: expanded from macro 'rb_intern'
        __extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \
                      ^
binary_protocol_accelerated.c:404:68: note: '{' token is here
  VALUE thrift_binary_protocol_class = rb_const_get(thrift_module, rb_intern("BinaryProtocol"));
                                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/ijain/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0/ruby/ruby.h:1755:24: note: expanded from macro 'rb_intern'
        __extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/ijain/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0/ruby/ruby.h:1740:5: note: expanded from macro 'RUBY_CONST_ID_CACHE'
    {                                                   \
    ^
binary_protocol_accelerated.c:404:68: error: '}' and ')' tokens terminating statement expression appear in different macro
expansion contexts [-Werror,-Wcompound-token-split-by-macro]
  VALUE thrift_binary_protocol_class = rb_const_get(thrift_module, rb_intern("BinaryProtocol"));
                                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/ijain/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0/ruby/ruby.h:1755:24: note: expanded from macro 'rb_intern'
        __extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/ijain/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0/ruby/ruby.h:1745:5: note: expanded from macro 'RUBY_CONST_ID_CACHE'
    }
    ^
binary_protocol_accelerated.c:404:68: note: ')' token is here
  VALUE thrift_binary_protocol_class = rb_const_get(thrift_module, rb_intern("BinaryProtocol"));
                                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/ijain/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0/ruby/ruby.h:1755:56: note: expanded from macro 'rb_intern'
        __extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \ ```

最佳答案

尝试 gem install thrift -- --with-cppflags="-Wno-compound-token-split-by-macro"

https://github.com/ruby/ruby/pull/4504#issuecomment-929696628

关于ruby-on-rails - 我在安装 thrift (0.9.3.0) 时遇到错误,因为 bundle 安装也失败了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69400711/

相关文章:

mysql - 无法创建rails测试数据库

ruby-on-rails - 从一个普通的旧 ruby​​ 类中使​​用 Rails 路径助手? (请求作业)

arrays - 为什么 Ruby 的 each_with_object 会将附加有 += 运算符的数据删除到数组备忘录中?

ruby-on-rails - 有没有 "Ruby on Rails gem"这样的东西?

ruby-on-rails - 在 Rails after_save 回调中,提交是否已完成并且 Sidekiq 作业是否可以访问更改

方法的 ruby​​ 关键字参数

ruby-on-rails - Rails 测试找不到 test_helper

ruby-on-rails - NoMethodError : undefined method `[]' for false:FalseClass

ruby - 构建乘客 apache2 模块 : no such file to load -- rubygems builder

ruby-on-rails - Heroku上的Searchkick无法正常工作