I'm trying to install hpricot and am getting the following error. I do have xcode installed but I'm not sure what else I'm missing.
$ gem install hpricot
Building native extensions. This could take a while...
ERROR: Error installing hpricot:
ERROR: Failed to build gem native extension.
/Users/user_name/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for stdio.h... *** 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 also tried nokogiri.
$ gem install nokogiri
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/user_name/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for libxml/parser.h... *** 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 don't think hpricot is supported anymore. You should look into nokogiri, it is much faster and is extremely well documented.
edit: I just checked the hpricot github page (https://github.com/hpricot/hpricot/) and they also suggested you use nokogiri:
Hpricot has ended. Please consider an alternative like nokogiri.
edit#2: If you are running into errors installing it, it is likely because you are missing libxml and other libraries which you will need to install through homebrew or macports. All the required libraries and installation instructions can be found here:
http://nokogiri.org/tutorials/installing_nokogiri.html
It looks like you don't have libxml, or the libxml development libraries, from the error message in the nokogiri build.
Using Kubuntu 14.04 I installed hpricot (after error "ERROR: Failed to build gem native extension.") simply by installing ruby-dev first.
Related
I 'm using new MACBook PRO (chip: Apple M2) and trying to set up rails application but therubyracer gem is not installing. I tried below steps but didn't work
brew install v8#3.15
gem install libv8 -v '3.16.14.19' -- --with-system-v8
gem install therubyracer -- --with-v8-dir=/opt/homebrew/opt/v8#3.15
when i tried with 'brew install v8#3.15' it gives below error
Warning: v8#3.15 has been deprecated because it depends on Python 2 to build!
Error: v8#3.15: no bottle available!
If you're feeling brave, you can try to install from source with:
brew install --build-from-source v8#3.15
It is expected behaviour that most formulae will fail to build from source.
It is expected behaviour that Homebrew will be buggy and slow when building from source.
Do not create any issues about failures building from source on Homebrew's GitHub repositories.
Do not create any issues building from source even if you think this message is unrelated.
Any opened issues will be immediately closed without response.
Do not ask for help building from source from MacHomebrew on Twitter.
You may ask for help building from source in Homebrew's discussions but are unlikely to receive a response.
If building from source fails, try to figure out the problem yourself and submit a fix as a pull request.
We will review it but may or may not accept it.
eve after installing v8 as suggested with command 'brew install --build-from-source v8#3.15', therubyracer gem is still not installing,
thrrubyracer error log:
Building native extensions with: '--with-v8-dir=/opt/homebrew/opt/v8#3.15'
This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
current directory: /Users/rashmib/.rvm/gems/ruby-2.7.0/gems/therubyracer-0.12.3/ext/v8
/Users/rashmib/.rvm/rubies/ruby-2.7.0/bin/ruby -I /Users/rashmib/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0 -r ./siteconf20221117-7943-1tz6m31.rb extconf.rb --with-v8-dir\=/opt/homebrew/opt/v8#3.15
checking for -lpthread... yes
checking for -lobjc... yes
checking for v8.h... 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:
...
/Users/rashmib/.rvm/gems/ruby-2.7.0/gems/libv8-3.16.14.19/ext/libv8/location.rb:50:in `configure': By using --with-system-v8, you have chosen to use the version (Libv8::Location::System::NotFoundError)
of V8 found on your system and *not* the one that is bundled with
the libv8 rubygem.
However, your system version of v8 could not be located.
Please make sure your system version of v8 that is compatible
with 3.16.14.19 installed. You may need to use the
--with-v8-dir option if it is installed in a non-standard location
from /Users/rashmib/.rvm/gems/ruby-2.7.0/gems/libv8-3.16.14.19/lib/libv8.rb:7:in `configure_makefile'
from extconf.rb:32:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/rashmib/.rvm/gems/ruby-2.7.0/extensions/-darwin-21/2.7.0/therubyracer-0.12.3/mkmf.log
extconf failed, exit code 1
Any idea how can i resolve this?
I am trying to setup a ruby on rails environment on my mac in order to start using the RubyMine IDE.
I have used homebrew, rbenv and all other required libraries in order to install ruby/rails - however when I sudo gem install rails the install fails due to :
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: /usr/local/lib/ruby/gems/2.3.0/gems/nokogiri-1.6.8.1/ext/nokogiri
/usr/local/opt/ruby/bin/ruby -r ./siteconf20161110-767-xwnfls.rb extconf.rb
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.
Using mini_portile version 2.1.0
checking for iconv.h... yes
checking for gzdopen() in -lz... no
zlib is missing; necessary for building libxml2
*** 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 have tried to install Nokogiri on it's own and I get the following error:
ERROR: While executing gem ... (Errno::EACCES)
Permission denied # rb_sysopen - /usr/local/lib/ruby/gems/2.3.0/gems/nokogiri-1.6.8.1/.autotest
I really hope somebody can help me as I am quite a noob to RonR and I feel like things have gotten messy directory/permission wise,
Thank you.
Let's take a quick look at a small part of the error that you have provided us.
zlib is missing; necessary for building libxml2
It's trying to tell you that you do not have zlib, so let's get it. Since you said you're using a Mac, I would install a package manager like Homebrew. Try doing brew install zlib to install this package.
Additionally, if you're starting out learning Ruby, regardless of what platform you are using, it might be helpful to use something like rbenv or rvm to manage different versions of Ruby and the gems that go along with those versions. You will run into less permissions issues (e.g. having to run gem install as a privileged user), some of which may be easy to solve, but some of which may send you down a rabbit hole for a few hours.
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 was trying to install rmagick gem in rails 2.3.5 . but I could not install as it shows error. Same error comes in both rvm and system.
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
extconf.rb:153: undefined (?...) sequence: /^Version: ImageMagick\s+(?\d+.\d+.\d+-\d+)\s+(?\S+)\s+(?\S+)\s+(?\S+)/
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/rmagick-2.13.4 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/rmagick-2.13.4/ext/RMagick/gem_make.out
this was the error.
Already Installed imagemagick,libmagickwand-dev, libxml2-dev, libxslt-dev,libgraphics-magick-perl, libgraphicsmagick++1-dev, libgraphicsmagick++3, libgraphicsmagick1-dev, libgraphicsmagick3 (tried everything got from google)
Seems like v2.13.4 needs some extra stuff installed, simply not only install libs but also:
sudo apt-get install imagemagick
This fixed it for me.
FYI, I got the following error:
checking for ImageMagick version >= 6.4.9... *** 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.
If you don't need the very latest version, you could try:
gem install rmagick -v 2.13.3
And see if the previous one works for you.
I don't know what I've broken but I can't create any rails apps using sqlite any more.
When I try to run gem install sqlite3 or include sqlite3 in the gemfile for a rails app I get the following.
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
/Users/mark/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
checking for sqlite3.h... *** 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 pretty new to ruby/rails etc so this makes very little sense to me.
I also ran a sudo gem update and ran into the same problem when it tried to update nokogiri.
Updating nokogiri
Fetching: nokogiri-1.5.0.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/mark/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
checking for libxml/parser.h... *** 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.
Any idea/suggestions of what to try to get up and running with sqlite3 would be hugely appreciated.
Using ruby 1.9.2, OSX Lion.
Thanks, mark
The sqlite3 gem has to be compiled and link against the native sqlite3 libraries, so you'll need a C/C++ compiler and the sqlite3 development headers/libraries properly installed.
On Mac OS X, you can do this by installing the latest version of XCode. That should provide the C/C++ development tools and headers that the sqlite3 gem requires. It's a big download, but without it, you can't install the sqlite3 gem using the gem command, so make sure it's installed.
After you've installed XCode, reset your terminal and try running the "gem install sqlite3" again. It should work this time.
Try installing the sqlite3 development headers by running: port install sqlite3 +universal