How to install Nokogiri Ruby gem with mkmf.log saying libiconv not found?

后端 未结 5 1965
[愿得一人]
[愿得一人] 2020-12-25 11:10

I\'m installing the Ruby Nokogiri gem and finding the error below.

How to diagnose this and solve it?

# gem install nokogiri
Building native extensio         


        
5条回答
  •  难免孤独
    2020-12-25 11:56

    Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers.

    You are probably missing zlib headers which are required for -lz flag in order to compile the sources correctly. Install on Linux by:

    sudo apt-get install libz-dev
    

    For missing libiconv, try installing libiconv-hook-dev package which has header files of libiconv-hook, e.g.

    sudo apt-get install libiconv-hook1 libiconv-hook-dev
    

    On OS X, try installing development tools via: xcode-select --install.

    If there is still problem, check mkmf.log file for more specific details about your error.


    On Ubuntu, try the following dependency fix combo:

    sudo apt-get install gcc ruby-dev libxslt-dev libxml2-dev zlib1g-dev
    

提交回复
热议问题