2016-12-28 108 views
1

我試圖安裝Metasploit的框架(不重要)和打捆嘗試安裝sqlite3的,這是它一貫失敗。安裝SQLITE3(在命令行中執行sqlite3的讓我到環境中),並使用brew link sqlite3鏈接(並添加--force,出於某種原因),但每次bundler install失敗,此錯誤:紅寶石SQLITE3安裝sqlite3_libversion_number()MacOS的塞拉利昂

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 
+0

我想要安裝'gem install sequel mysql sqlite3'完全相同的問題,所以我可以像從https:// stackover那樣從mysql轉換到sqlite flow.com/a/11328913/539149您有沒有找到解決方案? –

回答

7

我終於成功地解決了這個由指定內置的Mac OS X SQLite庫目錄在MacOS塞拉利昂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庫目錄,但由於某些原因沒」 t工作:

$ 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. 
... 

如果有人知道如何指定家釀庫目錄,請讓我知道,因爲這會在安裝(據說MacPorts的作品,但我不再使用它)提供更多的控制。


對於任何人都好奇,下面是完整的命令來安裝Ruby的Sequel

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

而如何轉換Laravel Homestead MySQL數據庫監聽的主機端口3306上從my comment on the question對於SQLite:

sequel mysql://homestead:[email protected]:3306/my_database -C sqlite://my_database.sqlite 
+0

2017-Nov-20'gem install sqlite3 - --with-sqlite3-lib =/usr/lib'完全解決我的問題,謝謝! – NamNamNam