我使用mac。
宝石版:2.4.5.1 Ruby版本:ruby 2.2.3p173(2015-08-18修订版51636)[x86_64-darwin15] 的Gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.3'
group :development do
gem 'sqlite3', '1.3.5'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '3.2.4'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.2.3'
end
gem 'jquery-rails', '2.0.1'
group :production do
gem 'pg', '0.12.2'
end
我花了大约3个小时搜索解决方案,没有运气。
我阅读了Ruby on Rails教程'作者:Michael Hartl,第46页。
第一个导致另一个错误的错误导致另一个......
从这个命令开始:
bundle install --without production
导致此错误:
Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Resolving dependencies...
Using rake 11.2.2
Using i18n 0.7.0
Using multi_json 1.12.1
Using builder 3.0.4 (was 3.2.2)
Using erubis 2.7.0
Using journey 1.0.4
Using rack 1.4.7 (was 2.0.1)
Using hike 1.2.3
Using tilt 1.4.1 (was 2.0.5)
Using mime-types 1.25.1 (was 3.1)
Using polyglot 0.3.5
Using arel 3.0.3 (was 7.1.2)
Using tzinfo 0.3.51 (was 1.2.2)
Using bundler 1.13.1
Using coffee-script-source 1.10.0
Using execjs 2.7.0
Using json 1.8.3
Using thor 0.14.6 (was 0.19.1)
Using sass 3.4.22
Installing sqlite3 1.3.5 (was 1.3.11) with native extensions
Using activesupport 3.2.3 (was 5.0.0.1)
Using rack-cache 1.6.1
Using rack-test 0.6.3
Using rack-ssl 1.3.4
Using sprockets 2.1.4 (was 3.7.0)
Using treetop 1.4.15
Using coffee-script 2.4.1
Using uglifier 1.2.3 (was 3.0.2)
Using rdoc 3.12.2
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/Money/.rbenv/versions/2.2.3/bin/ruby -r ./siteconf20160917-4100-9i5b1f.rb
extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... yes
checking for sqlite3_initialize()... yes
checking for sqlite3_backup_init()... yes
checking for sqlite3_column_database_name()... no
checking for sqlite3_enable_load_extension()... no
checking for sqlite3_load_extension()... no
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling backup.c
compiling database.c
compiling exception.c
compiling sqlite3.c
compiling statement.c
statement.c:258:11: warning: implicit declaration of function 'RBIGNUM' is invalid in
C99 [-Wimplicit-function-declaration]
if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) {
^
./sqlite3_ruby.h:16:24: note: expanded from macro 'RBIGNUM_LEN'
#define RBIGNUM_LEN(x) RBIGNUM(x)->len
^
statement.c:258:11: error: member reference type 'int' is not a pointer
if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) {
^~~~~~~~~~~~~~~~~~
./sqlite3_ruby.h:16:36: note: expanded from macro 'RBIGNUM_LEN'
#define RBIGNUM_LEN(x) RBIGNUM(x)->len
~~~~~~~~~~ ^
statement.c:258:32: error: use of undeclared identifier 'SIZEOF_BDIGITS'
if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) {
^
1 warning and 2 errors generated.
make: *** [statement.o] Error 1
make failed, exit code 2
Gem files will remain installed in
/Users/Money/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.5 for
inspection.
Results logged to
/Users/Money/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-15/2.2.0-static/sqlite3-1.3.5/gem_make.out
An error occurred while installing sqlite3 (1.3.5), and Bundler cannot
continue.
Make sure that `gem install sqlite3 -v '1.3.5'` succeeds before bundling.
然后,由于最后一句&#34;在捆绑之前确保gem install sqlite3 -v '1.3.5'
成功。
&#34;,我运行那个命令:
gem install sqlite3 -v '1.3.5'
得到这个错误,我不知道该怎么做:
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
/Users/Money/.rbenv/versions/2.2.3/bin/ruby -r ./siteconf20160917-4314-20lcl4.rb extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... yes
checking for sqlite3_initialize()... yes
checking for sqlite3_backup_init()... yes
checking for sqlite3_column_database_name()... no
checking for sqlite3_enable_load_extension()... no
checking for sqlite3_load_extension()... no
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling backup.c
compiling database.c
compiling exception.c
compiling sqlite3.c
compiling statement.c
statement.c:258:11: warning: implicit declaration of function 'RBIGNUM' is invalid in C99 [-Wimplicit-function-declaration]
if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) {
^
./sqlite3_ruby.h:16:24: note: expanded from macro 'RBIGNUM_LEN'
#define RBIGNUM_LEN(x) RBIGNUM(x)->len
^
statement.c:258:11: error: member reference type 'int' is not a pointer
if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) {
^~~~~~~~~~~~~~~~~~
./sqlite3_ruby.h:16:36: note: expanded from macro 'RBIGNUM_LEN'
#define RBIGNUM_LEN(x) RBIGNUM(x)->len
~~~~~~~~~~ ^
statement.c:258:32: error: use of undeclared identifier 'SIZEOF_BDIGITS'
if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) {
^
1 warning and 2 errors generated.
make: *** [statement.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/Money/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.5 for inspection.
Results logged to /Users/Money/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-15/2.2.0-static/sqlite3-1.3.5/gem_make.out
Jonass-MBP:demo_app Money$
我在this主题上尝试了这些建议,但所有建议都返回&#34;未找到命令&#34;。
我也按照this帖子的建议尝试运行gem install sqlite3-ruby
,但是没有用。
我尝试按this主题中的建议运行gem sources --add http://rubygems.org/
,以防失败与HTTPS或HTTP有关,但无法正常工作。
有什么建议吗?
谢谢! 纳斯
答案 0 :(得分:1)
请尝试按以下方式安装:
gem install sqlite3 -v'1.3.5' - --srcdir = / usr / local / mysql / include
答案 1 :(得分:0)
试
bundle update sqlite3
我在这里看到了
http://stackoverflow.com/questions/34151296/cannot-install-sqlite3-gem
答案 2 :(得分:0)
您是否在系统中安装了SQLite3?
如果您使用的是MacPorts:
sudo port install sqlite3
或Brew:
brew install sqlite3