2015-01-08 24 views
5

tôi thấy rất nhiều câu hỏi thuộc loại này nhưng tôi có một chút tình huống khác nhau, do đó, tôi đang làm bundle install và nhận điều này:nokogiri thất bại trong việc cài đặt OSX

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

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20150109-25233-1jiriou.rb extconf.rb --with-iconv-dir=/usr/local/Cellar/libiconv/1.14/ 
checking if the C compiler accepts ... yes 
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no 
Building nokogiri using packaged libraries. 
checking for iconv using --with-iconv-* flags... no 
checking for iconv... no 
----- 
libiconv is missing. Please locate mkmf.log to investigate how it is failing. 
----- 
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby 
    --help 
    --clean 
    --use-system-libraries 
    --enable-static 
    --disable-static 
    --with-zlib-dir 
    --without-zlib-dir 
    --with-zlib-include 
    --without-zlib-include=${zlib-dir}/include 
    --with-zlib-lib 
    --without-zlib-lib=${zlib-dir}/lib 
    --enable-cross-build 
    --disable-cross-build 

extconf failed, exit code 1 

Gem files will remain installed in /var/folders/sk/x8m9btmj1g58c906v0z3k2br0000gq/T/bundler20150109-25233-o53u4y/nokogiri-1.6.5/gems/nokogiri-1.6.5 for inspection. 
Results logged to /var/folders/sk/x8m9btmj1g58c906v0z3k2br0000gq/T/bundler20150109-25233-o53u4y/nokogiri-1.6.5/extensions/universal-darwin-14/2.0.0/nokogiri-1.6.5/gem_make.out 
An error occurred while installing nokogiri (1.6.5), and Bundler cannot continue. 
Make sure that `gem install nokogiri -v '1.6.5'` succeeds before bundling. 

Tôi đã libiconv cài đặt, tôi đã cố gắng trong cách này gem install nokogiri -- --with-iconv-dir=/usr/local/Cellar/libiconv/1.14/ gem cài đặt ok nhưng hơn tôi cố gắng bó tôi nhận được cùng một lỗi một lần nữa tình hình tương tự là khi tôi cố gắng làm gem install nokogiri -v '1.6.5' cài đặt là ok, tôi có thể nhìn thấy đá quý trong danh sách đá quý nhưng có vẻ như bundler không nhìn thấy nó, tôi đã cố gắng bao gồm nó trong tập tin đá quý của tôi với phiên bản cụ thể này nhưng vẫn có lỗi này

Trả lời

4

Bạn có thể sử dụng bundle config để thiết lập con đường:

bundle config build.nokogiri "--with-iconv-dir=/usr/local/Cellar/libiconv/1.14/" 
bundle install 
+1

Tôi cố gắng này quá, các lỗi tương tự – maki

+0

Kết hợp điều này với phản ứng cbertelegni, nó làm việc! – Tiago

0

này làm việc cho tôi, nhờ Gergő & cbertelegni:

bundle config build.nokogiri "-- \ 
    --use-system-libraries \ 
    --with-xml2-config=/usr/bin/xml2-config \ 
    --with-xslt-config=/usr/bin/xslt-config" 
bundle install 
4

Điều này phù hợp với tôi bundle config build.nokogiri "--use-system-libraries --with-xml2-include=/usr/local/opt/libxml2/include/libxml2"

Chạy lệnh này để thiết lập cấu hình trước bundle install

tôi có giải pháp này từ https://github.com/sparklemotion/nokogiri/issues/1099

Các vấn đề liên quan