雪豹+ 1.9.1 + MySQL的宝石=大问题(Snow Leopard + Ruby 1.9.1

2019-07-04 03:41发布

我试图约3-4小时,试图让MySQL的宝石安装在雪豹红宝石1.9.1。 MySQL的宝石使用前我升级到雪豹的工作就好了1.9.1。 我卸载MySQL服务器和宝石从我的机器。 然后我下载并安装的:mysql-5.1.37-osx10.5-x86_64.dmg。 我已经能够断言我安装这个新版本是为运行64位应用程序。

我卸载MySQL的宝石。 当我试图用这个命令安装gem:

env ARCHFLAGS="-arch x86_64" gem install mysql --verbose -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

我得到这个错误:

GET 304 Not Modified: http://gems.rubyforge.org/latest_specs.4.8.gz
GET 200 OK: http://gems.github.com/latest_specs.4.8.gz
Installing gem mysql-2.8.1
/Users/sean/.gem/ruby/1.9.1/gems/mysql-2.8.1/COPYING
/Users/sean/.gem/ruby/1.9.1/gems/mysql-2.8.1/COPYING.ja
/Users/sean/.gem/ruby/1.9.1/gems/mysql-2.8.1/History.txt
/Users/sean/.gem/ruby/1.9.1/gems/mysql-2.8.1/Manifest.txt
/Users/sean/.gem/ruby/1.9.1/gems/mysql-2.8.1/README.txt
/Users/sean/.gem/ruby/1.9.1/gems/mysql-2.8.1/Rakefile
/Users/sean/.gem/ruby/1.9.1/gems/mysql-2.8.1/ext/mysql_api/extconf.rb
/Users/sean/.gem/ruby/1.9.1/gems/mysql-2.8.1/ext/mysql_api/mysql.c
/Users/sean/.gem/ruby/1.9.1/gems/mysql-2.8.1/extra/README.html
/Users/sean/.gem/ruby/1.9.1/gems/mysql-2.8.1/extra/README_ja.html
/Users/sean/.gem/ruby/1.9.1/gems/mysql-2.8.1/extra/tommy.css
/Users/sean/.gem/ruby/1.9.1/gems/mysql-2.8.1/lib/mysql.rb
/Users/sean/.gem/ruby/1.9.1/gems/mysql-2.8.1/tasks/gem.rake
/Users/sean/.gem/ruby/1.9.1/gems/mysql-2.8.1/tasks/native.rake
/Users/sean/.gem/ruby/1.9.1/gems/mysql-2.8.1/tasks/vendor_mysql.rake
/Users/sean/.gem/ruby/1.9.1/gems/mysql-2.8.1/test/test_mysql.rb
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
        ERROR: Failed to build gem native extension.

/Users/sean/.rvm/ruby-1.9.1-p243/bin/ruby extconf.rb --with-mysql-config=/usr/local/mysql/bin/mysql_config
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/Users/sean/.rvm/ruby-1.9.1-p243/include/ruby-1.9.1/i386-darwin9.8.0 -I/Users/sean/.rvm/ruby-1.9.1-p243/include/ruby-1.9.1/ruby/backward -I/Users/sean/.rvm/ruby-1.9.1-p243/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  -fno-common -pipe -fno-common  -o mysql.o -c mysql.c
In file included from /Users/sean/.rvm/ruby-1.9.1-p243/include/ruby-1.9.1/ruby.h:32,
                 from mysql.c:5:
/Users/sean/.rvm/ruby-1.9.1-p243/include/ruby-1.9.1/ruby/ruby.h: In function 'INT2NUM':
/Users/sean/.rvm/ruby-1.9.1-p243/include/ruby-1.9.1/ruby/ruby.h:464: warning: comparison is always true due to limited range of data type
/Users/sean/.rvm/ruby-1.9.1-p243/include/ruby-1.9.1/ruby/ruby.h:464: warning: comparison is always true due to limited range of data type
/Users/sean/.rvm/ruby-1.9.1-p243/include/ruby-1.9.1/ruby/ruby.h: In function 'UINT2NUM':
/Users/sean/.rvm/ruby-1.9.1-p243/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 /Users/sean/.gem/ruby/1.9.1/gems/mysql-2.8.1 for inspection.
Results logged to /Users/sean/.gem/ruby/1.9.1/gems/mysql-2.8.1/ext/mysql_api/gem_make.out

我已经试过各种我从以下链接阅读。

  1. http://void-design.net/2009/08/05/ruby-191-mysql-and-a-snow-leopard/
  2. http://www.schmidp.com/2009/06/14/rubyrails-and-mysql-on-snow-leopard-10a380/
  3. Rails中,MySQL和雪豹

有任何想法吗?

Answer 1:

肖恩,我看到你正在运行的Ruby RVM下1.9.1。 我有相同的设置(雪豹,RVM,MySQL的64位包)下相同的问题。 所有的备用宝石(的MySQLPlus,kwatch MySQL的旁注等)的失败,同样的错误。

我怀疑MySQL的安装,但一切就像在系统默认的Ruby的一个冠军。 所以我想如果RVM是不是猴子扳手莫名其妙。

编辑:我想通了。 我升级到雪豹之前安装RVM,所以我的1.9.1安装需要重新编译。 良好的措施,我从头开始重新安装RVM。

这是我做的:

sudo gem uninstall rvm
rm -rf ~/.gem
sudo gem install rvm
rvm-install
rvm install 1.9.1
rvm 1.9.1
env ARCHFLAGS="-arch x86_64" gem install mysql

(注:根据RVM安装宝石时,不能使用sudo,因为RVM是通过修改$ PATH)

(注:我添加的/ usr /本地/ MySQL的/ bin添加到我的$ PATH所以我没有安装MySQL的宝石时指定任何那些可怕的命令行参数的个数)。

顺利安装MySQL的宝石。



Answer 2:

我从MacPorts的安装MySQL,然后运行相同的宝石安装,你必须在那里指挥解决了这个问题。

因此,首先,卸载你的MySQL从包有:

sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*

如果你还没有这么做过,从这里安装的MacPorts: http://www.macports.org/install.php有雪豹包。

安装从MacPorts的MYSQL5-devel的:

sudo port install mysql5-server-devel

它会做所有的依赖和那么MySQL。 按照所有安装程序建议安装后的步骤 - 启动项等它安装的MySQL是64位。

然后用安装MySQL的宝石:

env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/opt/local/bin/mysql_config5

注意那里的路径变化。 MacPorts的把MySQL的在不同的地方。

你应该是好去。



Answer 3:

我尝试了所有没有运气上面的步骤,但使用的MySQLPlus宝石,而不是MySQL的宝石发现了一个解决方法(或其他):

sudo env ARCHFLAGS="-arch x86_64" gem install mysqlplus

而现在我的MySQL红宝石应用的工作就像在雪豹魅力。



Answer 4:

安装的XCode是对我的解决办法



Answer 5:

看看这篇文章: http://jameseggers.com/post/185690322/fix-mysql-and-rails-on-snow-leopard 。 它展示了如何on Rails的+雪豹获得MySQL + Ruby的所有工作完美。



Answer 6:

发现了一个伟大的教程在网上的这个。

http://www.icoretech.org/2009/08/install-mysql-and-mysql-ruby-gem-on-snow-leopard-64-bit/

设置PATH变量是我的问题。



Answer 7:

我曾与MySQL的宝石,RVM和红宝石1.9.1同样的问题。 正如我在后提到NeptunePhoenix ,我通过通过口安装MySQL获得了成功。



Answer 8:

挣扎小时绊倒在此之前:

http://markgandolfo.com/2010/08/21/mysql-gem-with-rails-3-and-ruby-1-9-2



Answer 9:

我的修复重新安装MySQL。 我用的是64位DMG安装版- 5.5.13 http://dev.mysql.com/downloads/mysql/



文章来源: Snow Leopard + Ruby 1.9.1 + MySQL Gem = Huge problems