错误:安装安装 sqlite3 (1.3.3) 时无法构建 gem 本机扩展

发布于 2024-11-17 00:22:03 字数 7671 浏览 6 评论 0原文

我正在尝试启动我的第一个 Rails 项目。我在 Mac OS X 10.6.7 上,安装了 Xcode4、ruby 1.9.2、rails 3.0.1

当我输入 bundle install 时,出现此错误:

~/rails_project/first_app$ bundle install
Fetching source index for http://rubygems.org/
Using rake (0.9.2)
Using abstract (1.0.0)
Using activesupport (3.0.1)
Using builder (2.1.2)
Using i18n (0.4.2)
Using activemodel (3.0.1)
Using erubis (2.6.6)
Using rack (1.2.3)
Using rack-mount (0.6.14)
Using rack-test (0.5.7)
Using tzinfo (0.3.28)
Using actionpack (3.0.1)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.19)
Using actionmailer (3.0.1)
Using arel (1.0.1)
Using activerecord (3.0.1)
Using activeresource (3.0.1)
Using bundler (1.0.14)
Using thor (0.14.6)
Using railties (3.0.1)
Using rails (3.0.1)
Installing sqlite3 (1.3.3) with native extensions /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:533:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

       /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
checking for sqlite3.h... *** 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/tiffany/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
       --with-sqlite3-dir
       --without-sqlite3-dir
       --with-sqlite3-include
       --without-sqlite3-include=${sqlite3-dir}/include
       --with-sqlite3-lib
       --without-sqlite3-lib=${sqlite3-dir}/lib
/Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
       from /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:452:in `try_cpp'
       from /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:853:in `block in find_header'
       from /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for'
       from /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postpone'
       from /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:254:in `open'
       from /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone'
       from /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:254:in `open'
       from /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
       from /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'
       from /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:852:in `find_header'
       from extconf.rb:28:in `<main>'


Gem files will remain installed in /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/sqlite3-1.3.3 for inspection.
Results logged to /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/sqlite3-1.3.3/ext/sqlite3/gem_make.out
       from /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:511:in `block in build_extensions'
       from /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:486:in `each'
       from /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:486:in `build_extensions'
       from /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:159:in `install'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/source.rb:101:in `block in install'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/rubygems_integration.rb:78:in `preserve_paths'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/source.rb:91:in `install'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/installer.rb:58:in `block (2 levels) in run'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/rubygems_integration.rb:93:in `with_build_args'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/installer.rb:57:in `block in run'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/spec_set.rb:12:in `block in each'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/spec_set.rb:12:in `each'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/spec_set.rb:12:in `each'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/installer.rb:49:in `run'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/installer.rb:8:in `install'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/cli.rb:222:in `install'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/vendor/thor/task.rb:22:in `run'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/vendor/thor.rb:246:in `dispatch'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/vendor/thor/base.rb:389:in `start'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/bin/bundle:13:in `<top (required)>'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/bin/bundle:19:in `load'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/bin/bundle:19:in `<main>'
~/rails_project/first_app$

我在网上找到的有关此错误的所有信息均特定于 Windows 或 Linux 计算机。在我的一次谷歌搜索中,我在某处看到这可能是一个链接问题,验证开发工具的尝试失败了。任何人都可以帮助解决这个问题吗?我还尝试执行 gem install sqlite3-ruby -- --with-sqlite3-dir=/usr/local/lib ,但这也不起作用。帮助!谢谢!

I am trying to start up my first rails project. Im on Mac OS X 10.6.7, have Xcode4 installed, ruby 1.9.2, rails 3.0.1

When I type bundle install I get this error:

~/rails_project/first_app$ bundle install
Fetching source index for http://rubygems.org/
Using rake (0.9.2)
Using abstract (1.0.0)
Using activesupport (3.0.1)
Using builder (2.1.2)
Using i18n (0.4.2)
Using activemodel (3.0.1)
Using erubis (2.6.6)
Using rack (1.2.3)
Using rack-mount (0.6.14)
Using rack-test (0.5.7)
Using tzinfo (0.3.28)
Using actionpack (3.0.1)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.19)
Using actionmailer (3.0.1)
Using arel (1.0.1)
Using activerecord (3.0.1)
Using activeresource (3.0.1)
Using bundler (1.0.14)
Using thor (0.14.6)
Using railties (3.0.1)
Using rails (3.0.1)
Installing sqlite3 (1.3.3) with native extensions /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:533:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

       /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
checking for sqlite3.h... *** 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/tiffany/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
       --with-sqlite3-dir
       --without-sqlite3-dir
       --with-sqlite3-include
       --without-sqlite3-include=${sqlite3-dir}/include
       --with-sqlite3-lib
       --without-sqlite3-lib=${sqlite3-dir}/lib
/Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
       from /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:452:in `try_cpp'
       from /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:853:in `block in find_header'
       from /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for'
       from /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postpone'
       from /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:254:in `open'
       from /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone'
       from /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:254:in `open'
       from /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
       from /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'
       from /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:852:in `find_header'
       from extconf.rb:28:in `<main>'


Gem files will remain installed in /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/sqlite3-1.3.3 for inspection.
Results logged to /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/sqlite3-1.3.3/ext/sqlite3/gem_make.out
       from /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:511:in `block in build_extensions'
       from /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:486:in `each'
       from /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:486:in `build_extensions'
       from /Users/tiffany/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:159:in `install'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/source.rb:101:in `block in install'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/rubygems_integration.rb:78:in `preserve_paths'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/source.rb:91:in `install'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/installer.rb:58:in `block (2 levels) in run'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/rubygems_integration.rb:93:in `with_build_args'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/installer.rb:57:in `block in run'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/spec_set.rb:12:in `block in each'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/spec_set.rb:12:in `each'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/spec_set.rb:12:in `each'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/installer.rb:49:in `run'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/installer.rb:8:in `install'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/cli.rb:222:in `install'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/vendor/thor/task.rb:22:in `run'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/vendor/thor.rb:246:in `dispatch'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/lib/bundler/vendor/thor/base.rb:389:in `start'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.14/bin/bundle:13:in `<top (required)>'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/bin/bundle:19:in `load'
       from /Users/tiffany/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/bin/bundle:19:in `<main>'
~/rails_project/first_app$

All the info I have found for this error online has been specific to Windows or Linux machines. In one of my google searches I saw somewhere that it might be a linking issue, that the attempt to verify the development tools failed. Can anyone help with this issue? I also tried doing gem install sqlite3-ruby -- --with-sqlite3-dir=/usr/local/lib and that didn't work either. HELP! Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

二智少女猫性小仙女 2024-11-24 00:22:03

您需要安装 sqlite3,gem 需要 sqlite 头文件来链接。请参阅这篇文章。

您可以使用macports安装它:sudo port install sqlite3

或者,如果您正在使用brew,请尝试brew install sqlite

You need to install sqlite3, the gem needs the sqlite header files to link against. See this post.

You can install it with macports: sudo port install sqlite3.

Or if you are using brew try brew install sqlite.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文