尽管安装了sqlite3,但未找到包配置

问题描述 投票:0回答:2

我正在尝试在 Intel Mac OS 12.6 上安装 Ruby 3.2.0 和 Rails 7.0.4。我遇到了 sqlite3 的问题:

/usr/local/lib/ruby/gems/3.2.0/gems/sqlite3-1.5.4/ports/x86_64-apple-darwin21.6.0/sqlite3/3.40.0/lib/pkgconfig/sqlite3.pc 的软件包配置没有找到

当我输入

gem install sqlite3
我得到:

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

    current directory: /usr/local/lib/ruby/gems/3.2.0/gems/sqlite3-1.5.4/ext/sqlite3
/usr/local/opt/ruby/bin/ruby -I /usr/local/lib/ruby/site_ruby/3.2.0 extconf.rb
Building sqlite3-ruby using packaged sqlite3.
Extracting sqlite-autoconf-3400000.tar.gz into tmp/x86_64-apple-darwin21.6.0/ports/sqlite3/3.40.0... OK
Running 'configure' for sqlite3 3.40.0... OK
Running 'compile' for sqlite3 3.40.0... OK
Running 'install' for sqlite3 3.40.0... OK
Activating sqlite3 3.40.0 (from /usr/local/lib/ruby/gems/3.2.0/gems/sqlite3-1.5.4/ports/x86_64-apple-darwin21.6.0/sqlite3/3.40.0)...

Could not configure the build properly (pkg_config). Please install either the `pkg-config` utility or the `pkg-config` rubygem.

*** 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:

[长选项列表]

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

  /usr/local/lib/ruby/gems/3.2.0/extensions/x86_64-darwin-21/3.2.0/sqlite3-1.5.4/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/lib/ruby/gems/3.2.0/gems/sqlite3-1.5.4 for inspection.
Results logged to /usr/local/lib/ruby/gems/3.2.0/extensions/x86_64-darwin-21/3.2.0/sqlite3-1.5.4/gem_make.out

我一直在更改权限,根据错误消息安装 pkg-config,更改 .zshrc 中的 $PATH,安装 sqlite 二进制包修改 Gemfile,完全卸载两者并重新启动,但无济于事。 Homebrew 安装的 sqlite3 正在运行。

which sqlite3
产生:

/usr/local/opt/sqlite3/bin/sqlite3
ruby macos sqlite
2个回答
0
投票

如果您没有安装

pkg-config
,您应该安装才能继续

您可以使用以下方式检查:

$ which pkg-config

如果没有找到,请安装它:

$ curl https://pkg-config.freedesktop.org/releases/pkg-config-0.28.tar.gz -o pkgconfig.tgz
$ tar -zxf pkgconfig.tgz && cd pkg-config-0.28
$ ./configure && make install

我只是关注此页面


0
投票

很可能您没有安装

pkg-config
。我发现通过brew安装更容易。

 brew install pkg-config 
© www.soinside.com 2019 - 2024. All rights reserved.