nokogiri.so LoadError maybe problem with libiconv on Solaris - ruby

I'm trying to get the Ruby gem "Nokogiri" running on a Solaris machine where I don't have root priviledges. What I've done so far:
I've build my own ruby version (1.9.2p180) in my home directory
tried to install nokogiri with "gem install nokogiri"
The gem install then throwed this error:
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/home/bender/ruby/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.
So I downloaded and build the libiconv in /home/myuser/work/libiconv
$ ls /home/myuser/work/libiconv/
bin build include lib share
And passed the locations as arguments for nokogiri:
gem install nokogiri -- --with-iconv-dir=/home/myuser/work/libiconv --with-iconv-include=/home/myuser/work/libiconv/include --with-iconv-lib=/home/myuser/work/libiconv/lib
Now the gem builds and no errors are displayed. The problem is, when I now try to use it, e.g. in irb it somehow fails to load:
require 'nokogiri'
LoadError: ld.so.1: ruby: fatal: libiconv.so.2: open failed: No such file or directory - /home/myuser/ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.4/lib/nokogiri/nokogiri.so
from /home/myuser/ruby/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/myuser/ruby/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/myuser/ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.4/lib/nokogiri.rb:13:in `<top (required)>'
from /home/myuser/ruby/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:57:in `require'
from /home/myuser/ruby/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:57:in `rescue in require'
from /home/myuser/ruby/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from (irb):1
from /home/myuser/ruby/bin/irb:12:in `<main>'
But when I look for the file which should be missing it is there and also readable/executable:
ll /home/myuser/ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.4/lib/nokogiri/
total 66
...
-rwxr-xr-x 1 myuser group 370552 Jun 6 22:53 nokogiri.so
...
Ok, and that is where I'm stuck.. the file is there but can't be opened? I tried to rebuild the libiconv which had no effect. Nokogiri doesn't throw any error that the build process fails. So I don't know how to solve this and google could't give me answers either. I hope somebody here can give me some hints.
/edit
I googled around some more and found this post where somebody uses ldd to show dependencies. When I do the same for nokogiri it says:
ldd /home/myuser/ruby/bin/nokogiri
ldd: /home/myuser/ruby/bin/nokogiri: unsupported or unknown file type
I guess this is because its a ruby file but in case it is relevant I want to mention it.

If you're using GNU binutils, then try to set
LDFLAGS="-Wl,-rpath /home/myuser/work/libiconv/lib"
if it's a Solaris linker, then it's something like -X, I don't really remember. Just check the man page of ld for runpath settings. It'll allow the run-time linker to find the .so.

If you're going to build your own sandbox, why not use RVM to do all the heavy lifting? Its purpose in life is to create a user sandbox in ~/.rvm, build and manage the Ruby versions you want to run and the gemsets associated with your projects.
If you decide to go that path, which I recommend highly, be sure to follow the single-user installation directions on the linked page, to add the appropriate string to your ~/.bash_profile or ~/.bashrc if you you don't use a *profile file, and follow the recommendations RVM outputs when you run rvm notes.
I have it installed on several Centos, Ubuntu and Mac OS boxes where I do development, and think it's great.

Related

TypeError in installing ruby gems on CygWin

