Help with MySQL gem on OSX - mysql

I'm trying to get the mysql gem working on OSX 10.5.6, and feeling stymied.
% gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
Building native extensions. This could take a while...
Successfully installed mysql-2.7
1 gem installed
% irb -rubygems -rmysql
irb> Mysql.init
dyld: lazy symbol binding failed: Symbol not found: _mysql_init
Referenced from: /Users/rampion/.gem/gems/mysql-2.7/lib/mysql.bundle
Expected in: dynamic lookup
dyld: Symbol not found: _mysql_init
Referenced from: /Users/rampion/.gem/gems/mysql-2.7/lib/mysql.bundle
Expected in: dynamic lookup
zsh: trace trap irb -rubygems -rmysql
%
I'm using the default install of ruby 1.8.6.
I'm using a 64-bit version of MySQL 5.0.77. mysqld is running and I can use the mysql shell, so I suspect my issue is with mysql.gem, though I'm by no means certain.
Can anyone offer any advice?

Ok. So the solution turned out to be I needed to be runing the 32-bit version of MySQL 5.0.77 in order for mysql.gem to work.

Related

OS X ejabberd configure error: SQLite3 library >= 3.6.19 was not found

I tried to install ejabberd in my local Mac OS X machine, but while configuring sqlite using following command as mentioned in steps. I'm stuck at the following issue.
./configure --prefix=$HOME/my-ejabberd --enable-sqlite
Error received
checking for SQLite3 library >= 3.6.19... yes
cat: /include/sqlite3.h: No such file or directory
./configure: line 4172: test: !=: unary operator expected
configure: WARNING: Cannot find SQLITE_VERSION macro in sqlite3.h header to retrieve SQLite version!
configure: error: SQLite3 library >= 3.6.19 was not found
Steps I followed from - https://docs.ejabberd.im/developer/install-osx/
If you just want to install vanilla Ejabberd then you can simply do brew install ejabberd.
According to the issue, you can also try:
./configure --prefix=$HOME/my-ejabberd --enable-sqlite --with-sqlite3=/usr/local/opt/sqlite
P.S. I have filed the issue on Github Ejabberd.

Connect to mysql from node.js app, error: "dyld: lazy symbol binding failed: Symbol not found: _mysql_init"

I use OSX 10.6.8 and MySQL from XAMPP.
When I run this node.js app (app.js):
var mysql = require('mysql-libmysqlclient');
var conn = mysql.createConnectionSync();
conn.connectSync('127.0.0.1', 'root', '', 'database_name');
I see this output:
Airs0urce:nodejs airs0urce$ node app.js
dyld: lazy symbol binding failed: Symbol not found: _mysql_init
Referenced from: /Applications/XAMPP/xamppfiles/htdocs/myproject/nodejs/node_modules/mysql-libmysqlclient/build/Release/mysql_bindings.node
Expected in: dynamic lookup
dyld: Symbol not found: _mysql_init
Referenced from: /Applications/XAMPP/xamppfiles/htdocs/myproject/nodejs/node_modules/mysql-libmysqlclient/build/Release/mysql_bindings.node
Expected in: dynamic lookup
Trace/BPT trap
Already tried couple solutions after googling.
Added mysql libs from XAMPP directory to include path this way:
export DYLD_LIBRARY_PATH=/Applications/XAMPP/xamppfiles/lib/mysql:$DYLD_LIBRARY_PATH
tried to install mysql5-devel using MacPorts, but no luck, building failed:
Airs0urce:~ airs0urce$ sudo port install mysql5-devel
---> Computing dependencies for mysql5-devel
---> Building mysql5-devel
Error: Target org.macports.build returned: shell command failed (see log for details)
Log for mysql5-devel is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_databases_mysql5-devel/mysql5-devel/main.log
Error: Status 1 encountered during processing.
To report a bug, see <http://guide.macports.org/#project.tickets>
There is log file if you want to see: http://dl.dropbox.com/u/1875424/main.log
This is because of a config issue on Mac OS X Lion (10.7): lib/libmysqlclient.18.dylib (mysql 5.5 and above).
Step 1:
Make sure you set the path in ~/.profile
export ARCHFLAGS=-arch x86_64
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH
Step 2:
I am using rvm so, I used the following command:
rvmsudo ARCHFLAGS="-arch x86_64" gem install mysql2 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config --with-opt-lib=/usr/local/mysql/lib
which has solved the issues with rails application on Mac lion and mysql x86_64.
I futzed around with this for a ton of time including setting the DVLD library path and copying the library into /usr/lib.
sudo cp /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib
Heck, anything to get it working. Finally I tried clearing the default for 64 vs 32 bit and it worked!
defaults delete com.apple.versioner.perl
Not sure if my perl is 64 or 32 bit, but my db is 64 bit and just using the default default seems to work better ;-)

Ruby on Rails and MySQL error

I'm very new to Ruby on Rails, and have been getting the following error every time I run:
rails s
I get the following error:
dyld: lazy symbol binding failed: Symbol not found: _mysql_get_client_info
Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2/mysql2.bundle
Expected in: flat namespace
dyld: Symbol not found: _mysql_get_client_info
Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2/mysql2.bundle
Expected in: flat namespace
Trace/BPT trap
I've done quite a bit of research on this on StackOverflow and good ol' Google, and have tried the solutions on this post: rails server error ? (rails 3) with editing the .profile file, as well as ensuring that mysql and ruby are were both installed for 64-bit systems.
I'm running on OSX Snow Leopard, using Rails 3.0.9 and Ruby 1.8.7.
Any help would be greatly appreciated!! Thank you! :)
To run Rails 3 you need ruby 1.9.2. I would start there before going any further, please check this link out, your best bet is to use rvm to manage your ruby version. Regards
http://amerine.net/2010/02/24/rvm-rails3-ruby-1-9-2-setup.html

perl cannot compile with error of lazy symbol binding not found for _mysql_init

I'm running mac OS X Snow Leopard and I recognize that this is a common problem.
I have installed and reinstalled both the 32- and 64-bit binary installations of MySQL.
That didn't work, so I went ahead and (against my common sense) installed perl5 through macports to have an entirely different perl than the version that ships with Snow Leopard.
I re-installed DBI and DBD::mysql modules into the new perl, both with success.
And yet still:
me$ perl5 processmail
dyld: lazy symbol binding failed: Symbol not found: _mysql_init
Referenced from: /opt/local/lib/perl5/site_perl/5.8.9/darwin- 2level/auto/DBD/mysql/mysql.bundle
Expected in: dynamic lookup
dyld: Symbol not found: _mysql_init
Referenced from: /opt/local/lib/perl5/site_perl/5.8.9/darwin-2level/auto/DBD/mysql/mysql.bundle
Expected in: dynamic lookup
I have also tried perl5 processmail --mysql_config=/usr/local/mysql/bin/mysql_config.
Thanks in advance
Do you get the same error running your perl script as root?
Does your shell environment possibly have VERSIONER_PERL_PREFER_32_BIT=no set?
there's more info about both of these at http://www.perlmonks.org/?node_id=793727
I just finally solved this on our box by getting rid of the default setting
defaults delete com.apple.versioner.perl
Suddenly it just works! Whatever

Mysql Snow leopard issue

Just installed snow leopard and Xcode, i downloaded version 5.1.38 from the mysql website and installed it, then i ran sudo gem uninstall mysql and when i try to gem install mysql as below i get a documentation error, also when i try to run mysql by simply typing mysql into terminal i get -bash: mysql: command not found. When i try to connect via MySql Administrator (gui) and also through my ruby on rails app i get Can't connect to local MySQL server through socket '/tmp/mysql.sock. Any suggestions?
$ sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
Building native extensions. This could take a while...
Successfully installed mysql-2.8.1
1 gem installed
Installing ri documentation for mysql-2.8.1...
No definition for next_result
No definition for field_name
No definition for field_table
No definition for field_def
No definition for field_type
No definition for field_length
No definition for field_max_length
No definition for field_flags
No definition for field_decimals
No definition for time_inspect
No definition for time_to_s
No definition for time_get_year
No definition for time_get_month
No definition for time_get_day
No definition for time_get_hour
No definition for time_get_minute
No definition for time_get_second
No definition for time_get_neg
No definition for time_get_second_part
No definition for time_set_year
No definition for time_set_month
No definition for time_set_day
No definition for time_set_hour
No definition for time_set_minute
No definition for time_set_second
No definition for time_set_neg
No definition for time_set_second_part
No definition for time_equal
No definition for error_errno
No definition for error_sqlstate
Installing RDoc documentation for mysql-2.8.1...
No definition for next_result
No definition for field_name
No definition for field_table
No definition for field_def
No definition for field_type
No definition for field_length
No definition for field_max_length
No definition for field_flags
No definition for field_decimals
No definition for time_inspect
No definition for time_to_s
No definition for time_get_year
No definition for time_get_month
No definition for time_get_day
No definition for time_get_hour
No definition for time_get_minute
No definition for time_get_second
No definition for time_get_neg
No definition for time_get_second_part
No definition for time_set_year
No definition for time_set_month
No definition for time_set_day
No definition for time_set_hour
No definition for time_set_minute
No definition for time_set_second
No definition for time_set_neg
No definition for time_set_second_part
No definition for time_equal
No definition for error_errno
No definition for error_sqlstate
Me and my team member successfully following steps from http://weblog.rubyonrails.org/2009/8/30/upgrading-to-snow-leopard
but rather than update MacPort, We re-install it from dmg file. The Rubygems by get it update manually
sudo gem install rubygems-update
Snow Leopard screws up Mac Ports and MySQL. There's another SO question about it here.
Ok, i found my answer here:
http://forums.mysql.com/read.php?116,359591,359591#msg-359591
Make sure you read all the post.
The author says specifically:
"So what you're looking for here is not a universal, "right instruction" to install the mysql gem; what we need is universal instruction to build the right instruction for our particular gem and MySQL installation."
For me the right solution was:
sudo env ARCHFLAGS="-arch x86_64" gem install mysql --no-rdoc --no-ri -- --with-mysql-config=/usr/local/mysql/bin/mysql_config