pg_ext.so:未定义符号:rb_thread_select [英] pg_ext.so: undefined symbol: rb_thread_select
问题描述
bash-4.2# rake db:create
/opt/rubystack-2.3.1-0/ruby/bin/.ruby.bin: symbol lookup error: /opt/rubystack-2.3.1-0/ruby/lib/ruby/gems/2.3.0/gems/pg-0.18.4/lib/pg_ext.so: undefined symbol: rb_thread_select
bash-4.2# ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
bash-4.2# rails -v
Rails 4.2.6
bash-4.2# gem list pg
*** LOCAL GEMS ***
pg (0.18.4, 0.15.1)
出什么问题了?这是bitnami的红宝石堆栈.
what's the problem? it's bitnami's ruby stack.
注意::这不是pg版本的错误吗?请检查我的日志! Ruby版本2.3.1,pg
版本0.18.4.
NOTE: It's NOT pg version's bug? Please check my log! Ruby version 2.3.1, pg
version 0.18.4.
推荐答案
自Ruby 1.9.3 起,不推荐使用rb_thread_select
函数.从Ruby 2.2 开始,它已由rb_thread_fd_select
函数取代:
The rb_thread_select
function has been deprecated since Ruby 1.9.3. It was replaced by the rb_thread_fd_select
function as of Ruby 2.2:
VA VD VR
old 193 22 rb_thread_select -> rb_thread_fd_select
但是,pg
宝石自从使用正确的函数版本 0.15 .这是 pg_connection.c
@ e5cb1df 的相关部分:
However, the pg
gem has been using the correct function since version 0.15. Here's the relevant section of pg_connection.c
@ e5cb1df:
#ifndef HAVE_RB_THREAD_FD_SELECT
#define rb_fdset_t fd_set
#define rb_fd_init(f)
#define rb_fd_zero(f) FD_ZERO(f)
#define rb_fd_set(n, f) FD_SET(n, f)
#define rb_fd_term(f)
#define rb_thread_fd_select rb_thread_select
#endif
这些指令在编译时进行评估,因此C扩展的共享库必须编译不正确.
These directives are evaluated at compile time, so the C extension's shared object must have been compiled incorrectly.
在构建pg_ext.so
时,必须未定义HAVE_RB_THREAD_FD_SELECT
宏.这可能是因为:
The HAVE_RB_THREAD_FD_SELECT
macro must not have been defined when pg_ext.so
was built. This could have happened because:
- 它是针对没有
rb_thread_fd_select
的Ruby构建的
- 在构建过程中配置不正确
- It was built against a Ruby that did not have
rb_thread_fd_select
- It was incorrectly configured during the build process
参考:
- 删除不推荐使用的定义
- CAPI过时的定义
- 在Ruby 1.9上使用
rb_thread_fd_select()
以避免对rb_thread_select()
的弃用警告 - ruby-pg/ext/pg_connection.c
- Remove deprecated definitions
- CAPI obsolete definitions
- Make use of
rb_thread_fd_select()
on Ruby 1.9, to avoid deprecation warnings onrb_thread_select()
. - ruby-pg/ext/pg_connection.c
这篇关于pg_ext.so:未定义符号:rb_thread_select的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!