繁体   English   中英

无法在 CentOS 7 VM 上安装“pg”gem

[英]Unable to install `pg` gem on CentOS 7 VM

我无法在运行 CentOS 7 的 AWS EC2 服务器上安装pg gem。我有理由相信我的 Ruby 安装 (2.7.0)、gemset、RVM 等没有问题。并且正在收到错误消息以下。 我已经按照此处类似问题中的建议安装了postgresqlpostgresql-develpostgresql-libspostgresql-server Postgres 是 9.2.24,应该与pg gem 兼容。

我还尝试指定pg_conf文件并使用命令gem install pg -- --with-pg-config=/usr/bin/pg_config并收到相同的错误。

我过去尝试在 Mac 和其他 Linux 系统上安装pg时遇到过问题,但这个错误对我来说是新的。 我正用头撞墙。

current directory: /home/MY_USERNAME/.rvm/gems/ruby-2.7.0@GEMSET_NAME/gems/pg-1.2.3/ext
/home/MY_USERNAME/.rvm/rubies/ruby-2.7.0/bin/ruby -I /home/MY_USERNAME/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0 -r ./siteconf20200714-11146-p34b9c.rb 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 PQsetSingleRowMode()... yes
checking for PQconninfo()... no
checking for PQsslAttribute()... no
checking for PQresultVerboseErrorMessage()... no
checking for PQencryptPasswordConn()... no
checking for PQresultMemorySize()... no
checking for timegm()... yes
checking for rb_gc_adjust_memory_usage()... yes
checking for unistd.h... yes
checking for inttypes.h... yes
checking for C99 variable length arrays... yes
creating extconf.h
creating Makefile

current directory: /home/MY_USERNAME/.rvm/gems/ruby-2.7.0@GEMSET_NAME/gems/pg-1.2.3/ext
make "DESTDIR=" clean

current directory: /home/MY_USERNAME/.rvm/gems/ruby-2.7.0@GEMSET_NAME/gems/pg-1.2.3/ext
make "DESTDIR="
compiling gvl_wrappers.c
compiling pg.c
compiling pg_binary_decoder.c
compiling pg_binary_encoder.c
compiling pg_coder.c
compiling pg_connection.c
compiling pg_copy_coder.c
compiling pg_errors.c
compiling pg_record_coder.c
compiling pg_result.c
compiling pg_text_decoder.c
compiling pg_text_encoder.c
compiling pg_tuple.c
compiling pg_type_map.c
compiling pg_type_map_all_strings.c
compiling pg_type_map_by_class.c
compiling pg_type_map_by_column.c
compiling pg_type_map_by_mri_type.c
compiling pg_type_map_by_oid.c
compiling pg_type_map_in_ruby.c
compiling pg_util.c
linking shared-object pg_ext.so
/usr/bin/ld: unrecognized option '--compress-debug-sections=zlib'
/usr/bin/ld: use the --help option for usage information
collect2: error: ld returned 1 exit status
make: *** [pg_ext.so] Error 1

make failed, exit code 2

我从Max 的回复中找到了答案。

问题出在ld上,而不是 postgres 上。 我的ld版本( ld -v已经过时了,我做了一个完整的系统升级( sudo yum upgrade ),它升级了 GNU 的binutils (其中ld是其中的一部分),现在我可以毫无问题地安装pg了。

此处的此链接包含对我有用的命令。 特别是这些行-->

[ -f `/usr/pgsql-12/bin/pg_config --includedir`/libpq-fe.h ] && echo "devel installed" || echo "devel missing"
# scl-rh for llvm-toolset-7-clang 4.0.1
yum -y install centos-release-scl-rh 
yum-config-manager --disable centos-sclo-rh
yum -y install postgresql12-devel --enablerepo=centos-sclo-rh

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM