我无法在运行Ruby7的亚马逊EC2服务器上安装Ruby。我有理由相信我的pg安装(2.7.0)、gemset、CentOS等都没有问题。并且我收到下面的错误消息。我已经按照此处类似问题中的建议安装了postgresql、postgresql-devel、postgresql-libs和postgresql-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发布于 2020-07-16 03:13:10
我从Max's reply那里找到了答案。
问题出在ld,而不是postgres。我的ld版本(ld -v )已经过时了,我做了一个完整的系统升级(sudo yum upgrade),升级了GNU的binutils ( ld是其中的一部分),现在我可以顺利地安装pg了。
发布于 2021-08-30 07:10:00
这个链接here包含对我有效的命令。具体地说,这几行-->
[ -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-rhhttps://stackoverflow.com/questions/62902479
复制相似问题