Issues installing libxml gem for ruby on windows - ruby

There are a few threads on questions similar to this, but none have proven effective. I attempted asking on the github page with no luck either.
When I attempt the standard command:
gem install libxml-ruby
I receive an error where the installer cannot find libxml2.dll. I found a stackoverflow thread with a similar issue and followed a user's guidelines here on where to grab the missing libraries and where to include them.
If I add arguments to the install command to point at the directories with the missing libraries using the following:
gem install libxml-ruby -- with-xml2-include=C:\Ruby200\include\libxml2 --with-iconv-include=C:\Ruby200\include
I now get an error where the installer can’t find a “iconv.h” header which is in my C:\Ruby200\include directory.
C:\Users\gonz102>gem install libxml-ruby -- with-xml2-include=C:/Ruby200/include
/libxml2 --with-iconv-include=C:/Ruby200/include
Temporarily enhancing PATH to include DevKit...
Building native extensions with: 'with-xml2-include=C:/Ruby200/include/libxml2 -
-with-iconv-include=C:/Ruby200/include'
This could take a while...
ERROR: Error installing libxml-ruby:
ERROR: Failed to build gem native extension.
C:/Ruby200/bin/ruby.exe extconf.rb with-xml2-include=C:/Ruby200/include/libx
ml2 --with-iconv-include=C:/Ruby200/include
checking for libxml/xmlversion.h in /opt/include/libxml2,/opt/local/include/libx
ml2,/usr/local/include/libxml2,/usr/include/libxml2... yes
checking for xmlParseDoc() in -lxml2... yes
checking for rb_io_bufwrite() in ruby/io.h... yes
creating extconf.h
creating Makefile
make "DESTDIR="
compiling libxml.c
In file included from C:/Ruby200/include/libxml2/libxml/parser.h:810:0,
from ruby_libxml.h:7,
from libxml.c:1:
C:/Ruby200/include/libxml2/libxml/encoding.h:28:19: fatal error: iconv.h: No suc
h file or directory
compilation terminated.
make: *** [libxml.o] Error 1
Gem files will remain installed in C:/Ruby200/lib/ruby/gems/2.0.0/gems/libxml-ru
by-2.9.0 for inspection.
Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/libxml-ruby-2.9.0/ext/libx
ml/gem_make.out
If anyone has any suggestions on what to investigate next or possible solutions I'd greatly appreciate it. I've been stumped on this for over a long while, coming back to it whenever I run into a project with libxml and would gladly take any advice.
Many thanks.

I was unsuccessful with installing libxml version 2.9.0 but 2.7.0 worked just fine. I should specify I'm running windows 7 and Ruby 2.0 32 bit. Here is what I had to do:
-I followed Wik's response here, grabbing all the missing libraries from them mingw64. Admittedly, I'm not sure if I needed all of them, but I sort of took a shotgun approach here.
Added the following to my system path:
Ruby200\lib\ruby\gems\2.0.0\gems\libxml-ruby-2.7.0-x86-mingw32\lib\libs
Executed the following in command line:
gem install libxml-ruby -v2.7.0 -- with-xml2-include:=C/Ruby200/include/libxml2 --with-iconv-include:=C:/Ruby200/include
After that, I the gem, at long last, installed and was actually usable.

Related

error installing ruby old version 2.0.0-p247

I am trying to run command
rbenv install 2.0.0-p247
I tried to follow several steps by googling the errors that I faced but I am still not able to resolve the error
I got this error
BUILD FAILED (macOS 11.4 using ruby-build 20210804)
Inspect or clean up the working tree at /var/folders/xm/rfncj90s56x8d1wdj0sl_0w40000gn/T/ruby-build.20210814020658.2987.F4rCnt
Results logged to /var/folders/xm/rfncj90s56x8d1wdj0sl_0w40000gn/T/ruby-build.20210814020658.2987.log
Last 10 log lines:
compiling ancdata.c
compiling raddrinfo.c
installing default socket libraries
compiling constants.c
1 warning generated.
linking shared-object ripper.bundle
ld: warning: directory not found for option '-L/Users/username/.rbenv/versions/2.0.0-p247/lib'
linking shared-object socket.bundle
ld: warning: directory not found for option '-L/Users/username/.rbenv/versions/2.0.0-p247/lib'
make: *** [build-ext] Error 2
The log file mentioned above has content:
https://easyupload.io/gygw5y
Ruby 2.0.0 is very much past its end of life, so I'm assuming you have a specific reason you need install it. Otherwise, you are much better off installing a modern, supported version such as 2.7.x or 3.0.x.
Older versions of ruby were built with openssl#1.0. After 1.0 went end of life, ruby-build had a breaking change to require openssl#1.1. This means that ruby versions < 2.4 can no longer be installed/built directly using ruby-build (i.e., rbenv). This GitHub issue has details.
Homebrew has removed its openssl#1.0 formula, but you can still install it via an rbenv tap. The following might work for you, though the comments in the issue report mixed results depending on the version of Command Line Tools being used.
brew install rbenv/tap/openssl#1.0
RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl#1.0)" 2.0.0-p247
Note: if you are running on an M1 (Apple Silicon) Mac, you might be out of luck. AFIK, there's no intention of getting openssl#1.0 to to work on Apple Silicon.

Ruby Gem install failing to find Postgres libraries

I'm going through the instructions for linking Ruby&Sinatra up to Postgres, as found at:
http://recipes.sinatrarb.com/p/databases/postgresql-datamapper?
The final step of the install is failing, when I attempt to run:
gem install dm-postgres-adapter
...and the key part of the error message looks to be these lines:
checking for -lpq... no
checking for -llibpq... no
I've located libpq.dll & libpq.lib on my drive at:
D:\Program Files\PostgreSQL\11\lib
After poking around looking for pq.dll or pq.lib, I don't see either of those on the drive.

Installing Nokogiri with a modified Makefile

When I try to create a new rails project on my PowerPC Mac OS X with ruby-2.4.2 and rails-5.1, it started to download and install various gems and during the build step of nokogiri-1.10 I got
cc1: error: unrecognized command line option "-Wno-array-bounds"
during the compilation of libxml2.9.9. I modified the
~/.chefdk/gem/ruby/2.1.0/gems/nokogiri-1.10.1/ext/nokogiri/tmp/powerpc-apple-darwin9.8.0/ports/libxml2/2.9.9/libxml2-2.9.9/Makefile
to comment out the error causing -Wno-array-bounds option and remade the project but it gave the same error again. I guess it's reverting back the original Makefile. How can I install nokogiri with a modified Makefile?

Make Julia Installing: it shows hashing.o not found?

I had installed Julia 0.4.5 with sudo apt install julia. Now I want to install the latest version of Julia v0.6.0. First I git clone the source code from the Github, then I install lots of the dependencies following the installing instruction. And all is fine.
When I start to make, waiting a long time, and it show:
Making install in TESTS
Making install in EXAMPLES
Making install in BAND
Making install in COMPLEX
Making install in NONSYM
Making install in SIMPLE
Making install in SVD
Making install in SYM
make[2]: *** No rule to make target '/home/yaoyu/julia/src/support/hashing.o', needed by '/home/yaoyu/julia/src/support/libsupport.a'. Stop.
Makefile:208: recipe for target 'support/libsupport.a' failed
make[1]: *** [support/libsupport.a] Error 2
Makefile:55: recipe for target 'julia_flisp.boot.inc.phony' failed
make: *** [julia_flisp.boot.inc.phony] Error 2
I have searched for answers in this web, while cann't find the way to fix it, I don't know what causes that ? Anyone konws how to correct it? Thanks a lot.

Cannot install Watir on Jruby 9.1.12.0 - Windows 7

I am trying to install gems from a local gem repository into Jruby 9.1.12.0 and I am getting stuck on Watir which is pretty much the first one I tried.
I am running on Windows 7 with JDK 1.8.0_131
I get the following:
Error installing watir:
ERROR: Failed to build gem native extension
it looks as though the rest of the error message is complaining about ffi-1.9.18 I am afraid I can't post the exact error message as it is inside a VM that is not internet enabled.
update: full error message:
C:\Ruby\gem>jruby -S gem install watir
Building native extensions. This could take a while...
C:/jruby-9.1.12.0/lib/ruby/stdlib/rubygems/ext/ext_conf_builder.rb:58: warning: Tempfile#unlink or delete called on open file
; ignoring
ERROR: Error installing watir:
ERROR: Failed to build gem native extension.
current directory: C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/ffi-1.9.18/ext/ffi_c
C:/jruby-9.1.12.0/bin/jruby.exe -r ./siteconf20170718-2540-6mqxiv.rb extconf.rb
current directory: C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/ffi-1.9.18/ext/ffi_c
make "DESTDIR=" clean
'make' is not recognized as an internal or external command,
operable program or batch file.
current directory: C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/ffi-1.9.18/ext/ffi_c
make "DESTDIR="
'make' is not recognized as an internal or external command,
operable program or batch file.
make failed, exit code 1
Gem files will remain installed in C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/ffi-1.9.18 for inspection.
Results logged to C:/jruby-9.1.12.0/lib/ruby/gems/shared/extensions/universal- java-1.8/2.3.0/ffi-1.9.18/gem_make.out
I got this working now. It was obvious from the error message that 'Make' was not being located correctly. I added the correct directory to the path and Watir was installed correctly.

Resources