ruby 安装sqlite3(1.4.2)时出错,Bundler无法继续,在Mac上

laximzn5  于 2023-01-25  发布在  Ruby
关注(0)|答案(2)|浏览(202)

我试图使一个网站的工作,我有这个问题,终端syas的sqlite无法安装,但后来我把“Sqlite3 -version”,它说,我有3. 32. 3我怎么能解决这个问题

f87krz0w

f87krz0w1#

在我的情况下,解决方案是这样做:在做bundle install之前。
随附日志:

Installing sqlite3 1.4.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sqlite3-1.4.2/ext/sqlite3
/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/bin/ruby -I
/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/site_ruby/3.1.0 -r
./siteconf20220611-30960-lay9qk.rb extconf.rb
--with-cflags\=-Wno-implicit-function-declaration
*** 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=/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/bin/$(RUBY_BASE_NAME)
    --with-sqlcipher
    --without-sqlcipher
    --with-sqlcipher
    --without-sqlcipher
    --with-sqlite3-dir
    --without-sqlite3-dir
    --with-sqlite3-include
    --without-sqlite3-include=${sqlite3-dir}/include
    --with-sqlite3-lib
    --without-sqlite3-lib=${sqlite3-dir}/lib
    --with-sqlite3-config
    --without-sqlite3-config
    --with-pkg-config
    --without-pkg-config
/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/mkmf.rb:498:in `try_do': The
compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/mkmf.rb:591:in `try_link0'
    from /Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/mkmf.rb:609:in `try_link'
from /Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/mkmf.rb:711:in
`try_ldflags'
from /Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/mkmf.rb:1895:in
`pkg_config'
    from extconf.rb:35:in `<main>'

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

/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/extensions/arm64-darwin-21/3.1.0/sqlite3-1.4.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in
/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sqlite3-1.4.2 for
inspection.
Results logged to
/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/extensions/arm64-darwin-21/3.1.0/sqlite3-1.4.2/gem_make.out

/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/ext/builder.rb:95:in
`run'
/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/ext/ext_conf_builder.rb:47:in
`block in build'
  /Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/tempfile.rb:317:in `open'
/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/ext/ext_conf_builder.rb:26:in
`build'
/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/ext/builder.rb:164:in
`build_extension'
/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/ext/builder.rb:198:in
`block in build_extensions'
/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/ext/builder.rb:195:in
`each'
/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/ext/builder.rb:195:in
`build_extensions'
/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/installer.rb:851:in
`build_extensions'
/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/rubygems_gem_installer.rb:71:in
`build_extensions'
/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/rubygems_gem_installer.rb:28:in
`install'
/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/source/rubygems.rb:204:in
`install'
/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/installer/gem_installer.rb:54:in
`install'
/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/installer/parallel_installer.rb:186:in
`do_install'
/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/installer/parallel_installer.rb:177:in
`block in worker_pool'
/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/worker.rb:62:in
`apply_func'
/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/worker.rb:57:in
`block in process_queue'
/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/worker.rb:54:in
`loop'
/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/worker.rb:54:in
`process_queue'
/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/worker.rb:91:in
`block (2 levels) in create_threads'

An error occurred while installing sqlite3 (1.4.2), and Bundler cannot continue.

In Gemfile:
  sqlite3
brtdzjyr

brtdzjyr2#

sudo apt安装libsqlite 3-dev

相关问题