Rails/SnowLeopard Mysql 64位问题
大家好,我正在尝试在SnowLeopard上为rails应用程序安装64位MySQL 我已经从dmg安装了它,我可以从命令行很好地访问mysql。基于各种博客文章以及Stack上的其他主题,我关闭了mysql,卸载了mysql gem,然后尝试用以下内容更新gem:Rails/SnowLeopard Mysql 64位问题,mysql,ruby-on-rails,64-bit,osx-snow-leopard,macports,Mysql,Ruby On Rails,64 Bit,Osx Snow Leopard,Macports,大家好,我正在尝试在SnowLeopard上为rails应用程序安装64位MySQL 我已经从dmg安装了它,我可以从命令行很好地访问mysql。基于各种博客文章以及Stack上的其他主题,我关闭了mysql,卸载了mysql gem,然后尝试用以下内容更新gem: sudo env ARCHFLAGS='-arch x86_64' gem install --verbose --no-rdoc --no-ri mysql -- --with-mysql-config=/usr/local/my
sudo env ARCHFLAGS='-arch x86_64' gem install --verbose --no-rdoc --no-ri mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
GET 200 OK: http://gems.rubyforge.org/latest_specs.4.8.gz
Installing gem mysql-2.8.1
Downloading gem mysql-2.8.1.gem
GET 302 Found: http://gems.rubyforge.org/gems/mysql-2.8.1.gem
GET 200 OK: http://s3.amazonaws.com/gemcutter_production/gems/mysql-2.8.1.gem
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/COPYING
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/COPYING.ja
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/History.txt
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/Manifest.txt
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/README.txt
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/Rakefile
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/extconf.rb
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/mysql.c
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/extra/README.html
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/extra/README_ja.html
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/extra/tommy.css
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql.rb
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/tasks/gem.rake
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/tasks/native.rake
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/tasks/vendor_mysql.rake
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/test/test_mysql.rb
Building native extensions. This could take a while...
/usr/local/bin/ruby extconf.rb --with-mysql-config=/usr/local/mysql/bin/mysql_config
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. -I/usr/local/lib/ruby/1.8/universal-darwin8.0 -I. -DHAVE_MYSQL_H -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 -g -O2 -fno-common -pipe -fno-common -arch i386 -c mysql.c
cc -dynamic -bundle -undefined suppress -flat_namespace -arch i386 -L"/usr/local/lib" -o mysql_api.bundle mysql.o -lruby -L/usr/local/mysql/lib -lmysqlclient -lz -lm -lmygcc -lpthread -ldl -lobjc
ld: warning: in /usr/local/mysql/lib/libmysqlclient.dylib, file is not of required architecture
ld: warning: in /usr/local/mysql/lib/libmygcc.a, file is not of required architecture
make install
/usr/bin/install -c -m 0755 mysql_api.bundle /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib
Successfully installed mysql-2.8.1
1 gem installed
这将产生以下结果:
sudo env ARCHFLAGS='-arch x86_64' gem install --verbose --no-rdoc --no-ri mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
GET 200 OK: http://gems.rubyforge.org/latest_specs.4.8.gz
Installing gem mysql-2.8.1
Downloading gem mysql-2.8.1.gem
GET 302 Found: http://gems.rubyforge.org/gems/mysql-2.8.1.gem
GET 200 OK: http://s3.amazonaws.com/gemcutter_production/gems/mysql-2.8.1.gem
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/COPYING
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/COPYING.ja
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/History.txt
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/Manifest.txt
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/README.txt
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/Rakefile
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/extconf.rb
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/mysql.c
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/extra/README.html
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/extra/README_ja.html
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/extra/tommy.css
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql.rb
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/tasks/gem.rake
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/tasks/native.rake
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/tasks/vendor_mysql.rake
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/test/test_mysql.rb
Building native extensions. This could take a while...
/usr/local/bin/ruby extconf.rb --with-mysql-config=/usr/local/mysql/bin/mysql_config
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. -I/usr/local/lib/ruby/1.8/universal-darwin8.0 -I. -DHAVE_MYSQL_H -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 -g -O2 -fno-common -pipe -fno-common -arch i386 -c mysql.c
cc -dynamic -bundle -undefined suppress -flat_namespace -arch i386 -L"/usr/local/lib" -o mysql_api.bundle mysql.o -lruby -L/usr/local/mysql/lib -lmysqlclient -lz -lm -lmygcc -lpthread -ldl -lobjc
ld: warning: in /usr/local/mysql/lib/libmysqlclient.dylib, file is not of required architecture
ld: warning: in /usr/local/mysql/lib/libmygcc.a, file is not of required architecture
make install
/usr/bin/install -c -m 0755 mysql_api.bundle /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib
Successfully installed mysql-2.8.1
1 gem installed
最后这两个警告似乎不祥。然后我转到我的rails应用程序并运行
rake db:migrate
并获得:
dyld: NSLinkModule() error
dyld: Symbol not found: _mysql_affected_rows
Referenced from: /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
Expected in: flat namespace
in /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
Trace/BPT trap
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle: Mach-O bundle i386
这就是我能做到的。我尝试过通过dmg和macports安装MySQL,但似乎在这两种情况下都遇到了这个错误
说到rails,我有点傻;任何人所能发出的任何光芒都将受到极大的赞赏。谢谢
---编辑---
针对John(和khelll)的以下回答:
当我执行John指定的第一个命令时,我得到:
No definition for next_result
No definition for field_name
No definition for field_table
这大约有40行。我认为这是因为文件。但当我执行rake db:migrate时,我得到:
dyld: NSLinkModule() error
dyld: Symbol not found: _mysql_affected_rows
Referenced from: /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
Expected in: flat namespace
in /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
Trace/BPT trap
使用ARCHFLAGS命令会产生我前面指定的错误
---第二次编辑---
我应该补充一点,我不是从源代码安装的。在再次偷看Hivelogic说明后,我走上了这条路线
当我尝试跑步时:
./configure --prefix=/usr/local/mysql --with-extra-charsets=complex \
--enable-thread-safe-client --enable-local-infile --enable-shared \
--with-plugins=innobase
我得到:
config.status: creating zlib/Makefile
dyld: Library not loaded: /opt/local/lib/libintl.8.dylib
Referenced from: /opt/local/bin/gawk
Reason: no suitable image found. Did find:
/opt/local/lib/libintl.8.dylib: mach-o, but wrong architecture
./config.status: line 1782: 69228 Done(141) eval sed ç"ç$ac_sed_extraç" "$ac_file_inputs"
69229 Trace/BPT trap
所以我做了:
sudo port deactivate gettext
sudo port activate gettext @0.17_3
但是,在完成所有步骤后,重新安装gem,在rake db:migrate时,我仍然得到:
dyld: NSLinkModule() error
dyld: Symbol not found: _mysql_affected_rows
Referenced from: /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
Expected in: flat namespace
in /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
Trace/BPT trap
----第三次编辑----
好的-我相信这里发生的是,尽管我在上面指定了64位gem,但它正在安装32位版本。我有:
file /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
并获得:
dyld: NSLinkModule() error
dyld: Symbol not found: _mysql_affected_rows
Referenced from: /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
Expected in: flat namespace
in /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
Trace/BPT trap
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle: Mach-O bundle i386
因此,我似乎一直在安装32位版本,我是从源代码处安装的,效果很好。然后,我使用以下方式安装了MySQL RubyGem:
sudo gem install mysql--with mysql dir=/usr/local/mysql
之后安装gem:sudo env ARCHFLAGS=“-arch x86_64”gem install mysql--with mysql config=/usr/local/mysql/bin/mysql\u config我不需要ARCHFLAGS或config指令。嘿,谢谢你们的回复。当我执行John指定的第一个命令时,我得到大量的“下一个结果没有定义,字段名称没有定义”等等。我认为这是因为文件。但当我执行rake db:migrate时,我得到了:dyld:NSLinkModule()error dyld:Symbol not found:_mysql\u受影响的_行引用自:/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql\u api.bundle预期在/usr/local/lib/ruby/gems/1.8/lib/mysql\u api.bundle跟踪/BPT陷阱archflags产生我上面指定的错误那么您是否真的遵循了说明我链接到,用于从源代码处编译和安装64位MySQL?抱歉-刚刚在顶部添加了我的响应。