简体   繁体   English

Ruby - Gem - mysql - 无法构建gem原生扩展

[英]Ruby - Gem - mysql - Failed to build gem native extension

since two days I'm facing a problem I can't solve. 因为两天我面临着一个我无法解决的问题。 I'm trying to install redmine on a debian machine. 我正在尝试在debian机器上安装redmine。 When it comes to installation for the gem mysql it fails. 当涉及到gem mysql的安装时,它失败了。 I don't know what to do anymore. 我不知道该怎么办了。 My last instance is your help. 我的最后一个例子是你的帮助。

Error 错误

root@host:~# gem1.8 install mysql
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
 ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb
checking for mysql_ssl_set()... no
checking for rb_str_set_len()... no
checking for rb_thread_start_timer()... no
checking for mysql.h... no
checking for mysql/mysql.h... 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=/usr/bin/ruby1.8
 --with-mysql-config
 --without-mysql-config


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

What I've tried 我试过的


System 系统

user@host:~# uname -a  
Linux www.example.org 2.6.18-028stab070.4 #1 SMP Tue Aug 17 18:32:47 MSD 2010 x86_64 GNU/Linux
root@s15428277:~# aptitude search '~i (mysql|ruby)|mysql.*dev'
i A libdbd-mysql-perl                                                     - A Perl5 database interface to the MySQL database                                
p   libghc6-hsql-mysql-dev                                                - Multi-Database Interface System for Haskell                                     
p   libgnademysql-dev                                                     - GNat Ada Database Environment - MySQL programming interface                     
p   liblua5.1-sql-mysql-dev                                               - luasql development files for the lua language version 5.1                       
i   libmysql++-dev                                                        - mysql C++ library bindings (development)                                        
i A libmysql++2c2a                                                        - mysql C++ library bindings (runtime)                                            
p   libmysql-ocaml-dev                                                    - OCaml bindings for MySql                                                        
v   libmysqlclient-dev                                                    -                                                                                 
i   libmysqlclient15-dev                                                  - MySQL database development files                                                
i A libmysqlclient15off                                                   - MySQL database client library                                                   
i   libopenssl-ruby1.8                                                    - OpenSSL interface for Ruby 1.8                                                  
i A libreadline-ruby1.8                                                   - Readline interface for Ruby 1.8                                                 
i A libruby1.8                                                            - Libraries necessary to run Ruby 1.8                                             
i   libsqlite3-ruby1.8                                                    - SQLite3 interface for Ruby 1.8                                                  
i A mysql-client-5.0                                                      - MySQL database client binaries                                                  
i A mysql-common                                                          - MySQL database common files                                                     
i   mysql-server                                                          - MySQL database server (metapackage depending on the latest version)             
i A mysql-server-5.0                                                      - MySQL database server binaries                                                  
i   ruby1.8                                                               - Interpreter of object-oriented scripting language Ruby 1.8                      
i   ruby1.8-dev                                                           - Header files for compiling extension modules for the Ruby 1.8
root@host:~# gem1.8 --version
1.3.7
root@host:~# ruby1.8 --version
ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]


Files

mkmf.log mkmf.log

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

"cc -o conftest -I. -I/usr/lib/ruby/1.8/x86_64-linux -I/usr/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api    -I/usr/include/mysql  -DBIG_JOINS=1 -fPIC -fno-strict-aliasing -g -g -O2  -fPIC   conftest.c  -L. -L/usr/lib -L.  -rdynamic -Wl,-export-dynamic    -L/usr/lib/mysql -lmysqlclient  -lruby1.8-static -L/usr/lib/mysql -lmysqlclient  -lpthread -ldl -lcrypt -lm   -lc"
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { void ((*volatile p)()); p = (void ((*)()))mysql_ssl_set; return 0; }
/* end */

"cc -o conftest -I. -I/usr/lib/ruby/1.8/x86_64-linux -I/usr/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api    -I/usr/include/mysql  -DBIG_JOINS=1 -fPIC -fno-strict-aliasing -g -g -O2  -fPIC   conftest.c  -L. -L/usr/lib -L.  -rdynamic -Wl,-export-dynamic    -L/usr/lib/mysql -lmysqlclient  -lruby1.8-static -L/usr/lib/mysql -lmysqlclient  -lpthread -ldl -lcrypt -lm   -lc"
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { mysql_ssl_set(); return 0; }
/* end */

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

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

"cc -o conftest -I. -I/usr/lib/ruby/1.8/x86_64-linux -I/usr/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api    -I/usr/include/mysql  -DBIG_JOINS=1 -fPIC -fno-strict-aliasing -g -g -O2  -fPIC   conftest.c  -L. -L/usr/lib -L.  -rdynamic -Wl,-export-dynamic    -L/usr/lib/mysql -lmysqlclient  -lruby1.8-static -L/usr/lib/mysql -lmysqlclient  -lpthread -ldl -lcrypt -lm   -lc"
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { void ((*volatile p)()); p = (void ((*)()))rb_str_set_len; return 0; }
/* end */

