简体   繁体   中英

Mac OS 10.6 Server can't install mysql gem

I have nearly the same problem with the one discussed on the link below:

Error installing Mysql2 gem- 10.6 Server

I have followed the solution described but I get this:

sudo env ARCHFLAGS="-arch x86_64" gem install mysql2 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
Building native extensions.  This could take a while...
ERROR:  Error installing mysql2:
    ERROR: Failed to build gem native extension.

        /Users/angelos/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb --with-mysql-config=/usr/local/mysql/bin/mysql_config
checking for rb_thread_blocking_region()... yes
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing.  please check your installation of mysql and try again.
-----
*** 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=/Users/angelos/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
    --with-mysql-config


Gem files will remain installed in /Users/angelos/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.7 for inspection.
Results logged to /Users/angelos/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.7/ext/mysql2/gem_make.out

Additionally I also tried to specified all mysql path:

sudo env ARCHFLAGS="-arch x86_64" gem install mysql --
--with-mysql-dir=/usr/local/mysql
--with-mysql-lib=/usr/local/mysql/lib
--with-mysql-include=/usr/local/mysql/include
--with-mysql-config=/usr/local/mysql/bin/mysql_config

And still get the error

$ sudo env ARCHFLAGS="-arch x86_64" gem install mysql2 -- --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib --with-mysql-include=/usr/local/mysql/include --with-mysql-config=/usr/local/mysql/bin/mysql_config
Building native extensions.  This could take a while...
ERROR:  Error installing mysql2:
    ERROR: Failed to build gem native extension.

        /Users/angelos/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib --with-mysql-include=/usr/local/mysql/include --with-mysql-config=/usr/local/mysql/bin/mysql_config
checking for rb_thread_blocking_region()... yes
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing.  please check your installation of mysql and try again.
-----
*** 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=/Users/angelos/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
    --with-mysql-config


Gem files will remain installed in /Users/angelos/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.7 for inspection.
Results logged to /Users/angelos/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.7/ext/mysql2/gem_make.out

Any help apreciated.

Do you have the mysql header files actually installed in the paths you link to? Have you installed a package of mysql that includes the header file?

/usr/local/mysql

I have installed mysql with ports and I have it in /opt

$ find /opt -name mysql.h
/opt/local/include/mysql5/mysql/mysql.h

you could try

$ find /usr/local -name mysql.h

I backtracked to version 5.1.59 of mysql instead of 5.5 and it worked fine.

It seems the gem is still incompatible with MySQL 5.5.xx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM