Rails pg gem不兼容的库版本

时间:2021-10-13 07:00:15

I'm getting the following 'incompatible library version' error when I try and access my Ruby on Rails website in development mode.

当我尝试在开发模式下访问我的Ruby on Rails网站时,我收到以下“不兼容的库版本”错误。

incompatible library version - /var/www/vhosts/launch.site.com/httpdocs/vendor/bundle/ruby/2.2.0/gems/pg-0.18.4/lib/pg_ext.so (LoadError)
  /var/www/vhosts/launch.site.com/httpdocs/vendor/bundle/ruby/2.2.0/gems/pg-0.18.4/lib/pg.rb:4:in `require'
  /var/www/vhosts/launch.site.com/httpdocs/vendor/bundle/ruby/2.2.0/gems/pg-0.18.4/lib/pg.rb:4:in `<top (required)>'
  /usr/local/rvm/gems/ruby-2.2.3/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require'
  /usr/local/rvm/gems/ruby-2.2.3/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
  /usr/local/rvm/gems/ruby-2.2.3/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each'
  /usr/local/rvm/gems/ruby-2.2.3/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require'
  /usr/local/rvm/gems/ruby-2.2.3/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each'
  /usr/local/rvm/gems/ruby-2.2.3/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require'
  /usr/local/rvm/gems/ruby-2.2.3/gems/bundler-1.10.6/lib/bundler.rb:134:in `require'
  /var/www/vhosts/launch.site.com/httpdocs/config/application.rb:7:in `<top (required)>'
  /var/www/vhosts/launch.site.com/httpdocs/config/environment.rb:2:in `require'
  /var/www/vhosts/launch.site.com/httpdocs/config/environment.rb:2:in `<top (required)>'
  config.ru:3:in `require'
  config.ru:3:in `block in <main>'
  /var/www/vhosts/launch.site.com/httpdocs/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
  /var/www/vhosts/launch.site.com/httpdocs/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
  config.ru:1:in `new'
  config.ru:1:in `<main>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:110:in `eval'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:110:in `preload_app'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:156:in `<module:App>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'

I've looked at what libraries pg_ext.so is trying to access and using ldd and here's the output:

我已经看过pg_ext.so尝试访问和使用ldd的库,这里是输出:

$ ldd pg-0.18.4/lib/pg_ext.so
    linux-vdso.so.1 =>  (0x00007ffc14a7c000)
    libruby.so.1.8 => /usr/lib64/libruby.so.1.8 (0x00007fe98291a000)
    libpq.so.5 => /usr/lib64/libpq.so.5 (0x00007fe9826f1000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fe9824cb000)
    librt.so.1 => /lib64/librt.so.1 (0x00007fe9822c3000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007fe9820be000)
    libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007fe981e87000)
    libm.so.6 => /lib64/libm.so.6 (0x00007fe981c03000)
    libc.so.6 => /lib64/libc.so.6 (0x00007fe98186e000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fe981658000)
    libssl.so.10 => /usr/lib64/libssl.so.10 (0x00007fe9813ec000)
    libcrypto.so.10 => /usr/lib64/libcrypto.so.10 (0x00007fe981008000)
    libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007fe980dc4000)
    libldap_r-2.4.so.2 => /usr/lib64/libldap_r-2.4.so.2 (0x00007fe980b6c000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fe982e47000)
    libfreebl3.so => /usr/lib64/libfreebl3.so (0x00007fe980968000)
    libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007fe980681000)
    libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007fe98047d000)
    libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007fe980250000)
    libz.so.1 => /lib64/libz.so.1 (0x00007fe98003a000)
    libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007fe97fe2f000)
    libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007fe97fc2b000)
    libresolv.so.2 => /lib64/libresolv.so.2 (0x00007fe97fa11000)
    liblber-2.4.so.2 => /usr/lib64/liblber-2.4.so.2 (0x00007fe97f802000)
    libsasl2.so.2 => /usr/lib64/libsasl2.so.2 (0x00007fe97f5e7000)
    libssl3.so => /usr/lib64/libssl3.so (0x00007fe97f3a7000)
    libsmime3.so => /usr/lib64/libsmime3.so (0x00007fe97f17b000)
    libnss3.so => /usr/lib64/libnss3.so (0x00007fe97ee3b000)
    libnssutil3.so => /usr/lib64/libnssutil3.so (0x00007fe97ec0f000)
    libplds4.so => /lib64/libplds4.so (0x00007fe97ea0b000)
    libplc4.so => /lib64/libplc4.so (0x00007fe97e805000)
    libnspr4.so => /lib64/libnspr4.so (0x00007fe97e5c7000)
    libselinux.so.1 => /lib64/libselinux.so.1 (0x00007fe97e3a7000)

I've tried updating PostgreSQL using yum update, then gem uninstall pg and gem install pg. But I continue to get the same problem. The gem itself installs without any errors.

我尝试使用yum update更新PostgreSQL,然后使用gem uninstall pg和gem install pg。但我继续得到同样的问题。 gem本身安装没有任何错误。

I'm not really sure how to debug further. What do I need to do to install, update or reference the necessary compatible libraries?

我不确定如何进一步调试。如何安装,更新或引用必要的兼容库需要做什么?

The server is running:

服务器正在运行:

  • CentOS 6.7
  • psql (PostgreSQL) 8.4.20
  • psql(PostgreSQL)8.4.20

  • ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]
  • ruby 2.2.3p173(2015-08-18修订版51636)[x86_64-linux]

  • rails 4.2.4
  • pg gem 0.18.4
  • pg宝石0.18.4

Thanks

4 个解决方案

#1


8  

Try:

$ gem install pg
$ gem pristine --all

#2


2  

It looks as if you might be suffering from this bug: https://bitbucket.org/ged/ruby-pg/issues/229/pg_exit-improperly-linked-when-using-rvm

看起来你可能正在遭受这个错误:https://bitbucket.org/ged/ruby-pg/issues/229/pg_exit-improperly-linked-when-using-rvm

The libruby version should be different, apparently.

libruby版本应该是不同的,显然。

However: I have the same error message, and my libruby is correct, so I think that there might be more going on...

但是:我有相同的错误消息,我的libruby是正确的,所以我认为可能会有更多...

#3


1  

I get the same error when I call in console rails c. Calling bundle exec rails c removed that error.

当我在控制台导轨c中调用时,我得到了同样的错误。调用bundle exec rails c删除了该错误。

#4


0  

After looking at the discussion on https://bitbucket.org/ged/ruby-pg/issues/229/pg_ext-improperly-linked-when-using-rvm, the only way I've managed to make it work on Arch Linux was removing the system-wide ruby, then I did gem uninstall pg followed by gem install pg --version 0.18.3. This made the issue go away. I reinstalled the system-wide ruby after that. On my setup I had no packaged depending on the system-wide ruby, so it was okay to remove it, but YMMV.

在查看https://bitbucket.org/ged/ruby-pg/issues/229/pg_ext-improperly-linked-when-using-rvm上的讨论后,我设法使其在Arch Linux上运行的唯一方法正在删除系统级的ruby,然后我做了gem uninstall pg,然后是gem install pg --version 0.18.3。这使问题消失了。之后我重新安装了系统范围的ruby。在我的设置上,我没有打包取决于系统范围的红宝石,所以可以删除它,但是YMMV。

#1


8  

Try:

$ gem install pg
$ gem pristine --all

#2


2  

It looks as if you might be suffering from this bug: https://bitbucket.org/ged/ruby-pg/issues/229/pg_exit-improperly-linked-when-using-rvm

看起来你可能正在遭受这个错误:https://bitbucket.org/ged/ruby-pg/issues/229/pg_exit-improperly-linked-when-using-rvm

The libruby version should be different, apparently.

libruby版本应该是不同的,显然。

However: I have the same error message, and my libruby is correct, so I think that there might be more going on...

但是:我有相同的错误消息,我的libruby是正确的,所以我认为可能会有更多...

#3


1  

I get the same error when I call in console rails c. Calling bundle exec rails c removed that error.

当我在控制台导轨c中调用时,我得到了同样的错误。调用bundle exec rails c删除了该错误。

#4


0  

After looking at the discussion on https://bitbucket.org/ged/ruby-pg/issues/229/pg_ext-improperly-linked-when-using-rvm, the only way I've managed to make it work on Arch Linux was removing the system-wide ruby, then I did gem uninstall pg followed by gem install pg --version 0.18.3. This made the issue go away. I reinstalled the system-wide ruby after that. On my setup I had no packaged depending on the system-wide ruby, so it was okay to remove it, but YMMV.

在查看https://bitbucket.org/ged/ruby-pg/issues/229/pg_ext-improperly-linked-when-using-rvm上的讨论后,我设法使其在Arch Linux上运行的唯一方法正在删除系统级的ruby,然后我做了gem uninstall pg,然后是gem install pg --version 0.18.3。这使问题消失了。之后我重新安装了系统范围的ruby。在我的设置上,我没有打包取决于系统范围的红宝石,所以可以删除它,但是YMMV。