嘿,我試圖在Snow Leopard上爲Rails應用程序安裝64位MySQL。Rails/Snow Leopard Mysql 64位問題
我已經從dmg安裝了它,我可以從命令行使用mysql。基於各種博客文章,以及其他主題這裏堆棧,我關閉mysql的,卸載MySQL的寶石,然後嘗試更新以下的寶石:這會產生以下
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
這就是據我能夠得到。我試過通過dmg和macports安裝MySQL,我似乎在兩種情況下都遇到了這個錯誤。
當談到鐵軌時,我是一個小菜鳥;任何人都可以擺脫的任何光線都會受到狂歡。謝謝!
---編輯---
在回答約翰的(和khelll的)答案如下:
當我這樣做,約翰指定的第一個命令,我得到:
No definition for next_result
No definition for field_name
No definition for field_table
這裏有大約40行。我認爲這是因爲文檔。但是,當我做耙分貝:遷移我得到:
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
然而,以下所有步驟,重新安裝寶石後,在耙db:遷移我仍然得到:
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位創業板,它在安裝32位版本。我做的:
file /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
並獲得:
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle: Mach-O bundle i386
所以它似乎我一直在安裝32位版本
之後安裝寶石:然後我使用安裝了MySQL RubyGem/bin/mysql_config – khelll 2009-12-16 15:05:51
我不需要ARCHFLAGS或配置指令。 – 2009-12-16 15:43:00
嘿傢伙,謝謝你的回覆。 當我執行John指定的第一個命令時,我得到了大量的「沒有爲next_result定義,沒有爲field_name定義」等等。我認爲這是因爲文檔。但是,當我做耙分貝:遷移我得到: 使dyld:NSLinkModule()錯誤 使dyld:未找到符號:_mysql_affected_rows 從引用:/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8。 1/LIB/mysql_api.bundle 在預期:在/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle 跟蹤/ BPT陷阱平面命名空間 的archflags會產生上面指定的錯誤 – thekevinscott 2009-12-16 15:48:15