麻烦安装pg gem

编程入门 行业动态 更新时间:2024-10-28 06:24:47
本文介绍了麻烦安装pg gem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 尝试安装pg gem会给我带来错误。

我使用的是使用rbenv / ruby​​-build构建的Ruby 1.9.3-p125。我使用一键式安装程序安装了PostgreSQL。我可以使用pgAdmin连接到数据库。

%gem install pg〜构建原生扩展。这可能需要一段时间... 错误:安装pg时出错:错误:无法构建gem本机扩展。 /Users/sandropadin/.rbenv/versions/1.9.3-p125/bin/ruby extconf.rb 检查pg_config ...是使用来自/ usr / bin / pg_config 检查libpq-fe.h ...是检查libpq / libpq-fs.h ...是检查pg_config_manual.h ...是在-lpq中检查PQconnectdb()...是检查PQconnectionUsedPassword()...是检查PQisthreadsafe()...是检查PQprepare() )...是检查PQexecParams()...是检查PQescapeString()...是检查PQescapeStringConn()...是检查PQgetCancel()...是检查lo_create()...是检查pg_encoding_to_char()...是检查pg_char_to_encoding()...是检查PQsetClientEncoding()...是检查rb_encdb_alias()...是检查rb_enc_alias()...是检查libpq-fe中的struct pgNotify.extra。 h ...是检查unistd.h ...是 chec king for ruby​​ / st.h ...是创建extconf.h 创建Makefile $ b $ make make 编译pg.c 编译pg_connection.c pg_connection.c:函数'pgconn_wait_for_notify': pg_connection.c:1986:警告:'rb_thread_select'已被弃用(在/Users/sandropadin/.rbenv/versions/1.9.3-p125/处声明) include / ruby​​-1.9.1 / ruby​​ / intern.h:379) pg_connection.c:函数'pgconn_block': pg_connection.c:2512:警告:'rb_thread_select'已弃用/Users/sandropadin/.rbenv/versions/1.9.3-p125/include/ruby-1.9.1/ruby/intern.h:379)编译pg_result.c 链接共享对象pg_ext。 bundle ld:在/usr/local/lib/libssl.0.9.8.dylib中,缺少架构x86_64所需的体系结构x86_64文件 collect2:ld返回1退出状态 make:* ** [pg_ext.bundle]错误1 Gem文件将保留安装在/Users/sandropadin/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9 .1 / gems / pg-0.13.2 for i nspection。 记录到/Users/sandropadin/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/pg-0.13.2/ext/gem_make.out 的结果

解决方案

不知道以下哪个步骤最终解决了这个问题。但是由于mu提到的太短,问题在于混合了32位和64位二进制文​​件。

  • 1,我安装了这个 PostgreSQL的64位版本
  • 2,我卸载了任何旧版的Homebrew OpenSSL安装 $ b

    $ brew卸载openssl

    $ brew install --64位openssl

    p>

  • 最后,在安装pg gem时,我将LDFLAGS更改为指向64位版本的OpenSSL

    $ gem install pg - --with-ldflags =' - L / usr / local / Cellar / openssl / 0.9.8s'

Trying to install the pg gem gives me errors.

I'm using Ruby 1.9.3-p125 built using rbenv/ruby-build. I installed PostgreSQL using the one-click installer. I'm able to connect to the DB using pgAdmin. I'm running out of ideas.

% gem install pg ~ Building native extensions. This could take a while... ERROR: Error installing pg: ERROR: Failed to build gem native extension. /Users/sandropadin/.rbenv/versions/1.9.3-p125/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 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 rb_encdb_alias()... yes checking for rb_enc_alias()... yes checking for struct pgNotify.extra in libpq-fe.h... yes checking for unistd.h... yes checking for ruby/st.h... yes creating extconf.h creating Makefile make compiling pg.c compiling pg_connection.c pg_connection.c: In function ‘pgconn_wait_for_notify’: pg_connection.c:1986: warning: ‘rb_thread_select’ is deprecated (declared at /Users/sandropadin/.rbenv/versions/1.9.3-p125/include/ruby-1.9.1/ruby/intern.h:379) pg_connection.c: In function ‘pgconn_block’: pg_connection.c:2512: warning: ‘rb_thread_select’ is deprecated (declared at /Users/sandropadin/.rbenv/versions/1.9.3-p125/include/ruby-1.9.1/ruby/intern.h:379) compiling pg_result.c linking shared-object pg_ext.bundle ld: in /usr/local/lib/libssl.0.9.8.dylib, missing required architecture x86_64 in file for architecture x86_64 collect2: ld returned 1 exit status make: *** [pg_ext.bundle] Error 1 Gem files will remain installed in /Users/sandropadin/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/pg-0.13.2 for inspection. Results logged to /Users/sandropadin/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/pg-0.13.2/ext/gem_make.out

解决方案

Not sure which of the following steps finally cleared this issue up. But as mu is too short mentioned, the problem was mixing 32bit and 64bit binaries.

  • 1st, I installed this 64-bit version of PostgreSQL
  • 2nd, I uninstalled any old Homebrew OpenSSL installation

    $ brew uninstall openssl

  • 3rd, I installed the 64-bit version of OpenSSL with Homebrew

    $ brew install --64-bit openssl

  • Lastly, when installing the pg gem, I changed the LDFLAGS to point to the 64-bit version of OpenSSL

    $ gem install pg -- --with-ldflags='-L/usr/local/Cellar/openssl/0.9.8s'

更多推荐

麻烦安装pg gem

本文发布于:2023-10-13 20:17:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1488976.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:麻烦   pg   gem

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!