I have installed ruby 2.2.5 / gem 2.3.0 in CygWin but I am getting installation errors in using gem install.
As suggested in some places, I also tried gem update --system but even that did not help.
How to correct this issue?
I have attached the output of the commands I ran:
$ gem install napa --backtrace
ERROR: While executing gem ... (TypeError)
no implicit conversion of nil into String
/usr/local/share/ruby/site_ruby/rubygems/installer.rb:168:in `check_executable_overwrite'
/usr/local/share/ruby/site_ruby/rubygems/installer.rb:409:in `block in generate_bin'
/usr/local/share/ruby/site_ruby/rubygems/installer.rb:396:in `each'
/usr/local/share/ruby/site_ruby/rubygems/installer.rb:396:in `generate_bin'
/usr/local/share/ruby/site_ruby/rubygems/installer.rb:236:in `install'
/usr/local/share/ruby/site_ruby/rubygems/request_set.rb:156:in `block in install'
/usr/local/share/ruby/site_ruby/rubygems/request_set.rb:140:in `each'
/usr/local/share/ruby/site_ruby/rubygems/request_set.rb:140:in `install'
/usr/local/share/ruby/site_ruby/rubygems/commands/install_command.rb:249:in `install_gem'
/usr/local/share/ruby/site_ruby/rubygems/commands/install_command.rb:291:in `block in install_gems'
/usr/local/share/ruby/site_ruby/rubygems/commands/install_command.rb:287:in `each'
/usr/local/share/ruby/site_ruby/rubygems/commands/install_command.rb:287:in `install_gems'
/usr/local/share/ruby/site_ruby/rubygems/commands/install_command.rb:202:in `execute'
/usr/local/share/ruby/site_ruby/rubygems/command.rb:307:in `invoke_with_build_args'
/usr/local/share/ruby/site_ruby/rubygems/command_manager.rb:167:in `process_args'
/usr/local/share/ruby/site_ruby/rubygems/command_manager.rb:137:in `run'
/usr/local/share/ruby/site_ruby/rubygems/gem_runner.rb:54:in `run'
/usr/bin/gem:21:in `<main>'
$ gem update --system
Updating rubygems-update
ERROR: While executing gem ... (TypeError)
no implicit conversion of nil into String
Skip to the bottom for the short answer and not join me on my journey.
So I've been working on this today because for the life of me, what worked last year to get it working did not work this year. All the steps are attempted while using admin permissions. I had done some questionable commands from other threads that required me to downgrade gem to something 6 years ago, don't do that I could not figure out how to revert so I deleted my Cygwin install and started fresh and clean for this. Windows 10 is my operating system.
I used cygwin's installer to install the current version of ruby, gem and sass. (I'm positive as time goes on these will numbers will become out of date).
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-cygwin]
ruby-devel 2.3.3-1
gem 2.6.11
Sass 3.4.21 selective steve
Side note I tend to use 'Category' under the View drop down and select the devel category. I also let cygwin select dependencies for me automatically.
At this point I am having the same error. Looking at the log provided by the output I decided to try out some of the commands smashed in there like 'gcc' which was absent. Loading up the cygwin installer again, installed gcc version 5.4.0 (Package called gcc-core: GNU Compiler Collection (C, OpenMP))
Attempting to run 'gem install compass' again, another error, it cant find 'make'. Warm up the installer again and locate 'make: The GNU Version of the 'make' utility (4.2.1-2)
Running the compass install command again and checking the log: 'libffi' doesnt look like its there. In our cygwin installer says under the libs category I have libffi6 v2.2.1-2 already. I'm going to give libffi-devel a shot because I'm desperate to get compass installed.
This worked! Navigate to your directory and run the command 'compass watch' I'm pretty excited. Running 'compass -v' in the command line shows us the version 1.0.3
Short answer:
Useing the Cygwin installer to install the following Packages
ruby: interpreted object oriented scripting language
ruby-devel: interpreted object oriented scripting language
ruby-gems: Ruby Module management system
ruby-sass: Ruby css compiler extension
make: The GNU version of the make utility
gcc-core: GNU Compiler Collection(c, OpenMP)
libffi-devel: Portable foreign function interface libary
Then run cygwin as a administrator and input the command 'gem install compass'.

RubyMine debugger error

i'm using RubyMine 6.3 buth I have some problems with debugger
C:\Ruby200\bin\ruby.exe -e
$stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)
C:/Ruby200/lib/ruby/gems/2.0.0/gems/ruby-debug-ide-0.4.23.beta1/bin/rdebug-ide
--disable-int-handler --port 49883 --dispatcher-port 49884 -- C:/Ruby200/Projekty/123/test
C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in
require': cannot load such file -- debase_internals (LoadError) from
C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in
require' from
C:/Ruby200/lib/ruby/gems/2.0.0/gems/debase-0.0.9/lib/debase.rb:4:in
<top (required)>' from
C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in
require' from
C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in
require' from
C:/Ruby200/lib/ruby/gems/2.0.0/gems/ruby-debug-ide-0.4.23.beta1/lib/ruby-debug-ide.rb:8:in
' from
C:/Ruby200/lib/ruby/gems/2.0.0/gems/ruby-debug-ide-0.4.23.beta1/bin/rdebug-ide:8:in
require_relative' from
C:/Ruby200/lib/ruby/gems/2.0.0/gems/ruby-debug-ide-0.4.23.beta1/bin/rdebug-ide:8:in
' from -e:1:in load' from -e:1:in'
Process finished with exit code 1
But when use Ruby Interactive Console, all is working. When I use Komodo IDE all is fine.
I fixed my issue by installing debase manually from the terminal, not from the one bundled with rubymine, try it
gem install debase
PS: I was using ruby 1.9.3
Adding the following to my Gemfile made debugging and rails commands work (versions: Rubymine 7.0.4, ruby 2.3.1 and rails 4.2.6):
group :development do
gem 'ruby-debug-ide', '0.4.24'
gem 'debase', '0.2.1'
end
Just spent 6 hours working through this, and just in case this helps others, here is what I did:
Upgraded to latest version of RubyMine (downloaded 7.0 from JetBrains site)
Upgraded to Ruby 2.1.2
Opened RubyMine > File > Default Settings > Ruby SDK & Gems > Selected ruby-2.1.2 > Clicked '+' on right hand side > Installed cucumber and calabash-cucumber
RubyMine > Run > Edit Configurations > changed the SDK to ruby-2.1.2
And it worked. Hopefully this might help others new to Calabash / Ruby / RubyMine
Martins-MacBook-Pro:~ martincleaver$ sudo gem install debase -v 0.0.9
Password:
ERROR: Error installing debase:
ERROR: Failed to build gem native extension.
checking for vm_core.h... no
No source for ruby-2.0.0-p648 provided with debugger-ruby_core_source gem.
Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details.
$ more /Library/Ruby/Gems/2.0.0/gems/debase-0.0.9/ext/gem_make.out
checking for vm_core.h... no
Makefile creation failed
Check the mkmf.log file for more details
$ more /Library/Ruby/Gems/2.0.0/gems/debase-0.0.9/ext/mkmf.log
have_header: checking for vm_core.h... -------------------- no
conftest.c:3:10: fatal error: 'vm_core.h' file not found
#include <vm_core.h>
--------------------
https://github.com/denofevil/debase/issues/9 tracks the issue from the gem standpoint. It's the best place to discuss the matter.
That said, iheggie's answer at https://stackoverflow.com/a/37086441/722034 worked for me.
Updating Rubymine to the latest version (and waiting for reindexing to finish, which can be quite long) helped fix some problems cf https://intellij-support.jetbrains.com/hc/en-us/community/posts/360009522340-Unable-to-use-debugger-debase-0-3-0-beta34-install-error-

Installing ncurses for ruby on Windows

I am trying to install ncurses for ruby on windows. I have not installed ncurses before on my machine. I thought that having the "ruby devkit", it had asked for would be enough, but now I am being asked to specify options... I don't know which options to pick, or if I need to do/install other things for the gem to get installed:
C:\Ruby193\Devkit>gem install ncurses -- --ruby=C:/Ruby193/bin/ruby --without-make-prog --without-opt-dir
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing ncurses:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb --ruby=C:/Ruby193/bin/ruby --without-make-prog --without-opt-dir
C:/Ruby193/lib/ruby/1.9.1/shellwords.rb:35:in `shellsplit': undefined method `scan' for false:FalseClass (NoMethodError)
from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:2216:in `<top (required)>'
from C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:22:in `<main>'
Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/ncurses-0.9.1 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/ncurses-0.9.1/./gem_make.out
WHAT A PAIN, I just want to get this gem installed so I can run this:
require 'curses'
cols = Curses.stdscr.maxx
msg = "random_string"
str = msg.center(msg.length + cols - msg.length - 5 - 3)
puts "<!-- #{str}-->"
Updated version:
Get ncurses (MinGW Port): http://invisible-island.net/ncurses/
Put it in C:\ncurses
gem install curses --platform=ruby -- --with-ncurses-dir="C:\ncurses"
Copy the contents of C:\ncurses\bin to somewhere in your path
C:\ncurses can be any directory
I've managed to do it for ruby 2.2, which doesn't come with curses by default, but it took me a while:
Download PDCurses from SourceForge;
Unzip it;
Copy it's contents to a folder where ruby can see it. I'm not sure which one I used, I think I copied it to multiple ones until it worked. ruby -e 'puts $:' might help;
Install curses, gem instal curses. If the previous step was wrong, this will fail;
Done :D
This method didn't work for other gems, like ffi-ncurses.
Tip: most of curses functionality comes from the Window class, which comes with curses by default.
Update: It seems like SourceForge no longer hosts NCurses binaries for Windows. This answer is effectively obsolete now. Sorry! (As of August 2015, the GNU NCurses Page lists a "new" v6.0 release, which is newer than the 0.9.1 version in my answer.)
I finally got this to work (years after I needed it ...) without Cygwin, PDCurses, or manually building the NCurses source. The instructions are available on my blog. For reference:
Download the latest NCurses binaries (0.9.1) from SourceForge.
Unzip the files somewhere on your machine.
Find out where Ruby searches for libraries by running ruby -e 'puts $:'
Copy and paste ncurses.so and lib\ncurses.rb from the NCurses directory into the directory you picked. Place them both in the root directory.
Run your NCurses-enabled app.
It works. Without PDCurses!
When gem installed needs for curses lib; so at first you need to install NCurses
with your msys2
https://sourceforge.net/p/mingw-w64/wiki2/NCurses/
Download NCurses (v5.9 at the time of writing): http://ftp.gnu.org/pub/gnu/ncurses/
in the source directory
Then untar and in the MSYS shell:
./configure --host=x86_64-w64-mingw32 --enable-term-driver --enable-sp-funcs --prefix=/some/prefix
make
make check
make install
then as mentioned in the link :
https://github.com/ruby/curses/issues/13
use --platform=ruby ,--with-curses-include ,--with-curses-lib flags with gem install
As of February 2020 (and possibly earlier) you can install the ncurses lib with
gem install curses
It works without any problems, at least on Ruby 2.6.5
The ruby ncurses gem requires that ncurses in installed on the machine. As far as I know ncurses has not been ported to windows. So I don't think you are going to get this to work.
There may be other ways to find out how wide the screen is on windows but I can't help you with that.
I've successfully downloaded ncurses 0.9.1 binaries from sourceforge, so the library is still available.
I then tried with both native Ruby and IronRuby 1.1.3
placing the two files (ncurses.so ncurses.rb) in
C:\Ruby\Ruby193\lib\ruby\1.9.1
gives an error with native Ruby
The specified module could not be found. - C:/Ruby/Ruby193/lib/ruby/1.9.1/ncurses.so (LoadError)
Placing them here (for IronRuby)
C:\Program Files (x86)\IronRuby 1.1\Lib\ruby\1.9.1
gives
The module was expected to contain an assembly manifest. (Exception from HRESULT: 0x80131018)

Not able to install watir gem

I installed ruby186-27_rc2 and i am getting the same error as described in the Ruby: Cannot Install Watir Gem On Windows thread when i try to install watir using gem install watir. Please see the error below.
C:\DevKit>gem install watir
Building native extensions. This could take a while...
ERROR: Error installing watir:
ERROR: Failed to build gem native extension.
C:/Ruby/bin/ruby.exe extconf.rb
checking for strncpy_s()... no
creating Makefile.....
And then tried to install the devkit as suggested in the thread mentioned above. During the devkit installation i came up with a problem.
In step4 of devkit installation as described at Development Kit wiki i have added the path C:\Ruby to the config file and then ran the command ruby dk.rb install and i got the following error. Please help! Waiting for your inputs. Thanks!
C:/Ruby/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 15, col -1: `'
(ArgumentError)
from C:/Ruby/lib/ruby/1.8/yaml.rb:133:in `load'
from dk.rb:151:in `review'
from dk.rb:143:in `open'
from dk.rb:143:in `review'
from dk.rb:248:in `send'
from dk.rb:248:in `run'
from dk.rb:262
The DevKit contains a development environment for the MinGW port of MRI and YARV. You are using the MSVC6 port of MRI, so you need to install a development environment for MSVC6.
Unfortunately, there is no ready-made DevKit-like package for that. You will have to install it on your own. Note that it's not actually that hard to install, the biggest problem is to get a hold of a copy of Microsoft Visual C 6.0, since that hasn't been on sale for about 10 years now. You'll basically have to find someone who is going to sell you a used copy.
May I ask why you need to use a port of Ruby that hasn't been maintained in over 2 years, contains a version of Ruby that is so old that it cannot even run most modern code (e.g. Rails requires at least 1.8.7 or 1.9.2) and has several bugs, including security holes? Why don't you just use the MinGW port which is actually maintained?
This is all independent of the actual problem, of course, which is that you have a syntax error in your config.yml: you missed a dash and a space on line 15, which should read
- C:/Ruby
as indicated in the example section directly above it.

Rake failing to start

I'm having trouble understanding the following error with Ruby's Rake.
C:\>gem install rake
Successfully installed rake-0.8.7
1 gem installed
Installing ri documentation for rake-0.8.7...
Installing RDoc documentation for rake-0.8.7...
C:\>rake
C:/Ruby192/lib/ruby/1.9.1/rubygems.rb:340:in `bin_path': can't find executable r
ake for rake-0.8.7 (Gem::Exception)
from C:/Ruby192/bin/rake:19:in `<main>'
Running Ruby 1.9.2 for Windows.
Edit: Installing from source yields:
C:\Documents and Settings\XPherior\Desktop\rake-0.8.7\rake-0.8.7>ruby install.rb
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load --
ftools (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from install.rb:3:in `<main>'
The second error, where you have installed into C:\Documenets And Settings\ is occurring because you cannot install ruby into a folder with a space in the path. It should be installed into c:\Ruby\ c:\Ruby#.#.#\ if you want the version # in the path, or something along those lines.
for the first error: there is a bug in the rubyinstaller.org version of ruby 1.9.2, which is causing this by running "gem install rake".
you can read about the error you're getting, here: http://redmine.ruby-lang.org/issues/show/3677
there are a couple of ways to fix this error:
re-install ruby v1.9.2 and don't run "gem install rake". rake v0.8.7 is built into the ruby v1.9.2 installation, so you don't need to re-install it.
if you do want to manually install it, you can delete the ruby.gempspec file from your ruby installation. this file is located at (rubyinstalldir)\lib\ruby\gems\1.9.1\specifications
either of these options will fix the problem for you.
i'm not sure which is "better" off-hand... it may be necessary to delete the gemspec file and reinstall rake, to support updates and new versions in the future. i'm not sure, though. we'll find out once rake is updated and we need to install a new version. or, perhaps, the issue will be fixed in the ruby installation by then, and we'll just need to update our ruby install.
I've run into your both errors.
For the first one. Try the solution post at here http://betterlogic.com/roger/2010/11/ruby-1-9-2-rake-woe/.
And for the second error, it's causes by a library update by the ruby 1.9. From the Programming Ruby 1.9, "ftools have been removed (and replaced by fileutils)." I'm not pretty sure but at least that's an explanation.

Resources