"cc -o conftest -I. -I/usr/lib/ruby/1.8/x86_64-linux -I/usr/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api    -I/usr/include/mysql  -DBIG_JOINS=1 -fPIC -fno-strict-aliasing -g -g -O2  -fPIC   conftest.c  -L. -L/usr/lib -L.  -rdynamic -Wl,-export-dynamic    -L/usr/lib/mysql -lmysqlclient  -lruby1.8-static -L/usr/lib/mysql -lmysqlclient  -lpthread -ldl -lcrypt -lm   -lc"
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { rb_str_set_len(); return 0; }
/* end */

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

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

"cc -o conftest -I. -I/usr/lib/ruby/1.8/x86_64-linux -I/usr/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api    -I/usr/include/mysql  -DBIG_JOINS=1 -fPIC -fno-strict-aliasing -g -g -O2  -fPIC   conftest.c  -L. -L/usr/lib -L.  -rdynamic -Wl,-export-dynamic    -L/usr/lib/mysql -lmysqlclient  -lruby1.8-static -L/usr/lib/mysql -lmysqlclient  -lpthread -ldl -lcrypt -lm   -lc"
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { void ((*volatile p)()); p = (void ((*)()))rb_thread_start_timer; return 0; }
/* end */

"cc -o conftest -I. -I/usr/lib/ruby/1.8/x86_64-linux -I/usr/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api    -I/usr/include/mysql  -DBIG_JOINS=1 -fPIC -fno-strict-aliasing -g -g -O2  -fPIC   conftest.c  -L. -L/usr/lib -L.  -rdynamic -Wl,-export-dynamic    -L/usr/lib/mysql -lmysqlclient  -lruby1.8-static -L/usr/lib/mysql -lmysqlclient  -lpthread -ldl -lcrypt -lm   -lc"
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { rb_thread_start_timer(); return 0; }
/* end */

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

have_header: checking for mysql.h... -------------------- no

"cc -E -I. -I/usr/lib/ruby/1.8/x86_64-linux -I/usr/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api    -I/usr/include/mysql  -DBIG_JOINS=1 -fPIC -fno-strict-aliasing -g -g -O2  -fPIC    conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include 
/* end */

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

have_header: checking for mysql/mysql.h... -------------------- no

"cc -E -I. -I/usr/lib/ruby/1.8/x86_64-linux -I/usr/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api    -I/usr/include/mysql  -DBIG_JOINS=1 -fPIC -fno-strict-aliasing -g -g -O2  -fPIC    conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include 
/* end */

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

It looks like you are on the right track. 看起来你走在正确的轨道上。 Even though you appear to have the mysql libraries installed, you need to ensure that the MySQL development header files and their dependencies are fully installed in order for the MySQL gem to be compiled. 即使您似乎安装了mysql库,也需要确保完全安装MySQL开发头文件及其依赖项,以便编译MySQL gem。

Try: 尝试:

sudo apt-get install mysql-dev

And then: 接着:

sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config sudo gem install mysql - --with-mysql-config = / usr / local / mysql / bin / mysql_config

Clearly, the exact command depends upon where the mysql-dev files are installed. 显然,确切的命令取决于mysql-dev文件的安装位置。

I had the same problem. 我有同样的问题。 The solution for me was to install ruby-dev. 我的解决方案是安装ruby-dev。 Maybe it helps somebody else, I see you've already solved your porblem. 也许它有助于其他人,我看到你已经解决了你的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 gem install mysql:无法构建gem原生扩展(Mac Lion) - gem install mysql: Failed to build gem native extension (Mac Lion) 安装mysql2 gem时出错:无法构建gem原生扩展 - Error installing mysql2 gem: Failed to build gem native extension 错误:无法构建 gem 原生扩展 - 安装 mysql2 时出错 - ERROR: Failed to build gem native extension - Error installing mysql2 错误:安装mysql时出错:错误:无法构建gem本机扩展 - ERROR: Error installing mysql: ERROR: Failed to build gem native extension 安装 mysql2 时出错:无法构建 gem 原生扩展 - Error installing mysql2: Failed to build gem native extension MySQL 安装:错误:无法构建 gem 原生扩展 - MySQL Install: ERROR: Failed to build gem native extension 错误:无法构建 gem 本机扩展(rails 3.2.3 上的 mysql2) - ERROR: Failed to build gem native extension (mysql2 on rails 3.2.3) 无法在 Mysql Docker 容器中安装 mysql2 gem:无法构建 gem 本机扩展 - Cannot install mysql2 gem inside Mysql Docker container: Failed to build gem native extension mysql2 gem无法在Windows 7上安装:无法生成gem本机扩展 - mysql2 gem failing to install on Windows 7: failed to build gem native extension 安装mysql的Rails - 安装mysql2时出错:错误:无法构建gem原生扩展 - Rails installing mysql - Error installing mysql2: ERROR: Failed to build gem native extension
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM