似乎无法在Mac上安装mysql

似乎无法在Mac上安装mysql

sudo gem install mysql — –with-mysql-config=/usr/local/mysql/bin/mysql_config
/usr/local/lib/ruby/1.9.1/optparse.rb:1262: warning: regexp match /.../n against to UTF-8 string
/usr/local/lib/ruby/1.9.1/optparse.rb:1278: warning: regexp match /.../n against to UTF-8 string
/usr/local/lib/ruby/1.9.1/optparse.rb:1262: warning: regexp match /.../n against to UTF-8 string
/usr/local/lib/ruby/1.9.1/optparse.rb:1278: warning: regexp match /.../n against to UTF-8 string
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
    ERROR: Failed to build gem native extension.

/usr/local/bin/ruby 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... yes
creating Makefile

make
gcc -I. -I/usr/local/include/ruby-1.9.1/i386-darwin9.8.0 -I/usr/local/include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -DHAVE_MYSQL_H  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -I/usr/local/mysql/include/mysql -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT  -DDONT_DECLARE_CXA_PURE_VIRTUAL -fno-common  -O2 -g -Wall -Wno-parentheses -pipe -fno-common  -o mysql.o -c mysql.c
In file included from /usr/local/include/ruby-1.9.1/ruby.h:32,
                 from mysql.c:5:
/usr/local/include/ruby-1.9.1/ruby/ruby.h: In function ‘INT2NUM’:
/usr/local/include/ruby-1.9.1/ruby/ruby.h:464: warning: comparison is always true due to limited range of data type
/usr/local/include/ruby-1.9.1/ruby/ruby.h:464: warning: comparison is always true due to limited range of data type
/usr/local/include/ruby-1.9.1/ruby/ruby.h: In function ‘UINT2NUM’:
/usr/local/include/ruby-1.9.1/ruby/ruby.h:472: warning: comparison is always true due to limited range of data type
mysql.c: In function ‘escape_string’:
mysql.c:290: error: lvalue required as left operand of assignment
mysql.c:290: error: lvalue required as left operand of assignment
mysql.c: In function ‘real_escape_string’:
mysql.c:434: error: lvalue required as left operand of assignment
mysql.c:434: error: lvalue required as left operand of assignment
make: *** [mysql.o] Error 1


Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/mysql-2.8.1 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
ERROR:  Could not find a valid gem '—' (>= 0) in any repository
ERROR:  Could not find a valid gem '–with-mysql-config=/usr/local/mysql/bin/mysql_config' (>= 0) in any repository


在执行以下建议后,我仍然出现错误。

sudo gem install mysql —- –-with-mysql-config=/usr/local/mysql/bin/mysql_config
/usr/local/lib/ruby/1.9.1/optparse.rb:1262: warning: regexp match /.../n against to UTF-8 string
/usr/local/lib/ruby/1.9.1/optparse.rb:1278: warning: regexp match /.../n against to UTF-8 string
/usr/local/lib/ruby/1.9.1/optparse.rb:1262: warning: regexp match /.../n against to UTF-8 string
/usr/local/lib/ruby/1.9.1/optparse.rb:1278: warning: regexp match /.../n against to UTF-8 string
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
    ERROR: Failed to build gem native extension.

        /usr/local/bin/ruby extconf.rb
checking for mysql_ssl_set()... yes
checking for rb_str_set_len()... no
checking for rb_thread_start_timer()... no
checking for mysql.h... yes
creating Makefile

make
gcc -I. -I/usr/local/include/ruby-1.9.1/i386-darwin9.8.0 -I/usr/local/include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -DHAVE_MYSQL_SSL_SET -DHAVE_MYSQL_H  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -I/usr/local/mysql/include  -g -Os -arch x86_64 -fno-common   -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT  -DDONT_DECLARE_CXA_PURE_VIRTUAL -fno-common  -O2 -g -Wall -Wno-parentheses -pipe -fno-common  -o mysql.o -c mysql.c
In file included from /usr/local/include/ruby-1.9.1/ruby.h:32,
                 from mysql.c:5:
/usr/local/include/ruby-1.9.1/ruby/ruby.h: In function ‘INT2NUM’:
/usr/local/include/ruby-1.9.1/ruby/ruby.h:464: warning: comparison is always true due to limited range of data type
/usr/local/include/ruby-1.9.1/ruby/ruby.h:464: warning: comparison is always true due to limited range of data type
/usr/local/include/ruby-1.9.1/ruby/ruby.h: In function ‘UINT2NUM’:
/usr/local/include/ruby-1.9.1/ruby/ruby.h:472: warning: comparison is always true due to limited range of data type
mysql.c: In function ‘escape_string’:
mysql.c:290: error: lvalue required as left operand of assignment
mysql.c:290: error: lvalue required as left operand of assignment
mysql.c: In function ‘real_escape_string’:
mysql.c:434: error: lvalue required as left operand of assignment
mysql.c:434: error: lvalue required as left operand of assignment
make: *** [mysql.o] Error 1


Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/mysql-2.8.1 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
ERROR:  Could not find a valid gem '—-' (>= 0) in any repository
ERROR:  Could not find a valid gem '–-with-mysql-config=/usr/local/mysql/bin/mysql_config' (>= 0) in any repository

最佳答案

那应该是

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


(gem名称和构建选项之间有两个连字符,构建选项前有两个连字符)

您可能还需要设置ARCHFLAGS变量。请参见here

关于mysql - 似乎无法在Mac上安装mysql,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5289428/

10-09 22:26