2010-04-21 30 views
0

我正在尝试使用基本的“Create a blog in 20 minutes”Rails screencast,但已经遇到了绊脚石。未能安装activerecord-jdbcmysql-adapter gem

当我尝试耙db:migrate时,我得到关于没有安装gem activerecord-jdbcmysql适配器的错误。当我尝试安装它时,我被告知它不存在。

如果我试图简单地安装mysql,我会得到各种各样的疯狂。

我在Mac OS X 10.6.2上运行它,我的安装都是通过gem完成的。我的基本设置工作(Hello world!)。

以下是错误日志:

$ rake db:migrate (in /Users/xxxx/Sites/blog) rake aborted!

Please install the jdbcmysql adapter:

gem install activerecord-jdbcmysql-adapter (no such file to load -- active_record/connection_adapters/jdbcmysql_adapter)

(See full trace by running task with --trace)

$ sudo gem install activerecord-jdbcmysql-adapter

ERROR: could not find gem activerecord-jdbcmysql-adapter locally or in a repository

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

/opt/local/bin/ruby extconf.rb
checking for mysql_query() in
-lmysqlclient... no checking for main() in -lm... yes checking for
mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in
-lmysqlclient... no checking for main() in -lsocket... no checking for
mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in
-lmysqlclient... no checking for main() in -lmygcc... no checking for
mysql_query() in -lmysqlclient... no
* 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=/opt/local/bin/ruby
--with-mysql-config
--without-mysql-config
--with-mysql-dir --without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-mysqlclientlib
--without-mysqlclientlib --with-mlib
--without-mlib --with-mysqlclientlib
--without-mysqlclientlib --with-zlib
--without-zlib --with-mysqlclientlib
--without-mysqlclientlib
--with-socketlib --without-socketlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-nsllib --without-nsllib
--with-mysqlclientlib
--without-mysqlclientlib
--with-mygcclib --without-mygcclib
--with-mysqlclientlib
--without-mysqlclientlib

Gem files will remain installed in
/opt/local/lib/ruby/gems/1.8/gems/mysql-2.8.1
for inspection. Results logged to
/opt/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out

+0

我遇到了同样的问题,我昨天刚安装了NetBeans。 Java版本没有帮助,重新安装Rails 2.3.8也不起作用。有谁知道目前的修复程序是什么? – sscirrus 2010-07-04 22:31:14

回答

2

看起来像某种方式或其他我有两个版本的轨道安装。我原本做的:

gem install rails 

其中安装了2.3.5。然后,当我试图运行脚手架它说我有错误的版本,它抱怨,并建议我安装2.3.5 ...

我用命令这样做:

gem install -v=2.3.5 rails 

这意味着我有两个(当我试图卸载时,我发现了这一点),出于某种原因,它试图使用Ruby版本......这可能是由于Netbeans使用错误的设置。

在我卸载一切结束,跑到:

创业板安装-v = 2.3.5轨

并确保Netbeans的是不是要使用JRuby的,因为它以前。现在我有一个版本不支持脚手架或db:migrate。卖!

0

也许你的意思了activerecord-jdbcmysql适配器?你可以做一个gem activerecord-jdbcmysql-adapter并安装。但是AFAIK只需要它来使用JDBC,通常使用JRUBY。如果您使用的是JRUBY,我建议您使用此网站http://kenai.com/projects/jruby/pages/Home

+0

我没有选择在任何地方使用JBury,这似乎是自己发生的。正如我所说,我安装了$ gem install rails os OS X 10.6,所以无论如何,这是我的。 – 2010-04-21 17:24:33

1

听起来您没有安装Apple Dev Tools,其中包含Ruby头文件。

这就是固定的,当我与运行到这个ERROR: Failed to build gem native extension.

+1

对不起Zack你在一个鸣叫中提到这个,我完全忘了回复。我已经安装了XCode,它运行的很好,这是一个不同的问题。感谢您的回应,永远感激。 – 2010-04-22 08:26:16

0

工作对我来说:

gem install --platform java activerecord-jdbcmysql-adapter 

意识到这对http://rubygems.org/gems/activerecord-jdbcmysql-adapter看到的版本是复姓后不默认为正确的平台-java。

(所做的“宝石更新--system”前夕。不知道是否收到了有关这一任何影响。)

哦,是的,对于MySQL则需要Xcode和可能的附加头被安装MySQL的。