我无法在 Slackware 中安装 pg

I can't install pg in Slackware

我需要 运行 一个具有 gem 和规范的 ruby 项目。当我输入 bundle install 时,我收到:

bash-5.1# bundle install
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Fetching gem metadata from https://rubygems.org/...
Resolving dependencies...
Using bundler 2.3.9
Using diff-lcs 1.5.0
Using rspec-support 3.1.2
Fetching pg 1.3.4
Using rspec-core 3.1.7
Using rspec-expectations 3.1.2
Using rspec-mocks 3.1.3
Using rspec 3.1.0
Installing pg 1.3.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /usr/lib64/ruby/gems/3.0.0/gems/pg-1.3.4/ext
/usr/bin/ruby -I /usr/lib64/ruby/3.0.0 -r ./siteconf20220320-7556-sm89ck.rb
extconf.rb
Calling libpq with GVL unlocked
checking for pg_config... no
checking for libpq per pkg-config... no
Using libpq from 
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*****************************************************************************

Unable to find PostgreSQL client library.

Please install libpq or postgresql client package like so:
  sudo apt install libpq-dev
  sudo yum install postgresql-devel
  sudo zypper in postgresql-devel
  sudo pacman -S postgresql-libs

or try again with:
  gem install pg -- --with-pg-config=/path/to/pg_config

or set library paths manually with:
gem install pg -- --with-pg-include=/path/to/libpq-fe.h/
--with-pg-lib=/path/to/libpq.so/

*** 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}/lib64
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/bin/$(RUBY_BASE_NAME)
    --with-pg
    --without-pg
    --enable-gvl-unlock
    --disable-gvl-unlock
    --enable-windows-cross
    --disable-windows-cross
    --with-pg-config
    --without-pg-config
    --with-pg_config
    --without-pg_config
    --with-libpq-config
    --without-libpq-config
    --with-pkg-config
    --without-pkg-config
    --with-pg-dir
    --without-pg-dir
    --with-pg-include
    --without-pg-include=${pg-dir}/include
    --with-pg-lib
    --without-pg-lib=${pg-dir}/lib64

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

  /usr/lib64/ruby/gems/3.0.0/extensions/x86_64-linux/3.0.0/pg-1.3.4/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/lib64/ruby/gems/3.0.0/gems/pg-1.3.4 for
inspection.
Results logged to
/usr/lib64/ruby/gems/3.0.0/extensions/x86_64-linux/3.0.0/pg-1.3.4/gem_make.out

  /usr/lib64/ruby/3.0.0/rubygems/ext/builder.rb:93:in `run'
  /usr/lib64/ruby/3.0.0/rubygems/ext/ext_conf_builder.rb:47:in `block in build'
  /usr/lib64/ruby/gems/3.0.0/gems/tempfile-0.1.2/lib/tempfile.rb:317:in `open'
  /usr/lib64/ruby/3.0.0/rubygems/ext/ext_conf_builder.rb:26:in `build'
  /usr/lib64/ruby/3.0.0/rubygems/ext/builder.rb:159:in `build_extension'
/usr/lib64/ruby/3.0.0/rubygems/ext/builder.rb:193:in `block in
build_extensions'
  /usr/lib64/ruby/3.0.0/rubygems/ext/builder.rb:190:in `each'
  /usr/lib64/ruby/3.0.0/rubygems/ext/builder.rb:190:in `build_extensions'
  /usr/lib64/ruby/3.0.0/rubygems/installer.rb:845:in `build_extensions'
/usr/lib64/ruby/gems/3.0.0/gems/bundler-2.3.9/lib/bundler/rubygems_gem_installer.rb:71:in
`build_extensions'
/usr/lib64/ruby/gems/3.0.0/gems/bundler-2.3.9/lib/bundler/rubygems_gem_installer.rb:28:in
`install'
/usr/lib64/ruby/gems/3.0.0/gems/bundler-2.3.9/lib/bundler/source/rubygems.rb:204:in
`install'
/usr/lib64/ruby/gems/3.0.0/gems/bundler-2.3.9/lib/bundler/installer/gem_installer.rb:54:in
`install'
/usr/lib64/ruby/gems/3.0.0/gems/bundler-2.3.9/lib/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
/usr/lib64/ruby/gems/3.0.0/gems/bundler-2.3.9/lib/bundler/installer/parallel_installer.rb:186:in
`do_install'
/usr/lib64/ruby/gems/3.0.0/gems/bundler-2.3.9/lib/bundler/installer/parallel_installer.rb:177:in
`block in worker_pool'
/usr/lib64/ruby/gems/3.0.0/gems/bundler-2.3.9/lib/bundler/worker.rb:62:in
`apply_func'
/usr/lib64/ruby/gems/3.0.0/gems/bundler-2.3.9/lib/bundler/worker.rb:57:in
`block in process_queue'
/usr/lib64/ruby/gems/3.0.0/gems/bundler-2.3.9/lib/bundler/worker.rb:54:in
`loop'
/usr/lib64/ruby/gems/3.0.0/gems/bundler-2.3.9/lib/bundler/worker.rb:54:in
`process_queue'
/usr/lib64/ruby/gems/3.0.0/gems/bundler-2.3.9/lib/bundler/worker.rb:91:in
`block (2 levels) in create_threads'

An error occurred while installing pg (1.3.4), and Bundler cannot
continue.

In Gemfile:
  pg

我试图说服他们切换到 Slackware 作为主要 OS 但我在安装和 运行ning 使用 psql 的框架程序时遇到问题,ruby 很快在 rails.

上足够 ruby

我安装了 libpqxx slackbuild、sqlite3 gem、postgresql (14.2) slackbuild,当我 运行 rnu ./import_db.sh 它说:bash-5.1#。 /import_db.sh dropdb:错误:连接到套接字“/tmp/.s.PGSQL.5432”上的服务器失败:没有这样的文件或目录 服务器 运行 是否在本地并接受该套接字上的连接? createdb:错误:连接到套接字“/tmp/.s.PGSQL.5432”上的服务器失败:没有这样的文件或目录 服务器 运行 是否在本地并接受该套接字上的连接? psql:错误:连接到套接字“/tmp/.s.PGSQL.5432”上的服务器失败:没有这样的文件或目录 服务器 运行 是否在本地并接受该套接字上的连接? bash-5.1#

我刚刚意识到 Slackware 使用 slackpkg 作为包管理器。 不太确定 this 是否是您需要的库,但请尝试安装:

slackpkg install libpqxx