MacOS Ventura下Ruby2.7.6安装nokogumbo与thrift gem报错求助
解决MacOS Ventura + Ruby 2.7.6下bundle install的nokogumbo和thrift安装错误
一、修复nokogumbo 2.0.5链接错误
报错显示x86_64架构下找不到Nokogiri相关符号,核心原因是nokogumbo编译时未正确关联Nokogiri依赖库,可尝试以下方案:
方案1:强制指定nokogumbo编译链接参数
执行bundle install前,设置bundle的编译配置,让nokogumbo明确指向已安装的Nokogiri路径:
bundle config build.nokogumbo --with-ldflags="-L$(bundle show nokogiri)/lib" --with-cflags="-I$(bundle show nokogiri)/include"
随后运行:
bundle install
方案2:调整nokogumbo版本适配nokogiri
nokogumbo 2.0.5与nokogiri 1.13.9存在兼容性问题,可在Gemfile中指定兼容版本:
gem 'nokogumbo', '2.0.6'
执行更新后再安装:
bundle update nokogumbo bundle install
方案3:重新编译nokogiri使用系统库
若当前nokogiri是预编译版本,可能导致链接异常,重新编译nokogiri并使用系统库:
bundle config build.nokogiri --use-system-libraries bundle update nokogiri bundle install
二、修复thrift 0.17.0的bundle安装失败
单独安装thrift成功但bundle失败,是因为bundle不会自动继承gem install时的编译参数,需单独配置:
bundle config build.thrift --with-cppflags="-Wno-compound-token-split-by-macro"
之后执行:
bundle install
若上述配置无效,可手动安装thrift到bundle本地缓存后跳过安装:
gem install thrift -v 0.17.0 -- --with-cppflags="-Wno-compound-token-split-by-macro" bundle install --local
内容的提问来源于stack exchange,提问作者tannossaurus
相关产品推荐
相关产品推荐

