因为两天我遇到了一个我无法解决的问题。我正在尝试在debian机器上安装redmine。当涉及到gem mysql的安装时,它失败了。我不知道该怎么办了。我的最后一个例子是你的帮助。
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
<小时/>
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]
<小时/>
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 */ --------------------
答案 0 :(得分:7)
看起来你走在正确的轨道上。即使您似乎安装了mysql库,也需要确保完全安装MySQL开发头文件及其依赖项,以便编译MySQL gem。
尝试:
sudo apt-get install mysql-dev
然后:
sudo gem install mysql - --with MySQL的-配置=的/ usr /本地/ MySQL的/斌/ mysql_config
显然,确切的命令取决于mysql-dev文件的安装位置。
答案 1 :(得分:3)
我遇到了同样的问题。 我的解决方案是安装ruby-dev。 也许它有助于其他人,我看你已经解决了你的问题。