gem安装mysql2_无法安装mysql2 gem

我无法在Windows7 x64系统中安装mysql2 gem。我尝试使用32位和64位版本的MySQL服务器,但没有一个让我更进一步。

我安装了Ruby 1.8,开发工具包和Rails平台。我什至安装了minGW来允许事物的C ++ / C编译。MySQL Server已安装在默认位置。

运行命令时:

C:\Users\Arne>gem install mysql2 -- --with-mysql-include="C:\Program Files (x86)\MySQL\MySQL Server 5.1\include" --with-mysql-lib="C:\Program Files (x86)\MySQL\MySQL Server 5.1\lib\"

我从控制台收到以下输出:

Temporarily enhancing PATH to include DevKit...

Building native extensions. This could take a while...

*** 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=C:/Ruby/bin/ruby

--with-mysql-dir

--without-mysql-dir

--with-mysql-include=${mysql-dir}/include

--with-mysql-lib=${mysql-dir}/lib

--with-libmysqllib

--without-libmysqllib

ERROR: Error installing mysql2:

ERROR: Failed to build gem native extension.

C:/Ruby/bin/ruby.exe extconf.rb --with-mysql-include=C:\Program Files (x

86)\MySQL\MySQL Server 5.1\include --with-mysql-lib=C:\Program Files (x86)\MySQL

\MySQL Server 5.1\lib"

checking for rb_thread_blocking_region()... no

checking for main() in -llibmysql... no

Gem files will remain installed in C:/Ruby/lib/ruby/gems/1.8/gems/mysql2-0.3.2 f

or inspection.

Results logged to C:/Ruby/lib/ruby/gems/1.8/gems/mysql2-0.3.2/ext/mysql2/gem_mak

e.out

根据Rubygems,我的环境的输出为:

C:\Users\Arne>gem env

RubyGems Environment:

- RUBYGEMS VERSION: 1.7.2

- RUBY VERSION: 1.8.7 (2011-02-18 patchlevel 334) [i386-mingw32]

- INSTALLATION DIRECTORY: C:/Ruby/lib/ruby/gems/1.8

- RUBY EXECUTABLE: C:/Ruby/bin/ruby.exe

- EXECUTABLE DIRECTORY: C:/Ruby/bin

- RUBYGEMS PLATFORMS:

- ruby

- x86-mingw32

- GEM PATHS:

- C:/Ruby/lib/ruby/gems/1.8

- C:/Users/Arne/.gem/ruby/1.8

- GEM CONFIGURATION:

- :update_sources => true

- :verbose => true

- :benchmark => false

- :backtrace => false

- :bulk_threshold => 1000

- REMOTE SOURCES:

- http://rubygems.org/

系统上还安装了以下gem:

C:\Users\Arne>gem list --local

*** LOCAL GEMS ***

abstract (1.0.0)

actionmailer (3.0.7)

actionpack (3.0.7)

activemodel (3.0.7)

activerecord (3.0.7)

activeresource (3.0.7)

activesupport (3.0.7)

arel (2.0.9)

builder (3.0.0, 2.1.2)

bundler (1.0.12)

erubis (2.7.0, 2.6.6)

fastthread (1.0.7)

i18n (0.5.0)

mail (2.3.0, 2.2.18)

mime-types (1.16)

mysql (2.8.1 x86-mingw32)

polyglot (0.3.1)

rack (1.2.2)

rack-mount (0.7.2, 0.6.14)

rack-test (0.5.7)

rails (3.0.7)

railties (3.0.7)

rake (0.8.7)

rdoc (3.5.3, 2.5.11)

rdoc-data (2.5.3)

rubygems-update (1.7.2)

thor (0.14.6)

treetop (1.4.9)

tzinfo (0.3.27, 0.3.26)

我不知道丢失了什么或出错了,但是脚本指向的输出文件包含以下数据:

mkmf.log:

have_func: checking for rb_thread_blocking_region()... -------------------- no

"gcc -o conftest -I. -IC:/Ruby/lib/ruby/1.8/i386-mingw32 -I. -g -O2 -DFD_SETSIZE=256 conftest.c -L. -LC:/Ruby/lib -L. -lmsvcrt-ruby18-static -lshell32 -lws2_32 "

conftest.c: In function 't':

conftest.c:7:53: error: 'rb_thread_blocking_region' undeclared (first use in this function)

conftest.c:7:53: note: each undeclared identifier is reported only once for each function it appears in

checked program was:

/* begin */

1: #include

2: #include

3: #include

4:

5: /*top*/

6: int main() { return 0; }

7: int t() { void ((*volatile p)()); p = (void ((*)()))rb_thread_blocking_region; return 0; }

/* end */

"gcc -o conftest -I. -IC:/Ruby/lib/ruby/1.8/i386-mingw32 -I. -g -O2 -DFD_SETSIZE=256 conftest.c -L. -LC:/Ruby/lib -L. -lmsvcrt-ruby18-static -lshell32 -lws2_32 "

C:\Users\Arne\AppData\Local\Temp\ccCicaNu.o: In function `t':

C:\Ruby\lib\ruby\gems\1.8\gems\mysql2-0.3.2\ext\mysql2/conftest.c:3: undefined reference to `rb_thread_blocking_region'

collect2: ld returned 1 exit status

checked program was:

/* begin */

1: /*top*/

2: int main() { return 0; }

3: int t() { rb_thread_blocking_region(); return 0; }

/* end */

--------------------

have_library: checking for main() in -llibmysql... -------------------- no

"gcc -o conftest -I. -IC:/Ruby/lib/ruby/1.8/i386-mingw32 -I. -IC:\Program -g -O2 -DFD_SETSIZE=256 conftest.c -L. -LC:/Ruby/lib -LC:\Program -L. -lmsvcrt-ruby18-static -llibmysql -lshell32 -lws2_32 "

c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -llibmysql

collect2: ld returned 1 exit status

checked program was:

/* begin */

1: #include

2: #include

3: #include

4:

5: /*top*/

6: int main() { return 0; }

7: int t() { void ((*volatile p)()); p = (void ((*)()))main; return 0; }

/* end */

"gcc -o conftest -I. -IC:/Ruby/lib/ruby/1.8/i386-mingw32 -I. -IC:\Program -g -O2 -DFD_SETSIZE=256 conftest.c -L. -LC:/Ruby/lib -LC:\Program -L. -lmsvcrt-ruby18-static -llibmysql -lshell32 -lws2_32 "

c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -llibmysql

collect2: ld returned 1 exit status

checked program was:

/* begin */

1: /*top*/

2: int main() { return 0; }

3: int t() { main(); return 0; }

/* end */

--------------------

gem_make.out:

C:/Ruby/bin/ruby.exe extconf.rb --with-mysql-include=C:\Program Files (x86)\MySQL\MySQL Server 5.1\include --with-mysql-lib=C:\Program Files (x86)\MySQL\MySQL Server 5.1\lib"

checking for rb_thread_blocking_region()... no

checking for main() in -llibmysql... no

我希望有人指出我做错了什么,或者开发系统上实际上缺少的东西,才能正确安装和运行此gem。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值