我试图在无法安装捆绑软件后安装mysql2 gem。 我跑的时候
$ sudo gem install mysql2 - --with MySQL的-配置=的/ usr /本地/ MySQL的/斌/ mysql_config
我收到以下错误:
构建原生扩展。这可能需要一段时间...错误:错误 安装mysql2:错误:无法构建gem原生扩展。
/Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/bin/ruby extconf.rb --with-mysql-config=/usr/local/mysql/bin/mysql_config
检查rb_thread_blocking_region()...是检查 rb_wait_for_single_fd()...是检查mysql.h ...是检查 对于errmsg.h ...是检查mysqld_error.h ...是创建 生成文件
make compiling client.c在client.c中包含的文件中:1:在文件中 包含自./mysql2_ext.h:8:包含在的文件中 /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby.h:32: /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby/ruby.h:105:37: 错误:'ruby_check_sizeof_long'声明为带负数的数组 size typedef char ruby_check_sizeof_long [SIZEOF_LONG == sizeof(long)? 1:-1]; 来自client.c的文件中包含^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 在./mysql2_ext.h:8中包含的文件中:包含在的文件中 /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby.h:32: 在包含的文件中 /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby/ruby.h:24: /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/x86_64-darwin11.4.2/ruby/config.h:24:21:注意:实例化:
定义SIZEOF_LONG 8
^ In file included from client.c:1: In file included from ./mysql2_ext.h:8: In file included from
/Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby.h:32: /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby/ruby.h:109:38: 错误:'ruby_check_sizeof_voidp'声明为带负数的数组 size typedef char ruby_check_sizeof_voidp [SIZEOF_VOIDP == sizeof(void *)? 1:-1]; ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ client.c:1:包含在./mysql2_ext.h:8中的文件:包含在文件中 从 /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby.h:32: 在包含的文件中 /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby/ruby.h:24: /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/x86_64-darwin11.4.2/ruby/config.h:28:22:注意:实例化:
定义SIZEOF_VOIDP 8
^ In file included from client.c:1: In file included from ./mysql2_ext.h:8: In file included from
/Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby.h:32: 在包含的文件中 /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby/ruby.h:1382: 在包含的文件中 /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby/intern.h:34: /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby/st.h:67:45: 错误:'st_check_for_sizeof_st_index_t'声明为带有的数组 负大小typedef char st_check_for_sizeof_st_index_t [SIZEOF_VOIDP ==(int)sizeof(st_index_t)? 1:-1]; ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~包括在内 client.c:1:包含在./mysql2_ext.h:8中的文件:包含在文件中 从 /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby.h:32: 在包含的文件中 /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby/ruby.h:24: /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/x86_64-darwin11.4.2/ruby/config.h:28:22:注意:实例化:
定义SIZEOF_VOIDP 8
^ 3 errors generated. make: *** [client.o] Error 1
Gem文件将保持安装状态 /Users/jcollyer/.rvm/gems/ruby-1.9.3-p327/gems/mysql2-0.3.11 for 检查。记录结果 /Users/jcollyer/.rvm/gems/ruby-1.9.3-p327/gems/mysql2-0.3.11/ext/mysql2/gem_make.out
$哪个红宝石
/Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/bin/ruby
$ where mysql
的/ usr / local / bin中/ MySQL的
我错过了什么?
答案 0 :(得分:1)
如果您计划在应用程序中使用mysql2 gem,那么在执行此操作之前,您需要安装libmysqlclient-dev
包。更多细节:
http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/
答案 1 :(得分:0)
试试这个希望它会帮助
cd /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7
gem install mysql - --with MySQL的-配置=的/ usr /本地/ MySQL的/斌/ mysql_config
如果这不起作用则安装 的 libmysqlclient15-dev的强>
每当你无法构建“原生扩展”时,就意味着有一些lib 或lib-dev缺失。一般来说,你需要做一个
sudo apt-get install
lib-???-dev
或
sudo apt-get install build_essential
。
'sudo apt-get install libmysqlclient15-dev'