Symbol lookup error since upgrading to Ruby 2.2.0 - ruby

I got this error, since upgrading to 2.2.0, only happened when a http request sent to puma:
puma 2.10.2 (tcp://0.0.0.0:22555): symbol lookup error:
/usr/lib/ruby/gems/2.2.0/extensions/x86_64-linux/2.2.0/do_postgres-0.10.14/do_postgres/do_postgres.so:
undefined symbol: rb_thread_select
What are the cause and how to fix this?
Downgrading to 2.1.5 fixes this problem anyway.

The pg gem prior to version 0.14.1 uses the method rb_thread_select. This method was removed in Ruby 2.2. According to their history file, version 0.15.0 released in March 2013 does not use it anymore:
== v0.15.0 [2013-03-03] Michael Granger <ged#FaerieMUD.org>
[...]
Enhancements:
- Make use of rb_thread_fd_select() on Ruby 1.9 and avoid deprecated
rb_thread_select().
[...]
So you may be using an old pg gem. Upgrading this gem to at least 0.15.0 should fix your issue.

Related

Can we install C gems in ruby 2.7.0

I just upgraded by ruby to 2.7.0.
And I tried to install the ibm_db gem in windows platform. Installation works fine. When I try to use the gem(like require 'ibm_db') I get the following error
LoadError (126: The specified module could not be found. - C:/Ruby27/lib/ruby/gems/2.7.0/gems/ibm_db-5.1.0-x86-mingw32/lib/mswin32/rb2x/i386/ibm_db.so)
I have faced this type of error in ruby 2.6 also but when I have set RUBY_DLL_PATH to the ddl which the gem uses it is solved.
But in ruby 2.7 even after setting this variable I get the following error.
Can anyone please help in solving this? ( I have one more doubt:- c gems are supported in ruby 2.7)
It appears that the ibm_db gem currently does not support Ruby 2.7 yet. The newest Ruby version they support is Ruby 2.6.x.
There is a pull request at https://github.com/ibmdb/ruby-ibmdb/pull/105 which might add support for Ruby 2.7 though.
The issue is because the binary was pointed to ruby 2.6 binary. So replace it with the latest ruby 2.7 binary and then everything works fine.
Thanks,
Akhil

undefined method `execute_script' in page object gem

I have started to get this error when running my tests using the 1.2.2 version of the page object gem
Stacktrace
undefined method `execute_script' for <Selenium::WebDriver::Firefox::Bridge:0x00000003cbdba0> (NoMethodError)
/usr/lib64/ruby/gems/2.2.0/gems/page-object-1.2.2/lib/page-object/platforms/selenium_webdriver/element.rb:146:in `parent'
/usr/lib64/ruby/gems/2.2.0/gems/page-object-1.2.2/lib/page-object/platforms/selenium_webdriver/table_row.rb:30:in `find_index_by_title'
/usr/lib64/ruby/gems/2.2.0/gems/page-object-1.2.2/lib/page-object/platforms/selenium_webdriver/table_row.rb:15:in `[]'
It occurs when trying to get the value from a table using a method such as
left_table_element[rank][column]
NB. This had been previously working for over a year so I wonder if a new issue has been introduced?
Looking at the git blame it does seem like the line of code throwing the error in the element.rb might have been changed recently and maybe caused this regression?
The problem is due a change in Selenium-WebDriver. In version 3.0.0, the Remote::Bridge#executeScript method was renamed to #execute_script.
The Page-Object gem was updated in version 1.2.2 to use the new method. However, the gem dependencies were not updated to reflect the required version - ie Selenium-WebDriver v2.53.4 is still listed as the minimum requirement. It looks like this has already been fixed in the eventual Page-Object v2.0 release.
In the meantime, you can fix the issue by upgrading to Selenium-WebDriver v3 (assuming you do not want to downgrade Page-Object):
gem install selenium-webdriver
To fix this issue just need to update your page-object gem to 1.2.2 version
gem install -v 1.2.2 (for selenium-webdriver 3.x only)

Ruby 2.2.2 - Time zone reference

I just upgraded to Ruby v 2.2.2.
Now, when I start my console, I get this error:
.rvm/gems/ruby-2.2.2/gems/activesupport-4.0.2/lib/active_support/values/time_zone.rb:282: warning: circular argument reference - now
Loading development environment (Rails 4.0.2)
I don't know what it means or how to fix it. I don't have a file called time_zone.rb in my application, so I assume its something that is incorporated by reference.
Does anyone know what to do to resolve this?
I see that you are using Rails in your project. You just need to upgrade your Rails version to 4.1.9.
This issue was fixed in these commits:
fix ruby 2.2 warning: circular argument reference
use self.method syntax to resolve circular argument issues
You can upgrade the Rails version in your Gemfile or Gemfile.lock files.
Gemfile
gem "rails", "4.1.9"
Gemfile.lock
rails (4.1.9)
Be sure to run bundle after you make these changes!

"Could not find activesupport" when 3 versions installed

I'm just trying to use the simple career_builder gem and just get it imported by running the simple script:
require 'career_builder'
puts 'Hello world!'
and yet get the following error: /Library/Ruby/Site/2.0.0/rubygems/dependency.rb:315:in 'to_specs': Could not find 'activesupport' (~> 2.3.5) - did find: [activesupport-4.2.1,activesupport-3.1.12,activesupport-3.0.3] (Gem::LoadError)
I installed the gem with gem install career_builder and ran bundle install and even updated activesupport to the most recent version, but for some reason, the program can't find the newer version of activesupport. Does the gem require version 2.3.5?
http://guides.rubygems.org/patterns/
The ~>or 'twiddle-waka' is a ruby gems shortcut to specify the earliest version of the gem you can use without letting you go up to the next major release.
Your gem is being a bit unorthodox and also specifying a patch level.
So the gem_specification you're working with (activesupport' (~> 2.3.5)) really means minimum version of 2.3.5 maximum of the last patch released before 2.4.0.
The activesupport versions you have installed are all for subsequent major releases and won't work. Install something between 2.3.5 and 2.4.0 and you should be good to go.
Yes. It does require Active Support version >= 2.3.5 and < 2.4.0. All of your Active Support versions are > 2.4.0.
~> is called the spermy operator. See Meaning of tilde-greater-than (~>) in version requirement?
The gem has not been updated in 4 years, so it uses Rails 2.
FWIW, I don't think you'll have much luck getting it to work, so you may want to find a similar gem that works with Rails 4 and has been updated within the last few months.

Issues using the latest Psych with Rails 3.2.8 & ruby 1.9.3

I recently hit some JSON parse issues and discovered we are using a pretty old version of Psych and libyaml: Psych version: 1.2.2; Psych libyaml version: 0.1.4
The latest Psych has much better JSON parsing support (subset of YAML) and I verified this fixes my issues, however I'm having issues configuring our Rails app to use the latest Psych gem versus the Psych version bundled with ruby.
I simply add gem 'psych' in the gemfile and run bundle install according to the online docs.
Now when I try to run anything I hit errors:
uninitialized constant Psych::Streaming::ClassMethods (NameError)
While it makes no sense, I know whats going on here, internally Rails is using the OLD version of Psych::Streaming which doesn't have these new methods. When I debug I see it using the old dir (e.g. ~Ruby1.9.3\lib\ruby\1.9.1\psych\streaming.rb) versus the NEW lib it should be using (e.g. ~Ruby1.9.3\lib\ruby\gems\1.9.1\gems\psych-2.0.8\lib\psych\streaming.rb)
So this seems like general confusion where code in the new Psych gem is calling code from the old bundled Psych version. How do I get Rails to not use the old bundled version and use the latest Psych??
We're using an older version of Rails (3.2.8) and ruby (1.9.3-p125) and unfortunately upgrading is not an option for the project right now...
** UPDATE **
It seems like root causing this problem will be a nightmare so maybe I need a new approach. Is there a way to ONLY use the latest Psych gem in my new code, but let everything else (like the external ruby libs) continue using the old bundled version? We had no issues with the old Psych version until I started passing around & parsing more complex JSON in my new code...

Resources