Skip to content

Instantly share code, notes, and snippets.

@hchood
Created March 11, 2022 21:53
Show Gist options
  • Save hchood/44930b4b5a40610879f2b4821bd4b157 to your computer and use it in GitHub Desktop.
Save hchood/44930b4b5a40610879f2b4821bd4b157 to your computer and use it in GitHub Desktop.
bundle install error
Installing rails 6.1.5
Installing react-rails 2.6.1
Installing webpacker 6.0.0.rc.5
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/mysql2-0.5.3/ext/mysql2
/Users/helenhood/.asdf/installs/ruby/3.0.3/bin/ruby -I
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/3.0.0 -r
./siteconf20220311-17083-lpahbc.rb extconf.rb
--with-opt-dir\=/opt/homebrew/opt/openssl@3
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 /opt/homebrew/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... 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 /opt/homebrew/Cellar/mysql/8.0.28/lib
-----
creating Makefile
current directory:
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/mysql2-0.5.3/ext/mysql2
make DESTDIR\= clean
current directory:
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/mysql2-0.5.3/ext/mysql2
make DESTDIR\=
compiling client.c
client.c:787:14: warning: incompatible function pointer types passing
'VALUE (void *)' (aka 'unsigned long (void *)') to parameter of type
'VALUE (*)(VALUE)' (aka 'unsigned long (*)(unsigned long)')
[-Wincompatible-function-pointer-types]
rb_rescue2(do_send_query, (VALUE)&args, disconnect_and_raise, self,
rb_eException, (VALUE)0);
^~~~~~~~~~~~~
/Users/helenhood/.asdf/installs/ruby/3.0.3/include/ruby-3.0.0/ruby/internal/iterator.h:51:25:
note: passing argument to parameter here
VALUE rb_rescue2(VALUE(*)(VALUE),VALUE,VALUE(*)(VALUE,VALUE),VALUE,...);
^
client.c:795:16: warning: incompatible function pointer types passing
'VALUE (void *)' (aka 'unsigned long (void *)') to parameter of type
'VALUE (*)(VALUE)' (aka 'unsigned long (*)(unsigned long)')
[-Wincompatible-function-pointer-types]
rb_rescue2(do_query, (VALUE)&async_args, disconnect_and_raise, self,
rb_eException, (VALUE)0);
^~~~~~~~
/Users/helenhood/.asdf/installs/ruby/3.0.3/include/ruby-3.0.0/ruby/internal/iterator.h:51:25:
note: passing argument to parameter here
VALUE rb_rescue2(VALUE(*)(VALUE),VALUE,VALUE(*)(VALUE,VALUE),VALUE,...);
^
2 warnings generated.
compiling infile.c
compiling mysql2_ext.c
compiling result.c
compiling statement.c
linking shared-object mysql2/mysql2.bundle
ld: library not found for -lzstd
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/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/mysql2-0.5.3
for inspection.
Results logged to
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/extensions/arm64-darwin-21/3.0.0/mysql2-0.5.3/gem_make.out
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/3.0.0/rubygems/ext/builder.rb:93:in
`run'
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/3.0.0/rubygems/ext/builder.rb:44:in
`block in make'
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/3.0.0/rubygems/ext/builder.rb:36:in
`each'
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/3.0.0/rubygems/ext/builder.rb:36:in
`make'
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/3.0.0/rubygems/ext/ext_conf_builder.rb:63:in
`block in build'
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/3.0.0/tempfile.rb:317:in
`open'
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/3.0.0/rubygems/ext/ext_conf_builder.rb:26:in
`build'
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/3.0.0/rubygems/ext/builder.rb:159:in
`build_extension'
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/3.0.0/rubygems/ext/builder.rb:193:in
`block in build_extensions'
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/3.0.0/rubygems/ext/builder.rb:190:in
`each'
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/3.0.0/rubygems/ext/builder.rb:190:in
`build_extensions'
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/3.0.0/rubygems/installer.rb:845:in
`build_extensions'
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/3.0.0/bundler/rubygems_gem_installer.rb:71:in
`build_extensions'
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/3.0.0/bundler/rubygems_gem_installer.rb:28:in
`install'
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/3.0.0/bundler/source/rubygems.rb:200:in
`install'
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/3.0.0/bundler/installer/gem_installer.rb:54:in
`install'
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/3.0.0/bundler/installer/gem_installer.rb:59:in
`block in install_with_settings'
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/3.0.0/bundler/rubygems_integration.rb:575:in
`install_with_build_args'
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/3.0.0/bundler/installer/gem_installer.rb:59:in
`install_with_settings'
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/3.0.0/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/3.0.0/bundler/installer/parallel_installer.rb:186:in
`do_install'
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/3.0.0/bundler/installer/parallel_installer.rb:177:in
`block in worker_pool'
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/3.0.0/bundler/worker.rb:62:in
`apply_func'
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/3.0.0/bundler/worker.rb:57:in
`block in process_queue'
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/3.0.0/bundler/worker.rb:54:in
`loop'
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/3.0.0/bundler/worker.rb:54:in
`process_queue'
/Users/helenhood/.asdf/installs/ruby/3.0.3/lib/ruby/3.0.0/bundler/worker.rb:91:in
`block (2 levels) in create_threads'
An error occurred while installing mysql2 (0.5.3), and Bundler
cannot continue.
In Gemfile:
alterity was resolved to 1.4.2, which depends on
mysql2
@rmarescu
Copy link

I usually have to install mysql gem manually with the following command (where 8.0.27 represents the version available on the machine) [ref]

gem install mysql2 -v '0.5.3' -- \
 --with-mysql-lib=/opt/homebrew/Cellar/mysql/8.0.27/lib \
 --with-mysql-dir=/opt/homebrew/Cellar/mysql/8.0.27 \
 --with-mysql-config=/opt/homebrew/Cellar/mysql/8.0.27/bin/mysql_config \
 --with-mysql-include=/opt/homebrew/Cellar/mysql/8.0.27/include

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