bundle install
时遇到如下错误
Fetching mysql2 0.5.3
Installing mysql2 0.5.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.current directory: /Users/xander/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/mysql2-0.5.3/ext/mysql2
/Users/xander/.rbenv/versions/2.5.1/bin/ruby -r ./siteconf20200308-15863-1iy900d.rb extconf.rb
checking for rbabsintsize()... yes
checking for rbabsintsinglebitp()... yeschecking for rbwaitforsinglefd()... yes
Using mysqlconfig at /usr/local/bin/mysqlconfig
checking for mysql.h... yes
checking for errmsg.h... yes
checking for SSLMODEDISABLED in mysql.h... yes
checking for SSLMODEPREFERRED in mysql.h... yes
checking for SSLMODEREQUIRED in mysql.h... yes
checking for SSLMODEVERIFYCA in mysql.h... yes
checking for SSLMODEVERIFYIDENTITY in mysql.h... yes
checking for MYSQL.net.vio in mysql.h... yes
checking for MYSQL.net.pvio in mysql.h... no
checking for MYSQLENABLECLEARTEXTPLUGIN in mysql.h... yes
checking for SERVERQUERYNOGOODINDEXUSED in mysql.h... yes
checking for SERVERQUERYNOINDEXUSED in mysql.h... yes
checking for SERVERQUERYWASSLOW in mysql.h... yes
checking for MYSQLOPTIONMULTISTATEMENTSON in mysql.h... yes
checking for MYSQLOPTIONMULTISTATEMENTSOFF in mysql.h... yeschecking for mybool in mysql.h... no
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/8.0.19/lib
creating Makefile
current directory: /Users/xander/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/mysql2-0.5.3/ext/mysql2
make "DESTDIR=" cleancurrent directory: /Users/xander/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/mysql2-0.5.3/ext/mysql2
make "DESTDIR="
compiling client.c
compiling infile.c
compiling mysql2ext.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 1make failed, exit code 2
Gem files will remain installed in /Users/xander/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/mysql2-0.5.3 for inspection.
Results logged to /Users/xander/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/extensions/x8664-darwin-19/2.5.0/mysql2-0.5.3/gemmake.outAn error occurred while installing mysql2 (0.5.3), and Bundler cannot continue.
Make sure thatgem install mysql2 -v '0.5.3' --source 'https://gems.ruby-china.com/'
succeeds before bundling.In Gemfile:
mysql2
即使执行
brew install mysql
安装mysql依然报错, 通过如下操作解决:
bundle config --local build.mysql2 "--with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include"
bundle install