Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Install mysql2 0.4.5 gem #1071

Closed
klementtan opened this issue Sep 19, 2019 · 7 comments
Closed

Error Install mysql2 0.4.5 gem #1071

klementtan opened this issue Sep 19, 2019 · 7 comments

Comments

@klementtan
Copy link

Hi I have error installing mysql 0.4.5 gem.

I tried downloading opensll

Tried this solution
#1005 (comment)

but I still get this error message

gem install mysql2 -v '0.4.5' -- --with-mysql-config=/usr/local/Cellar/[email protected]/5.6.43/bin/mysql_config
Building native extensions with: '--with-mysql-config=/usr/local/Cellar/[email protected]/5.6.43/bin/mysql_config'
This could take a while...
ERROR:  Error installing mysql2:
	ERROR: Failed to build gem native extension.

    current directory: /usr/local/var/rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/mysql2-0.4.5/ext/mysql2
/usr/local/var/rbenv/versions/2.4.4/bin/ruby -r ./siteconf20190919-45649-1qutd9k.rb extconf.rb --with-mysql-config=/usr/local/Cellar/[email protected]/5.6.43/bin/mysql_config
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for rb_big_cmp()... yes
-----
Using mysql_config at /usr/local/Cellar/[email protected]/5.6.43/bin/mysql_config
-----
checking for mysql.h... yes
checking for SSL_MODE_DISABLED in mysql.h... no
checking for MYSQL_OPT_SSL_ENFORCE in mysql.h... no
checking for errmsg.h... yes
checking for mysqld_error.h... yes
-----
Don't know how to set rpath on your system, if MySQL libraries are not in path mysql2 may not load
-----
-----
Setting libpath to /usr/local/Cellar/[email protected]/5.6.43/lib
-----
creating Makefile

current directory: /usr/local/var/rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/mysql2-0.4.5/ext/mysql2
make "DESTDIR=" clean

current directory: /usr/local/var/rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/mysql2-0.4.5/ext/mysql2
make "DESTDIR="
compiling client.c
compiling infile.c
compiling mysql2_ext.c
compiling result.c
compiling statement.c
linking shared-object mysql2/mysql2.bundle
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mysql2.bundle] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/var/rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/mysql2-0.4.5 for inspection.
Results logged to /usr/local/var/rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-18/2.4.0-static/mysql2-0.4.5/gem_make.out

Please help me thank you

@lucasfeijo
Copy link

lucasfeijo commented Sep 27, 2019

@klementtan Create if not exists: ~/.bundle/config and add BUNDLE_BUILD__MYSQL2: --with-opt-dir=/usr/local/opt/openssl.

@sodabrew
Copy link
Collaborator

@klementtan Does this resolve your issue?

@tetsundo
Copy link

@klementtan Create if not exists: ~/.bundle/config and add BUNDLE_BUILD__MYSQL2: --with-opt-dir=/usr/local/opt/openssl.

this way works for me

@Rdlima83
Copy link

BUNDLE_BUILD__MYSQL2: --with-opt-dir=/usr/local/opt/openssl

i'm with the same problem. I created the directory, but i dont know how to "ADD" BUNDLE_BUILD__MYSQL2: --with-opt-dir=/usr/local/opt/openssl. Please help me!

@tetsundo
Copy link

@Rdlima83
open your terminal and , command this$ vi ~/.bundle/config and add BUNDLE_BUILD__MYSQL2: --with-opt-dir=/usr/local/opt/openssl then save.

@Muhammad-Waleed-Khalid-Pakeventure

run this command
bundle config build.mysql2 --with-opt-dir=$(brew --prefix [email protected])

@klementtan
Copy link
Author

Yup, this solved the issue. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants