Install linalg for ruby in MAC OS failed - ruby

I follow the below guideline to install the linalg for Ruby env.
http://www.quora.com/Installation-Instructions/How-do-I-install-Ruby-linalg-library-on-Mac
It works, but when I try to require the lib in 'irb', it raise the error.
Environment: Ruby:2.0.0-p0 lapack:3.5.0 (I also tried 3.4.0)
I already spend on 3 hours but didn't figure out the problem.
Here's the error, when I try to require the lib in command line.
It seems somewhere use 18 as parameter which exceed the max value as -2..15.
2.0.0-p0 :002 > require 'linalg'
ArgumentError: arity out of range: 18 for -2..15
from /Users/xxx/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Users/xxx/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Users/xxx/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/linalg.rb:7:in `<top (required)>'
from /Users/xxx/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Users/xxx/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from (irb):2
from /Users/xxx/.rvm/rubies/ruby-2.0.0-p0/bin/irb:16:in `<main>'

I did fork and fixed compile for ruby 2/2.1.
You can try this fork: https://github.com/parallel588/linalg

Related

Why is Ruby throwing a syntax error whenever I use the gem command?

This is the first time I've attempted to work with Ruby. I wanted to install sass so I updated gem and attempt to install sass but was thrown an error. I then realized that the syntax error was raised whenever I ran gem - I can't figure out what could be causing this and all other similar cases happen to people in their code, not when they just run the command.
I haven't touched the source code or even used the gem command up to this point. The error is a syntaxerror, specifically:
$ gem
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': /Library/Ruby/Gems/2.0.0/gems/psych-3.0.0/lib/psych/scalar_scanner.rb:146: syntax error, unexpected tIDENTIFIER, expecting ')' (SyntaxError)
klass.new(yy, m, dd, hh, mm, ss+us/(1_000_000r), offset)
^
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/2.0.0/gems/psych-3.0.0/lib/psych/nodes/node.rb:4:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/2.0.0/gems/psych-3.0.0/lib/psych/nodes.rb:2:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/2.0.0/gems/psych-3.0.0/lib/psych.rb:14:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems.rb:585:in `load_yaml'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/config_file.rb:314:in `load_file'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/config_file.rb:191:in `initialize'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/gem_runner.rb:66:in `new'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/gem_runner.rb:66:in `do_configuration'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/gem_runner.rb:46:in `run'
from /usr/bin/gem:21:in `<main>'
This is a known bug in the gemspec of Psych 3.0.0, which lists the required Ruby version as >= 1.9.2, even though Psych 3.0.0 actually requires Ruby 2.2.2 (the specific syntax that causes the error in your case was introduced in Ruby 2.1):
s.required_ruby_version = Gem::Requirement.new(">= 1.9.2")
The problem has been fixed in the repository, but there has not yet been a release incorporating that fix.
The necessary steps to fix your problem are mentioned in the bug report, basically you need to delete the b0rked Psych 3.0.0 gem directory manually, then you can uninstall Psych 3.0.0, and after that, you need to ensure that you don't install 3.0.0 again:
FYI, for anyone landing on the issue as described in the first post, where even the gem command won't even work:
You must rm -rf psych 3.0.0's gem directory. (after that, the gem command should work)
Then you can do gem uninstall psych -v 3.0.0.
Then, until version 3.0.0 gets fixed, you must add gem 'psych', '< 3.0.0' to your Gemfile.
You might have to run bundle update for it to accept your change of psych's version.

How do I fix a ffi_c (LoadError) given by line 127 of kernel_require.rb (I'm using Ruby 2.3 on Windows 10)

Whenever I try to run my Ruby program I get this error:
C:/Ruby23-x64/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in require': cannot load such file -- ffi_c (LoadError)
from C:/Ruby23-x64/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:inrescue in require'
from C:/Ruby23-x64/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in require'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/ffi-1.9.10-x64-mingw32/lib/ffi.rb:6:inrescue in '
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/ffi-1.9.10-x64-mingw32/lib/ffi.rb:3:in <top (required)>'
from C:/Ruby23-x64/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:inrequire'
from C:/Ruby23-x64/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:in require'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rest-client-1.8.0-x64-mingw32/lib/restclient/windows/root_certs.rb:2:in'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rest-client-1.8.0-x64-mingw32/lib/restclient/windows.rb:7:in require_relative'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rest-client-1.8.0-x64-mingw32/lib/restclient/windows.rb:7:in'
from C:/Ruby23-x64/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:in require'
from C:/Ruby23-x64/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:inrequire'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rest-client-1.8.0-x64-mingw32/lib/restclient.rb:16:in <top (required)>'
from C:/Ruby23-x64/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:inrequire'
from C:/Ruby23-x64/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:in require'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rest-client-1.8.0-x64-mingw32/lib/rest_client.rb:2:in'
from C:/Ruby23-x64/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in require'
from C:/Ruby23-x64/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:inrescue in require'
from C:/Ruby23-x64/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from form_response_transfer.rb:3:in [main method]
The program (form_response_transfer.rb) used to work fine, but now, there seems to be some problem with my rest-client gem. I haven't changed any of the code in the program since it last worked, so I'm not sure exactly what I did to cause this error. In general, gems that end with X64-mingw32 have been giving me problems lately (some other examples include nokogiri, sqlite3, and pg). How should I go about trying to fix this error? Could there be some problem with how Ruby is set up on my computer?
Try to uninstall FFI gem
gem uninstall ffi
and then reinstall it with below command:
gem install ffi --platform=ruby
It worked on my side (Win7 x64)

time_zone.rb:270: warning: circular argument reference - now

I'm using Ruby on Rails, and I installed all the necessary applications and updates for gems. I already exhausted/researched most of all possible answer for this error and tried all of it, but still am having no luck.
/Users/u=Username/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activesupport-3.2.13/lib/active_support/values/time_zone.rb:270: warning: circular argument reference - now
/Users/Username/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.8.5/lib/bundler/runtime.rb:76:in `require': cannot load such file -- false (LoadError)
from /Users/Username/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.8.5/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /Users/Username/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.8.5/lib/bundler/runtime.rb:72:in `each'
from /Users/Username/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.8.5/lib/bundler/runtime.rb:72:in `block in require'
from /Users/Username/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.8.5/lib/bundler/runtime.rb:61:in `each'
from /Users/Username/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.8.5/lib/bundler/runtime.rb:61:in `require'
from /Users/Username/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.8.5/lib/bundler.rb:134:in `require'
from /Users/Username/Downloads/job4quote/config/application.rb:7:in `'
from /Users/Username/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-3.2.13/lib/rails/commands.rb:53:in `require'
from /Users/Username/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-3.2.13/lib/rails/commands.rb:53:in `block in '
from /Users/Username/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap'
from /Users/Username/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-3.2.13/lib/rails/commands.rb:50:in `'
from script/rails:6:in `require'
from script/rails:6:in `'
Is there a way to access these .rb files to make necessary changes?
As shown here -> warning: circular argument reference
The problem seems to be caused by the higher version of ruby (In my case rails 3.2.13 and ruby 2.2) and using an older version of rails. One solution in which worked for me was to use ruby 2.0 and to update my gem file (RVM Capistrano).
gem 'rvm-capistrano', require: false
run the bundle install command. After that everything worked as expected.
silly of me, you can access the file by browsing it thru terminal
$ open .rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activesupport-3.2.13/lib/active_support/values
and made changes on that file as shown on the link about.
Sorry new with ruby.

Ruby - kernel_require.rb:54 in 'require': Cannot load such file (from GitHub repository)

I cloned a GitHub directory because I wanted to help on an open-source project.
The link to the project is listed below, so feel free to try it out for yourself.
https://github.com/tupini07/RubyMan
According to the README, I did the following
git clone https://github.com/tupini07/RubyMan
cd projects/RubyMan
ruby main.rb
Edit
I solved the first issue by running gem install win32console, but I still run into the same problem.
Error Message
C:\Users\darkmouse\Documents\Projects\RubyMan>ruby main.rb
C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in
`require': cannot load such file -- 2.0/Console_ext (LoadError)
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/win32console-1.3.2-x86-mingw32/
lib/Win32/Console.rb:12:in `rescue in <top (required)>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/win32console-1.3.2-x86-mingw32/
lib/Win32/Console.rb:8:in `<top (required)>'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/win32console-1.3.2-x86-mingw32/
lib/Win32/Console/ANSI.rb:13:in `<top (required)>'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/win32console-1.3.2-x86-mingw32/
lib/win32console.rb:1:in `<top (required)>'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:128:in `require'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:39:in `require'
from C:/Users/darkmouse/Documents/Projects/RubyMan/Board.rb:2:in `<top (required)>'
from main.rb:4:in `require_relative'
from main.rb:4:in `<main>'
Main.rb
3 require_relative 'player'
4 require_relative 'Board'
5 require_relative 'LoadLevel'
Board.rb
2 require 'win32console'
The issues are listed above.
I run a Windows 8 Operating System.
I'd prefer not to bombard the repository with issues, so I decided to ask here.
I forked this same GitHub project, RubyMan, and cloned it on Ubuntu 14.04 LTS. I installed the current stable release of Ruby 2.2.2. I ran into almost the same problem as above when I changed to the RubyMan folder and ran:
ruby Main.rb
Here is the stack trace:
/usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- colorize (LoadError)
from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/ashok/RubyMan/Board.rb:1:in `<top (required)>'
from Main.rb:3:in `require_relative'
from Main.rb:3:in `block in <main>'
from Main.rb:3:in `each'
from Main.rb:3:in `<main>'
Others who ran into a similar problem suggested on GitHub to:
sudo gem install colorize
Result:
Successfully installed colorize-0.7.7
Unfortunately, the above problem didn't go away :( I tried many other suggestions. No luck.
However, these two steps resolved the problem:
Step 1:
sudo gem update --system
Result:
RubyGems system software updated
I understand that this updates all installed gems to their latest versions.
Step 2:
sudo gem install colorize
Result:
Successfully installed colorize-0.7.7
Now I am able to launch the RubyMan program by running:
ruby Main.rb
Result:
What size will the board be?
And when I enter a number, it displays the 2D RubyMan game ready to play!

Ruby version errors / crack/xml in irb

Because of a bug with Float#round in Ruby 1.8.6, I was forced to upgrade to 1.9.3 and boy was that awful. After install, irb didn't work, complaining of a lack of psych. So I tried to install the gem, but it was angry that libyaml didn't exist, so I installed that. Not sure why they weren't included if they were so important.
Now when I use require 'Location.rb' (after having to specify that I actually do want to look in the current folder... using $LOAD_PATH), I get this error:
LoadError: cannot load such file -- crack/xml
from /usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/ap-0.1.1/lib/ap.rb:2:in `<top (required)>'
from /usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `require'
from /usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
from /usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from /Users/tyre77/Dropbox/Aurora/GMap.rb:4:in `<top (required)>'
from /usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from (irb):3
from /usr/local/bin/irb:12:in `<main>'
What does this mean? Also, when I execute ruby -v, it lists my version as 1.9.3p0 but this is dicking around in 1.9.1? All I want is my irb back and working!
It turned out that Ruby was looking for an XML parser called 'crack'. I don't know why it is referencing 2 versions of Ruby or why these dependencies aren't included in the Ruby build (since irb won't work without them) but to fix I installed the crack gem. sudo gem install crack
you can use
require_relative 'Location.rb'
or
require './Location.rb'

Resources