[英]_mysql_init not found when using DataMapper
I have a simple MySQL table:我有一个简单的 MySQL 表:
% mysql -u rampion dev -e 'describe person'
+-------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | UNI | NULL | auto_increment |
| uid | varchar(256) | NO | PRI | NULL | |
+-------+--------------+------+-----+---------+----------------+
And a simple DataMapper script I want to run:我想运行一个简单的 DataMapper 脚本:
# temp.rb
require 'rubygems'
require 'datamapper'
DataMapper::Logger.new($stdout, :debug)
DataMapper.setup(:default, "mysql://rampion@localhost/dev")
class Person
include DataMapper::Resource
property :id, Serial
property :uid, String
end
DataMapper.finalize
p Person.first_or_create(:uid => 'Steve')
But when I run it, I get dynamic linker errors:但是当我运行它时,出现动态 linker 错误:
% ruby temp.rb
~/.rvm/gems/ruby-1.8.7-p334/gems/dm-validations-1.0.2/lib/dm-validations.rb:33: warning: already initialized constant OrderedHash
DataObjects::URI.new with arguments is deprecated, use a Hash of URI components (~/.rvm/gems/ruby-1.8.7-p334/gems/dm-do-adapter-1.0.2/lib/dm-do-adapter/adapter.rb:215:in `new')
dyld: lazy symbol binding failed: Symbol not found: _mysql_init
Referenced from: ~/.rvm/gems/ruby-1.8.7-p334/gems/do_mysql-0.10.12/lib/do_mysql/do_mysql.bundle
Expected in: flat namespace
dyld: Symbol not found: _mysql_init
Referenced from: ~/.rvm/gems/ruby-1.8.7-p334/gems/do_mysql-0.10.12/lib/do_mysql/do_mysql.bundle
Expected in: flat namespace
zsh: trace trap ruby temp.rb
I have LD_LIBRARY_PATH
set to /usr/local/mysql/lib
, which is where I have MySQL installed, and it seems to have _mysql_init
defined in there:我将
LD_LIBRARY_PATH
设置为/usr/local/mysql/lib
,这是我安装 MySQL 的地方,它似乎在那里定义了_mysql_init
:
% grep '_mysql_init' $LD_LIBRARY_PATH/libmysqlclient.18.dylib
Binary file /usr/local/mysql/lib/libmysqlclient.18.dylib matches
I have no idea what I need to do to fix this.我不知道我需要做什么来解决这个问题。
Seems like an issue with old versions of MySQL, shouldn't happen nowadays see https://github.com/brianmario/mysql2/issues/121似乎是旧版本 MySQL 的问题,现在不应该发生,请参阅https://github.com/brianmario/mysql2/issues/121
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.