Installing libxml-ruby 2.9.0 with native extensions

最近調研使用openstreetmap生態體系,在本地安裝openstreetmap-website遇到執行安裝命令失敗的問題:安裝步驟按照官網https://github.com/openstreetmap/openstreetmap-website/blob/master/INSTALL.md 進行的(本地mac環境安裝),在執行命令

bundle install

報如下錯誤:

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

原因是libxml-ruby插件加載不到,需要確保本地已經安裝了libxml2插件,然後執行命令安裝libxml-ruby成功(ps:/usr/local/Cellar/libxml2/2.9.9_2 根據實際libxml2安裝目錄配置):

gem install libxml-ruby -v '3.1.0' -- --use-system-libraries --with-xml2-dir=/usr/local/Cellar/libxml2/2.9.9_2/include/libxml2/libxml/ --with-xml2-config=/usr/bin/xml2-config

然後重新執行命令bundle install 繼續安裝

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章