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

Gem native extension build fails after upgrade to MacOS 10.4 Mojave #1005

Open
chriskozlowski opened this Issue Sep 26, 2018 · 4 comments

Comments

Projects
None yet
3 participants
@chriskozlowski

chriskozlowski commented Sep 26, 2018

Hi,

Having trouble installing the mysql2 gem after upgrade to MacOS Mojave. Other gems with native extensions do work (i.e. nokogiri). Any help would be greatly appreciated. Thank you!

Environment:

  • mysql@5.7 freshly installed via Homebrew
  • mysql2 versions attempted: 0.4.9, 0.4.10, 0.5.2 (same outcome for all)
  • XCode 10 - I ensured that latest command line tools were installed

Output from build step

ERROR:  Error installing mysql2:
	ERROR: Failed to build gem native extension.

    current directory: /Users/chriskozlowski/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/mysql2-0.5.2/ext/mysql2
/Users/chriskozlowski/.rbenv/versions/2.3.7/bin/ruby -r ./siteconf20180926-18671-1g3sg4b.rb extconf.rb
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for rb_wait_for_single_fd()... yes
-----
Using mysql_config at /usr/local/bin/mysql_config
-----
checking for mysql.h... yes
checking for errmsg.h... yes
checking for SSL_MODE_DISABLED in mysql.h... yes
checking for SSL_MODE_PREFERRED in mysql.h... yes
checking for SSL_MODE_REQUIRED in mysql.h... yes
checking for SSL_MODE_VERIFY_CA in mysql.h... yes
checking for SSL_MODE_VERIFY_IDENTITY in mysql.h... yes
checking for MYSQL.net.vio in mysql.h... yes
checking for MYSQL.net.pvio in mysql.h... no
checking for MYSQL_ENABLE_CLEARTEXT_PLUGIN in mysql.h... yes
checking for SERVER_QUERY_NO_GOOD_INDEX_USED in mysql.h... yes
checking for SERVER_QUERY_NO_INDEX_USED in mysql.h... yes
checking for SERVER_QUERY_WAS_SLOW in mysql.h... yes
checking for MYSQL_OPTION_MULTI_STATEMENTS_ON in mysql.h... yes
checking for MYSQL_OPTION_MULTI_STATEMENTS_OFF in mysql.h... yes
checking for my_bool in mysql.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/mysql@5.7/5.7.23/lib
-----
creating Makefile

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/chriskozlowski/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-18/2.3.0-static/mysql2-0.5.2/mkmf.log

current directory: /Users/chriskozlowski/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/mysql2-0.5.2/ext/mysql2
make "DESTDIR=" clean

current directory: /Users/chriskozlowski/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/mysql2-0.5.2/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 /Users/chriskozlowski/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/mysql2-0.5.2 for inspection.
Results logged to /Users/chriskozlowski/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-18/2.3.0-static/mysql2-0.5.2/gem_make.out

gem_make.out

gem_make.out.txt

@jeremy

This comment has been minimized.

Show comment
Hide comment
@jeremy

jeremy Sep 26, 2018

Contributor
ld: library not found for -lssl

Which openssl are you building against? Do you have it installed with Homebrew (brew install openssl)?

Contributor

jeremy commented Sep 26, 2018

ld: library not found for -lssl

Which openssl are you building against? Do you have it installed with Homebrew (brew install openssl)?

@chriskozlowski

This comment has been minimized.

Show comment
Hide comment
@chriskozlowski

chriskozlowski Sep 26, 2018

I believe the default Mac OS lib. I actually did install openssl via Homebrew to see if that would work but I do not know how to ensure that the build uses that version. I tried brew link openssl --force but that was a guess. Can you tell me how?

chriskozlowski commented Sep 26, 2018

I believe the default Mac OS lib. I actually did install openssl via Homebrew to see if that would work but I do not know how to ensure that the build uses that version. I tried brew link openssl --force but that was a guess. Can you tell me how?

@andrewhao

This comment has been minimized.

Show comment
Hide comment
@andrewhao

andrewhao Sep 26, 2018

This worked for me: https://stackoverflow.com/a/39628463

$ bundle config --local build.mysql2 "--with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include"

andrewhao commented Sep 26, 2018

This worked for me: https://stackoverflow.com/a/39628463

$ bundle config --local build.mysql2 "--with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include"
@chriskozlowski

This comment has been minimized.

Show comment
Hide comment
@chriskozlowski

chriskozlowski Sep 26, 2018

That worked! Thank you @andrewhao!

chriskozlowski commented Sep 26, 2018

That worked! Thank you @andrewhao!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment