Mac OSX: MySQL gem installation failed (RoR)

I am running OSX 10.7 (Lion) and recently uninstalled MacPorts because MySQL did not start. MySQL (64-bit) now starts, but now I can’t install MySQL gem (Rails). I tried using the with-mysql-config and ARCHFLAGS , none of which worked. I tried reinstalling Ruby 1.9.3, which didn't change anything either. I am currently running MySQL 5.1.61 after I thought that MySQL 5.0.95 might cause the problem. Here is the trace:

 Christy$ gem install mysql2 Building native extensions. This could take a while... ERROR: Error installing mysql2: ERROR: Failed to build gem native extension. /Users/Christy/.rvm/rubies/ruby-1.9.3-p0/bin/ruby extconf.rb checking for rb_thread_blocking_region()... yes checking for rb_wait_for_single_fd()... yes checking for mysql.h... yes checking for errmsg.h... yes checking for mysqld_error.h... yes creating Makefile make compiling client.c client.c: In function 'rb_raise_mysql2_error': client.c:98: warning: ISO C90 forbids mixed declarations and code client.c: In function 'rb_mysql_client_socket': client.c:590: warning: ISO C90 forbids mixed declarations and code compiling mysql2_ext.c compiling result.c linking shared-object mysql2/mysql2.bundle ld: file not found: /opt/local/lib/libssl.1.0.0.dylib for architecture x86_64 collect2: ld returned 1 exit status make: *** [mysql2.bundle] Error 1 

I tried reinstalling openssl (assuming file not found: /opt/local/lib/libssl.1.0.0.dylib maybe because of this), but it still doesn't work. I’m kind of new to this, so any help would be greatly appreciated! Thanks!

EDIT : /opt/local/lib/ does not exist. I do not know why it is looking for a file. Any ideas on how to point it to the right place ( locate libssl points to /usr/lib/libssl.0.9.8.dylib and /usr/local/Cellar/openssl/0.9.8s/lib/libssl.0.9.8.dylib , among other places)?

+4
source share
4 answers

LD_LIBRARY_PATH has the wrong path. You can temporarily install it for this shell by running export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib ; gem install mysql2 export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib ; gem install mysql2 .

However, it may suggest adding a definition to your .bashrc (or other appropriate .shellrc file) export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib so that all its shells receive it.

+1
source

My problem was similar, and it turned out that I installed mysql with brew while macports were still installed. After completely removing macports, I then uninstalled and reinstalled mysql using brew:

 brew uninstall mysql brew install mysql 
+2
source

I had to set the path to my mysql installation, which was 5.1. Performing this, it worked:

 export ARCHFLAGS="-arch x86_64" export PATH=$PATH:/opt/local/lib/mysql51/bin 
+2
source

Not sure, but maybe you need to install the libssl-dev package to compile it

0
source

Source: https://habr.com/ru/post/1397303/


All Articles