I'm trying to install an old version of nokogiri, but I am having trouble specifying the format:
I'm using
gem install nokogiri -v 1.5.2 -- --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib
but this is not the correct syntax. Do you know how to do this?
ERROR
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/boris/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... no
-----
libiconv is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
*** 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:
You’ve only specified the lib dir to use, try specifying the include dir as well:
gem install nokogiri -v 1.5.2 -- \
--with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib \
--with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include
You may be able to specify both together:
gem install nokogiri -v 1.5.2 -- \
--with-iconv-dir=/usr/local/Cellar/libiconv/1.13.1
It looks like there was some changes as to how Nokogiri finds iconv between versions 1.5.2 and 1.5.5, which may explain why you’re able to install the latest version but not 1.5.2.
I simply installed homebrew, and used the brew link inconv to create the necessary symlinks to compile the gem.
$brew link libiconv
Linking /usr/local/Cellar/libiconv/1.13.1... 18 symlinks created
$gem install nokogiri -v 1.5.2
Related
I'm having troubles to do bundle install in one project I get to work on in Rails 4.2.10. When I bundle I receive the next error:
An error occurred while installing ffi (1.9.25), and Bundler cannot continue.
Make sure that gem install ffi -v '1.9.25' succeeds before bundling.
In Gemfile:
s3_direct_upload was resolved to 0.1.6, which depends on
sass-rails was resolved to 5.0.7, which depends on
sass was resolved to 3.6.0, which depends on
sass-listen was resolved to 4.0.0, which depends on
rb-inotify was resolved to 0.9.10, which depends on
ffi
When I run gem install ffi -v '1.9.25' also an error occurs:
Building native extensions. This could take a while...
ERROR: Error installing ffi:
ERROR: Failed to build gem native extension.
current directory: /xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25/ext/ffi_c
/xxx/xxx/.rvm/rubies/ruby-2.5.3/bin/ruby -r ./siteconf20190110-6923-1jimorr.rb extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi... yes
checking for ffi_call() in -lffi... yes
checking for ffi_closure_alloc()... no
checking for ffi_raw_call()... no
checking for shlwapi.h... no
checking for ruby/thread.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_call_without_gvl()... yes
creating extconf.h
creating Makefile
current directory: /xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25/ext/ffi_c
make "DESTDIR=" clean
current directory: /xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25/ext/ffi_c
make "DESTDIR="
Configuring libffi
clang: error: unsupported option '-print-multi-os-directory'
clang: error: no input files
cd "/xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25/ext/ffi_c/libffi-x86_64-darwin18" && /Volumes/Macintosh HD/Applications/Xcode.app/Contents/Developer/usr/bin/make
/bin/sh: /Volumes/Macintosh: No such file or directory
make: *** ["/xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25/ext/ffi_c/libffi-x86_64-darwin18"/.libs/libffi_convenience.a] Error 127
make failed, exit code 2
Gem files will remain installed in /xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25 for inspection.
Results logged to /xxx/xxx/.rvm/gems/ruby-2.5.3/extensions/x86_64-darwin-18/2.5.0/ffi-1.9.25/gem_make.out
I've been trying many solutions online but cannot resolve this issue.
Seems the issue is with my system as I'm new to the team and the other developers were unable to help me as they do not have this kind of issue.
I was able to successfully install ffi with the following command:
LDFLAGS="-L/usr/local/opt/libffi/lib" PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig" gem install ffi -v '1.9.25'
Found on some japanese board
According to the libffi README, only GCC is a tested compiler on macOS. You are using Clang, which doesn't support the command line option -print-multi-os-directory.
You need to either patch libffi to work with Clang, or use GCC.
Your error is the following Configuring libffi
clang: error: unsupported option '-print-multi-os-directory'
clang: error: no input files because Clang (wich is the C compiler you are using) doesn't support the option '-print-multi-os-directory'.
Could you check that X-Code command line tools are perfectly installed by executing the following command? xcode-select --install
Also would you mind to try brew install automake autoconf libtool libffi to install required dependencies?
I am using Ruby 1.9.3 and therefore have to use an older version of Nokogiri. I need to install Nokogiri v1.5.10.
Initially I got an error that libxml2 is missing. After installing libxml2 I got the following error:
ERROR: Error installing nokogiri-1.5.10.gem:
ERROR: Failed to build gem native extension.
/opt/ruby-1.9.3/bin/ruby extconf.rb
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... no
-----
libxslt is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
*** 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.
Do I need to install each and every dependency manually?
If so, how do i determine what version to use?
NOTE: The server does not have access to the internet. Therefore, I have to scp rpm or tar files to install.
Unfortunately yes, you will need to install each dependency manually with that version of Nokogiri as I don't believe they packaged the dependencies in until version 1.6.0.rc1.
I'm having a problem installing Ruby on Rails in my terminal.
Has anyone else encountered the following error in the terminal:
checking for main() in -llzma... yes
checking for xmlParseDoc() in libxml/parser.h... no
checking for xmlParseDoc() in -lxml2... no
checking for xmlParseDoc() in -llibxml2... no
-----
libxml2 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.
I'm using the standard bash:
$ gem install rails
How would I go about fixing this? I've tried a few things here on stack exchange but nothing so far has worked...
Using $ brew list in the terminal yields:
Michaels-iMac:~ iMacHome$ brew list
autoconf libksba libxslt pkg-config
automake libtool libyaml readline
libgpg-error libxml2 openssl
Michaels-iMac:~ iMacHome$
It seems to be there...
assuming you have Xcode installed try this
gem install rails -- --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml2 --use-system-libraries
The problem could be your RVM.
Try either this command:
rvm cleanup all
rvm pkg uninstall libxml2
rvm reinstall all --force
or upgrade/reinstall to the latest RVM installation.
--
To properly install the rails gem globally for a Ruby version:
rvm use <rubyversion>
gem install rails
example to use rails on ruby 2.1.5:
rvm use 2.1.5
gem install rails
I'm running Ruby 1.9.3p194 & Rails 3.2.9 in Fedora 16.
When I gem install nokogiri, it fails with error message:
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/home/chelseaw/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... no
checking for iconv_open() in -liconv... no
checking for libiconv_open() in iconv.h... no
checking for libiconv_open() in -liconv... no
checking for libiconv_open() in -liconv... no
-----
libiconv is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
*** 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.
I've googled around for quite a while but only found some solutions for MacOS. I've no idea what to do, please help.
Edit 1
The results of yum search iconv:
mingw32-iconv-debuginfo.noarch : Debug information for package mingw32-iconv
mingw32-iconv-static.noarch : Static version of the MinGW Windows Iconv library
mingw32-win-iconv.noarch : MinGW Windows Iconv library
mingw32-win-iconv-debuginfo.noarch : Debug information for package
: mingw-win-iconv
mingw32-win-iconv-static.noarch : Static version of the MinGW Windows Iconv
: library
perl-Text-Iconv.i686 : Perl interface to iconv() codeset conversion function
perl-Text-Iconv-debuginfo.i686 : Debug information for package perl-Text-Iconv
psiconv-debuginfo.i686 : Debug information for package psiconv
psiconv-devel.i686 : Development files for psiconv
uniconvertor-debuginfo.i686 : Debug information for package uniconvertor
mingw32-iconv.noarch : GNU libraries and utilities for character set conversion
perl-HTML-WikiConverter.noarch : Perl module to convert HTML to wiki markup
perl-HTML-WikiConverter-Markdown.noarch : Convert HTML to Markdown markup
psiconv.i686 : A conversion utility for Psion files
uniconvertor.i686 : Universal vector graphics translator
Finally got it work, here are the steps:
Download libiconv
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.11.tar.gz
Extract files tar -xvzf libiconv-1.11.tar.gz
Enter the directory cd libiconv-1.11
Configure libiconv Library ./configure --prefix=/usr/local/libiconv
Compile libiconv make CFLAGS="-O2 -fno-tree-dce -fno-optimize-sibling-calls" (I have to add CFLAGS to make the compiling work.)
Install libiconv sudo make install
Install nokogiri
CFLAGS="-O2 -fno-tree-dce -fno-optimize-sibling-calls" gem install nokogiri -- --with-iconv-dir=/usr/local/libiconv --with-iconv-lib=/usr/local/libiconv/lib --with-iconv-include=/usr/local/libiconv/include
Voila, it shows the success message!
No need to compile it yourself, try running this command:
sudo yum install -y gcc ruby-devel libxml2 libxml2-devel libxslt libxslt-devel
Or:
rvm get head && rvm requirements run force
Try:
yum install -y iconv-devel
and then:
gem install nokogiri
Error message indicates libiconv is missing. Did you install it? you may need to install libiconv and libiconv-devel packages.
When I try to install nokogiri gem on ruby-1.8.7-p334 [ x86_64 ] on Mac OS X 10.6, I get the following error:
sudo gem install nokogiri
/Users/patelc75/.rvm/rubies/ruby-1.8.7-p334/bin/gem:4: warning: Insecure world writable dir /Users in PATH, mode 040777
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/patelc75/.rvm/rubies/ruby-1.8.7-p334/bin/ruby extconf.rb
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... no
-----
libiconv is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
*** 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.
Before installing nokogiri gem, you need to get libraries installed.
Here are the steps to do it with homebrew
# the rest of this snippet assumes installation of libxml 2.7.7. YMMV.
brew install libxml2
brew link libxml2
# install libxslt from source
wget ftp://xmlsoft.org/libxml2/libxslt-1.1.26.tar.gz
tar -zxvf libxslt-1.1.26.tar.gz
cd libxslt-1.1.26
./configure --prefix=/usr/local/Cellar/libxslt/1.1.26 \
--with-libxml-prefix=/usr/local/Cellar/libxml2/2.7.7
make
sudo make install
gem install nokogiri -- --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26
With macports
sudo port install libxml2 libxslt
sudo gem install nokogiri
More information here http://nokogiri.org/tutorials/installing_nokogiri.html
I tries all kinds of solutions I can found, including:
. use brew to install libxslt / libxml2 / libiconv
. tries to gem install with various --with-configurations
sadly, they all didn't work for me, until I uninstalled MacPort and all installed ports.
Then simply executed command gem install nokogiri, the gem and rdoc got installed like a breeze.
I don't understand the very details of why, but according to my own experiences of using MacPort (resulted in multiple sets of ruby/rake/gem(s) installed) and articles comparing brew and port, I will not go back to port.