首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安装gem时找不到libxml2

安装gem时找不到libxml2
EN

Stack Overflow用户
提问于 2017-09-16 13:08:26
回答 1查看 486关注 0票数 3

twilio-ruby的安装问题。我已经使用自制软件安装了libxml2,并确认它在那里。然而,当我尝试运行

gem install twilio-ruby

我收到一个错误,它找不到libxml2。我已经尝试指定libxml2的路径,但仍然无法安装它。有什么建议吗?

我尝试过以下几种方法

代码语言:javascript
复制
 gem install twilio-ruby -- --with-xml2-dir=/usr/local/Cellar/libxml2

gem install twilio-ruby -- --use-system-libraries

然后把这三个放在一起:

代码语言:javascript
复制
gem install twilio-ruby -- --with-xml2-dir=/usr/local/Cellar/libxml2/2.9.1 --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.1/lib --with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include

每次我都会得到类似于下面的输出。

代码语言:javascript
复制
gem install twilio-ruby -- --with-xml2-dir=/usr/local/Cellar/libxml2
Building native extensions with: '--with-xml2-dir=/usr/local/Cellar/libxml2'
This could take a while...
ERROR:  Error installing twilio-ruby:
    ERROR: Failed to build gem native extension.

    /Users/tom/.rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb --with-xml2-dir=/usr/local/Cellar/libxml2
checking for libxml/xmlversion.h in /opt/include/libxml2,/opt/local/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/tom/.rvm/rubies/ruby-2.1.1/bin/ruby
    --with-xml2-config
    --without-xml2-config
    --with-xml2-dir
    --with-xml2-include
    --without-xml2-include=${xml2-dir}/include
    --with-xml2-lib
    --without-xml2-lib=${xml2-dir}/lib
 extconf failure: need libxml2.

    Install the library or try one of the following options to extconf.rb:

      --with-xml2-config=/path/to/xml2-config
      --with-xml2-dir=/path/to/libxml2
      --with-xml2-lib=/path/to/libxml2/lib
      --with-xml2-include=/path/to/libxml2/include


extconf failed, exit code 1

Gem files will remain installed in /Users/tom/.rvm/gems/ruby-2.1.1@carecoach/gems/libxml-ruby-3.0.0 for inspection.
Results logged to /Users/tom/.rvm/gems/ruby-2.1.1@carecoach/extensions/x86_64-darwin-12/2.1.0-static/libxml-ruby-3.0.0/gem_make.out
'
EN

回答 1

Stack Overflow用户

发布于 2017-09-17 14:59:17

因此,在经历了许多痛苦和挫折,并尝试了一大堆东西之后,解决方案如下:

代码语言:javascript
复制
   gem update --system
   xcode-select --install # Then agree to the terms, even if you have done this before!
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46250280

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档