Ruby - Gem - mysql - Failed to create custom gem extension

since two days I have a problem that I can’t solve. I am trying to install redmine on a debian machine. When it comes to installing for mysql gem, it fails. I do not know what to do next. My last example 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 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

  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 * /

 --------------------
+4
source share
2 answers

You seem to be on the right track. Although you have mysql libraries installed, you should make sure that the MySQL development header files and their dependencies are fully installed so that the MySQL compilation is compiled.

Try:

 sudo apt-get install mysql-dev 

And then:

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

Obviously, the exact command depends on where the mysql-dev files are installed.

+7
source

I had the same problem. The solution for me was to install ruby-dev. Maybe this helps someone else, I see you have already solved your problem.

+3
source

Source: https://habr.com/ru/post/1332665/


All Articles