Ruby Sqlite3 安装 sqlite3_libversion_number() macOS Sierra [英] Ruby Sqlite3 installation sqlite3_libversion_number() macOS Sierra

查看:72
本文介绍了Ruby Sqlite3 安装 sqlite3_libversion_number() macOS Sierra的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试安装 Metasploit 框架(不重要),而 bundler 正在尝试安装 sqlite3,这是它一直失败的地方.Sqlite3 已安装(在命令行执行 sqlite3 使我进入环境)并使用 brew link sqlite3 链接(并添加 --force,出于某种原因)但 bundler install 每次都失败并出现此错误:

I'm trying to install the Metasploit framework (unimportant) and bundler is attempting to install sqlite3, which is where it fails consistently. Sqlite3 is installed (executing sqlite3 at the command line brings me into the environment) and is linked using brew link sqlite3 (and adding the --force, for some reason) but bundler install fails each time with this error:

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

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.
checking for sqlite3.h... yes
checking for pthread_create() in -lpthread... yes
checking for sqlite3_libversion_number() in -lsqlite3... no
sqlite3 is missing. Try 'brew install sqlite3',
'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
and check your shared library search path (the
location where your sqlite3 shared library is located).
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
    --with-sqlite3-config
    --without-sqlite3-config
    --with-pkg-config
    --without-pkg-config
    --with-sqlite3-dir
    --without-sqlite3-dir
    --with-sqlite3-include
    --without-sqlite3-include=${sqlite3-dir}/include
    --with-sqlite3-lib
    --without-sqlite3-lib=${sqlite3-dir}/
    --with-pthreadlib
    --without-pthreadlib
    --with-sqlite3lib
    --without-sqlite3lib


Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/sqlite3-1.3.12 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/sqlite3-1.3.12/ext/sqlite3/gem_make.out

推荐答案

我终于通过在 macOS Sierra 10.12.5 (16F73) 上指定内置 Mac OS X sqlite 库目录 来解决这个问题):

I finally managed to solve this by specifying the built-in Mac OS X sqlite library directory on macOS Sierra 10.12.5 (16F73):

$ whereis sqlite3
/usr/bin/sqlite3
# if binary is in /usr/bin then library is typically in /usr/lib
$ gem install sqlite3 -- --with-sqlite3-lib=/usr/lib
Building native extensions with: '--with-sqlite3-lib=/usr/lib'
This could take a while...
Successfully installed sqlite3-1.3.13
Parsing documentation for sqlite3-1.3.13
Done installing documentation for sqlite3 after 0 seconds
1 gem installed

我尝试指定 Homebrew 库目录,但由于某种原因它不起作用:

I tried specifying the Homebrew library directory but for some reason it didn't work:

$ brew ls --verbose sqlite3
/usr/local/Cellar/sqlite/3.19.3/.brew/sqlite.rb
/usr/local/Cellar/sqlite/3.19.3/bin/sqlite3
/usr/local/Cellar/sqlite/3.19.3/include/msvc.h
/usr/local/Cellar/sqlite/3.19.3/include/sqlite3.h
/usr/local/Cellar/sqlite/3.19.3/include/sqlite3ext.h
/usr/local/Cellar/sqlite/3.19.3/INSTALL_RECEIPT.json
/usr/local/Cellar/sqlite/3.19.3/lib/libsqlite3.0.dylib
/usr/local/Cellar/sqlite/3.19.3/lib/libsqlite3.a
/usr/local/Cellar/sqlite/3.19.3/lib/libsqlite3.dylib
/usr/local/Cellar/sqlite/3.19.3/lib/pkgconfig/sqlite3.pc
/usr/local/Cellar/sqlite/3.19.3/README.txt
/usr/local/Cellar/sqlite/3.19.3/share/man/man1/sqlite3.1
$ gem install sqlite3 -- --with-sqlite3-lib=/usr/local/Cellar/sqlite/3.19.3/lib
This could take a while...
ERROR:  Error installing sqlite3:
    ERROR: Failed to build gem native extension.
...

如果有人知道如何指定 Homebrew 库目录,请告诉我,因为这样可以更好地控制安装(据说 MacPorts 可以工作,但我不再使用它了.

If someone knows how to specify the Homebrew library directory, please let me know because that would provide a little more control over installation (supposedly MacPorts works but I no longer use it).

对于任何好奇的人,这里是安装 Ruby 的 Sequel 的完整命令:

For anyone curious, here's the full command to install Ruby's Sequel:

gem install sequel mysql sqlite3 -- --with-sqlite3-lib=/usr/lib

以及如何将侦听主机端口 3306 的 Laravel Homestead MySQL 数据库从 我对这个问题的评论:

And how to convert a Laravel Homestead MySQL database listening on host port 3306 to SQLite from my comment on the question:

sequel mysql://homestead:secret@192.168.10.10:3306/my_database -C sqlite://my_database.sqlite

这篇关于Ruby Sqlite3 安装 sqlite3_libversion_number() macOS Sierra的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