当尝试使用命令gem install pg安装ruby gem pg时,我收到以下错误消息:

构建原生扩展 . 这可能需要一段时间:

Gem文件将保留在/usr/lib/ruby/gems/1.8/gems/pg-0.18.0中以供检查 . 结果记录到/usr/lib/ruby/gems/0.18.0/ext/gem_make.out

我有红宝石1.8.7跑 . 我安装了yum install postgresql-devel .

谢谢您的帮助 .

gem.make.out包含以下内容:

/usr/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... yes
checking for PQconnectionUsedPassword()... yes
checking for PQisthreadsafe()... yes
checking for PQprepare()... yes
checking for PQexecParams()... yes
checking for PQescapeString()... yes
checking for PQescapeStringConn()... yes
checking for PQescapeLiteral()... no
checking for PQescapeIdentifier()... no
checking for PQgetCancel()... yes
checking for lo_create()... yes
checking for pg_encoding_to_char()... yes
checking for pg_char_to_encoding()... yes
checking for PQsetClientEncoding()... yes
checking for PQlibVersion()... no
checking for PQping()... no
checking for PQsetSingleRowMode()... no
checking for PQconninfo()... no
checking for PQhostaddr()... no
checking for rb_encdb_alias()... no
checking for rb_enc_alias()... no
checking for rb_thread_call_without_gvl()... no
checking for rb_thread_call_with_gvl()... no
checking for rb_thread_fd_select()... no
checking for rb_w32_wrap_io_handle()... no
checking for rb_str_modify_expand()... no
checking for rb_hash_dup()... no
checking for PGRES_COPY_BOTH in libpq-fe.h... no
checking for PGRES_SINGLE_TUPLE in libpq-fe.h... no
checking for PG_DIAG_TABLE_NAME in libpq-fe.h... no
checking for struct pgNotify.extra in libpq-fe.h... yes
checking for unistd.h... yes
checking for ruby/st.h... no
checking for st.h... yes
creating extconf.h
creating Makefile

make
gcc -I. -I. -I/usr/lib64/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/include    -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing  -fPIC   -c pg_type_map_by_class.c
pg_type_map_by_class.c: In function ‘pg_tmbk_lookup_klass’:
pg_type_map_by_class.c:68: warning: implicit declaration of function ‘RB_TYPE_P’

gcc -I. -I. -I/usr/lib64/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/include    -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing  -fPIC   -c pg_result.c
pg_result.c:428: warning: ‘pgresult_ntuples_for_enum’ defined but not used

gcc -I. -I. -I/usr/lib64/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/include    -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing  -fPIC   -c pg_type_map.c

gcc -I. -I. -I/usr/lib64/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/include    -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing  -fPIC   -c pg_type_map_by_column.c
pg_type_map_by_column.c: In function ‘pg_tmbc_result_value’:
pg_type_map_by_column.c:102: warning: implicit declaration of function ‘ENCODING_GET’

gcc -I. -I. -I/usr/lib64/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/include    -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing  -fPIC   -c pg_copy_coder.c
pg_copy_coder.c: In function ‘pg_copycoder_encoder_allocate’:
pg_copy_coder.c:38: warning: implicit declaration of function ‘rb_str_new_cstr’
gcc -I. -I. -I/usr/lib64/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/include    -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing  -fPIC   -c util.c

gcc -I. -I. -I/usr/lib64/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/include    -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing  -fPIC   -c pg_binary_encoder.c
pg_binary_encoder.c: In function ‘pg_bin_enc_from_base64’:
pg_binary_encoder.c:122: warning: implicit declaration of function ‘RSTRING_LENINT’

gcc -I. -I. -I/usr/lib64/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/include    -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing  -fPIC   -c pg_type_map_by_mri_type.c
pg_type_map_by_mri_type.c: In function ‘pg_tmbmt_typecast_query_param’:
pg_type_map_by_mri_type.c:61: error: ‘T_COMPLEX’ undeclared (first use in this function)
pg_type_map_by_mri_type.c:61: error: (Each undeclared identifier is reported only once
pg_type_map_by_mri_type.c:61: error: for each function it appears in.)
pg_type_map_by_mri_type.c:61: error: ‘T_RATIONAL’ undeclared (first use in this function)
pg_type_map_by_mri_type.c: In function ‘pg_tmbmt_aset’:
pg_type_map_by_mri_type.c:197: warning: implicit declaration of function ‘RB_TYPE_P’
make: *** [pg_type_map_by_mri_type.o] Error 1