簡體   English   中英

如何在 SUSE 15.1 上安裝 pg gem?

[英]How to install pg gem on SUSE 15.1?

為了實現 Rails 5.2.4,我剛剛在新的 SUSE 15.1 服務器上安裝了 PostgreSQL 13,然后是 Ruby 2.6.6,我現在正在嘗試安裝 PostgreSQL 客戶端 gem:pg 版本 1.2.3。

我首先嘗試運行gem install pg ,它聲稱缺少文件pg_configlibpq-fe.h

Building native extensions. This could take a while...
ERROR:  Error installing pg:
        ERROR: Failed to build gem native extension.

    current directory: /home/a80838986/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/pg-1.2.3/ext
/home/a80838986/.rbenv/versions/2.6.6/bin/ruby -I /home/a80838986/.rbenv/versions/2.6.6/lib/ruby/2.6.0 -r ./siteconf20201103-26887-19gz250.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
 --with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/home/a80838986/.rbenv/versions/2.6.6/bin/$(RUBY_BASE_NAME)
        --with-pg
        --without-pg
        --enable-windows-cross
        --disable-windows-cross
        --with-pg-config
        --without-pg-config
        --with-pg_config
        --without-pg_config
        --with-pg-dir
        --without-pg-dir
        --with-pg-include
        --without-pg-include=${pg-dir}/include
        --with-pg-lib
        --without-pg-lib=${pg-dir}/lib

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/a80838986/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/pg-1.2.3/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/a80838986/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/pg-1.2.3 for inspection.
Results logged to /home/a80838986/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/pg-1.2.3/gem_make.out

在文件系統中搜索,我找到了一組可以滿足 gem 安裝要求的文件,但我不知道如何使用這些文件運行安裝:

ls -l /usr/include/pgsql/                total 152
-rwxr-xr-x 1 root root   656 Oct 29 01:11 ecpg_config.h
-rwxr-xr-x 1 root root  2544 Oct 29 01:11 ecpgerrno.h
-rwxr-xr-x 1 root root  2803 Oct 29 01:11 ecpg_informix.h
-rwxr-xr-x 1 root root  2681 Oct 29 01:11 ecpglib.h
-rwxr-xr-x 1 root root  2709 Oct 29 01:11 ecpgtype.h
drwxr-xr-x 1 root root     8 Nov  3 12:25 informix
drwxr-xr-x 1 root root   102 Nov  3 12:25 internal
drwxr-xr-x 1 root root    20 Nov  3 12:25 libpq
-rwxr-xr-x 1 root root  2214 Oct 29 01:11 libpq-events.h
-rwxr-xr-x 1 root root 23338 Oct 29 01:11 libpq-fe.h
-rwxr-xr-x 1 root root   323 Oct 29 01:11 pg_config_ext.h
-rwxr-xr-x 1 root root 31970 Oct 29 01:11 pg_config.h
-rwxr-xr-x 1 root root 12877 Oct 29 01:11 pg_config_manual.h
-rwxr-xr-x 1 root root  1052 Oct 29 01:11 pg_config_os.h
-rwxr-xr-x 1 root root   797 Oct 29 01:11 pgtypes_date.h
-rwxr-xr-x 1 root root   530 Oct 29 01:11 pgtypes_error.h
-rwxr-xr-x 1 root root   222 Oct 29 01:11 pgtypes.h
-rwxr-xr-x 1 root root  1032 Oct 29 01:11 pgtypes_interval.h
-rwxr-xr-x 1 root root  2251 Oct 29 01:11 pgtypes_numeric.h
-rwxr-xr-x 1 root root   945 Oct 29 01:11 pgtypes_timestamp.h
-rwxr-xr-x 1 root root  2239 Oct 29 01:11 postgres_ext.h
-rwxr-xr-x 1 root root   838 Oct 29 01:11 sql3types.h
-rwxr-xr-x 1 root root  1283 Oct 29 01:11 sqlca.h
-rwxr-xr-x 1 root root  1575 Oct 29 01:11 sqlda-compat.h
-rwxr-xr-x 1 root root   321 Oct 29 01:11 sqlda.h
-rwxr-xr-x 1 root root   824 Oct 29 01:11 sqlda-native.h

pg_config仍然丟失, libpq-fe.h在那里,但是:

  • no-pg-config 選項無效。
  • 我不知道如何將通行證設置為 libpq-fe.h

你能幫我完成這個安裝嗎?

我發現 pg_config 實用程序屬於postgresql13-server-devel包。 安裝這個包解決了我的問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM