首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >包安装失败安装libxml-ruby

包安装失败安装libxml-ruby
EN

Stack Overflow用户
提问于 2018-11-09 09:03:30
回答 5查看 6.3K关注 0票数 14

我是Ruby世界的新手,我需要克隆一个现有的项目。

这些指示是:

代码语言:javascript
复制
source .env.development
bundle install

但它失败了,因为:

代码语言:javascript
复制
Using libv8 3.16.14.15
Fetching libxml-ruby 2.9.0
Installing libxml-ruby 2.9.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /Users/vlad/.rvm/gems/ruby-2.3.1/gems/libxml-ruby-2.9.0/ext/libxml
/Users/vlad/.rvm/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20181109-46682-fvgifh.rb extconf.rb --use-system-libraries
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
--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/vlad/.rvm/rubies/ruby-2.3.1/bin/$(RUBY_BASE_NAME)
--with-xml2-config
--without-xml2-config
--with-xml2-dir
--without-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


To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/vlad/.rvm/gems/ruby-2.3.1/extensions/x86_64-darwin-18/2.3.0/libxml-ruby-2.9.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/vlad/.rvm/gems/ruby-2.3.1/gems/libxml-ruby-2.9.0 for inspection.
Results logged to /Users/vlad/.rvm/gems/ruby-2.3.1/extensions/x86_64-darwin-18/2.3.0/libxml-ruby-2.9.0/gem_make.out

An error occurred while installing libxml-ruby (2.9.0), and Bundler cannot continue.
Make sure that `gem install libxml-ruby -v '2.9.0'` succeeds before bundling.

In Gemfile:
  upnxt_community_lib_common was resolved to 1.7.49, which depends on
    upnxt_processing_lib_document was resolved to 2.0.0, which depends on
      libxml-

如果我想执行建议的命令"gem安装libxml-ruby -v '2.9.0'“,我将得到相同的错误。

操作系统: MacOS Mojave,版本10.14。项目所需的Ruby版本:Ruby2.3.1p112(2016-0426修订版54768) x86_64-darwin18 18

我也尝试过,但没有帮助。

提前感谢您的帮助!

EN

回答 5

Stack Overflow用户

回答已采纳

发布于 2018-11-09 11:33:10

如果其他人遇到这个问题,我设法在同事的帮助下解决这个问题:

代码语言:javascript
复制
gem install libxml-ruby -v '2.9.0' -- --use-system-libraries --with-xml2-dir=/usr/local/Cellar/libxml2/2.9.8/include/libxml2/libxml/ --with-xml2-config=/usr/bin/xml2-config

将'2.9.0‘替换为您需要的libxml版本!

票数 24
EN

Stack Overflow用户

发布于 2019-06-04 22:43:30

这些步骤对我有效(来源)

代码语言:javascript
复制
brew install libxml2
bundle config --global build.libxml-ruby --with-xml2-config="$(brew --prefix libxml2)/bin/xml2-config"

然后bundle install按预期工作

票数 28
EN

Stack Overflow用户

发布于 2019-04-30 09:29:27

它解决了我在mac通过运行

gem安装libxml-ruby -v '3.0.0‘--with-xml2-config=/usr/local/opt/libxml2/bin/xml2-config -with-xml2-dir=/usr/local/opt/libxml2-with-xml2-lib=/usr/-v/-v/libxml 2/lib --with-xml2-include=/usr/local/opt/libxml2/include

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53222641

复制
相关文章

相似问题

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