Gem mysql2 adapter not installing - mysql

When I try to install the mysql2 adapter gem, I get this error:
gem install mysql2 -v 0.3.21
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/Users/jwan/.rbenv/versions/2.1.2/bin/ruby extconf.rb
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
-----
Using mysql_config at /usr/local/bin/mysql_config
-----
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
-----
Setting rpath to /usr/local/Cellar/mysql/8.0.12/lib
-----
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling infile.c
compiling client.c
client.c:439:3: error: use of undeclared identifier 'my_bool'
my_bool res = mysql_read_query_result(client);
^
client.c:441:19: error: use of undeclared identifier 'res'
return (void *)(res == 0 ? Qtrue : Qfalse);
^
client.c:762:3: error: use of undeclared identifier 'my_bool'
my_bool boolval;
^
client.c:793:7: error: use of undeclared identifier 'boolval'
boolval = (value == Qfalse ? 0 : 1);
^
client.c:794:17: error: use of undeclared identifier 'boolval'
retval = &boolval;
^
client.c:797:10: error: use of undeclared identifier 'MYSQL_SECURE_AUTH'; did you mean 'MYSQL_DEFAULT_AUTH'?
case MYSQL_SECURE_AUTH:
^~~~~~~~~~~~~~~~~
MYSQL_DEFAULT_AUTH
/usr/local/Cellar/mysql/8.0.12/include/mysql/mysql.h:188:3: note: 'MYSQL_DEFAULT_AUTH' declared here
MYSQL_DEFAULT_AUTH,
^
client.c:798:7: error: use of undeclared identifier 'boolval'
boolval = (value == Qfalse ? 0 : 1);
^
client.c:799:17: error: use of undeclared identifier 'boolval'
retval = &boolval;
^
client.c:830:38: error: use of undeclared identifier 'boolval'
wrapper->reconnect_enabled = boolval;
^
client.c:1185:38: error: use of undeclared identifier 'MYSQL_SECURE_AUTH'; did you mean 'MYSQL_DEFAULT_AUTH'?
return _mysql_client_options(self, MYSQL_SECURE_AUTH, value);
^~~~~~~~~~~~~~~~~
MYSQL_DEFAULT_AUTH
/usr/local/Cellar/mysql/8.0.12/include/mysql/mysql.h:188:3: note: 'MYSQL_DEFAULT_AUTH' declared here
MYSQL_DEFAULT_AUTH,
^
10 errors generated.
make: *** [client.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/jwan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/mysql2-0.3.21 for inspection.
What does it mean and what is going on?
What does this line do: Setting rpath to /usr/local/Cellar/mysql/8.0.12/lib
Can I try pointing it to another version of mysql?

Because you're using an incomaptible version of the mysql2 gem for your rails version You have to make all the gem versions in your Gemfile a proper match One good way to do that is to google rubygems (gem name) versions and see it's runtime dependences and it's release date The release dates can be compared to the release dates of rails versions and other gems that it depends on When you're new it can take a little time

Related

Can not install mysql2-0.3.16 on Mac M1

Trying to launch my work project, but when I do bundle I get this error
Fetching mysql2 0.3.16
Installing mysql2 0.3.16 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/alexandra_shimanovich/.bundle/ruby/2.5.0/gems/mysql2-0.3.16/ext/mysql2
/Users/alexandra_shimanovich/.rbenv/versions/2.5.5/bin/ruby -I /Users/alexandra_shimanovich/.rbenv/versions/2.5.5/lib/ruby/site_ruby/2.5.0 -r ./siteconf20220608-34831-zm49z7.rb extconf.rb
--with-mysql-lib\=/opt/homebrew/opt/mysql/lib\ --with-mysql-dir\=/opt/homebrew/opt/mysql\ --with-mysql-config\=/opt/homebrew/opt/mysql/bin/mysql_config\
--with-mysql-include\=/opt/homebrew/opt/mysql/include\ --with-ldflags\=-L/opt/homebrew/opt/openssl#3/lib\ --with-cppflags\=-I/opt/homebrew/opt/openssl#3/include
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... no
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... no
checking for rb_hash_dup()... no
checking for rb_intern3()... no
-----
Using mysql_config at /opt/homebrew/bin/mysql_config
-----
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
-----
Setting rpath to /opt/homebrew/Cellar/mysql/8.0.29/lib
-----
creating Makefile
current directory: /Users/alexandra_shimanovich/.bundle/ruby/2.5.0/gems/mysql2-0.3.16/ext/mysql2
make DESTDIR\= clean
current directory: /Users/alexandra_shimanovich/.bundle/ruby/2.5.0/gems/mysql2-0.3.16/ext/mysql2
make DESTDIR\=
compiling client.c
In file included from client.c:1:
In file included from ./mysql2_ext.h:41:
In file included from ./client.h:18:
/Users/alexandra_shimanovich/.rbenv/versions/2.5.5/include/ruby-2.5.0/ruby/backward/rubysig.h:14:2: warning: rubysig.h is obsolete [-W#warnings]
#warning rubysig.h is obsolete
^
In file included from client.c:1:
In file included from ./mysql2_ext.h:41:
./client.h:22:1: error: static declaration of 'rb_thread_call_without_gvl' follows non-static declaration
rb_thread_call_without_gvl(
^
/Users/alexandra_shimanovich/.rbenv/versions/2.5.5/include/ruby-2.5.0/ruby/thread.h:28:7: note: previous declaration is here
void *rb_thread_call_without_gvl(void *(*func)(void *), void *data1,
^
In file included from client.c:1:
In file included from ./mysql2_ext.h:41:
./client.h:29:3: error: use of undeclared identifier 'TRAP_BEG'
TRAP_BEG;
^
./client.h:31:3: error: use of undeclared identifier 'TRAP_END'
TRAP_END;
^
In file included from client.c:11:
./wait_for_single_fd.h:31:10: warning: implicit declaration of function 'rb_thread_select' is invalid in C99 [-Wimplicit-function-declaration]
return rb_thread_select(fd + 1, rfds, wfds, efds, tvp);
^
client.c:21:14: error: static declaration of 'rb_hash_dup' follows non-static declaration
static VALUE rb_hash_dup(VALUE other) {
^
/Users/alexandra_shimanovich/.rbenv/versions/2.5.5/include/ruby-2.5.0/ruby/intern.h:494:7: note: previous declaration is here
VALUE rb_hash_dup(VALUE);
^
client.c:22:31: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
return rb_funcall(rb_cHash, rb_intern("[]"), 1, other);
^~~~~~~~~~~~~~~
/Users/alexandra_shimanovich/.rbenv/versions/2.5.5/include/ruby-2.5.0/ruby/ruby.h:1755:23: note: expanded from macro 'rb_intern'
__extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \
^
client.c:22:31: note: '{' token is here
return rb_funcall(rb_cHash, rb_intern("[]"), 1, other);
^~~~~~~~~~~~~~~
/Users/alexandra_shimanovich/.rbenv/versions/2.5.5/include/ruby-2.5.0/ruby/ruby.h:1755:24: note: expanded from macro 'rb_intern'
__extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/alexandra_shimanovich/.rbenv/versions/2.5.5/include/ruby-2.5.0/ruby/ruby.h:1740:5: note: expanded from macro 'RUBY_CONST_ID_CACHE'
{ \
^
client.c:22:31: warning: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
return rb_funcall(rb_cHash, rb_intern("[]"), 1, other);
^~~~~~~~~~~~~~~
/Users/alexandra_shimanovich/.rbenv/versions/2.5.5/include/ruby-2.5.0/ruby/ruby.h:1755:24: note: expanded from macro 'rb_intern'
__extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/alexandra_shimanovich/.rbenv/versions/2.5.5/include/ruby-2.5.0/ruby/ruby.h:1745:5: note: expanded from macro 'RUBY_CONST_ID_CACHE'
}
^
client.c:22:31: note: ')' token is here
return rb_funcall(rb_cHash, rb_intern("[]"), 1, other);
^~~~~~~~~~~~~~~
....................
client.c:1396:31: warning: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
rb_const_set(cMysql2Client, rb_intern("BASIC_FLAGS"),
^~~~~~~~~~~~~~~~~~~~~~~~
/Users/alexandra_shimanovich/.rbenv/versions/2.5.5/include/ruby-2.5.0/ruby/ruby.h:1755:24: note: expanded from macro 'rb_intern'
__extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/alexandra_shimanovich/.rbenv/versions/2.5.5/include/ruby-2.5.0/ruby/ruby.h:1745:5: note: expanded from macro 'RUBY_CONST_ID_CACHE'
}
^
client.c:1396:31: note: ')' token is here
rb_const_set(cMysql2Client, rb_intern("BASIC_FLAGS"),
^~~~~~~~~~~~~~~~~~~~~~~~
/Users/alexandra_shimanovich/.rbenv/versions/2.5.5/include/ruby-2.5.0/ruby/ruby.h:1755:56: note: expanded from macro 'rb_intern'
__extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \
^
70 warnings and 14 errors generated.
make: *** [client.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/alexandra_shimanovich/.bundle/ruby/2.5.0/gems/mysql2-0.3.16 for inspection.
Results logged to /Users/alexandra_shimanovich/.bundle/ruby/2.5.0/extensions/-darwin-21/2.5.0/mysql2-0.3.16/gem_make.out
An error occurred while installing mysql2 (0.3.16), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.16' --source 'http://rubygems.org/'` succeeds before bundling.
macOS Monterey 12.2.1 Apple M1
ruby 2.5.5
I did all existing suggestions on the Internet, but still no luck, maybe here somebody can help me.
Thank you!

Error Installing mysql2 0.3.17 on Mac OSX - "Gem::Ext::BuildError: Failed to build gem native extensions."

Installing Ruby/Rails/MySQL on a new MacBook Pro running OS High Sierra 10.13.6
I have Ruby version 2.1.4 installed via RVM (it's the version of Ruby used for this particular repo).
mysql is installed via brew:
mysql --version
mysql Ver 8.0.12 for osx10.13 on x86_64 (Homebrew)
Then running bundle install and everything looks good except the process breaks when it tries to install the mysql2 gem:
Fetching mysql2 0.3.17
Installing mysql2 0.3.17 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/Users/gregorybilello/.rvm/gems/ruby-2.1.4/gems/mysql2-0.3.17/ext/mysql2
/Users/gregorybilello/.rvm/rubies/ruby-2.1.4/bin/ruby -r
./siteconf20180926-52571-ppybdv.rb extconf.rb
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
-----
Using mysql_config at /usr/local/bin/mysql_config
-----
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
-----
Setting rpath to /usr/local/Cellar/mysql/8.0.12/lib
-----
creating Makefile
current directory:
/Users/gregorybilello/.rvm/gems/ruby-2.1.4/gems/mysql2-0.3.17/ext/mysql2
make "DESTDIR=" clean
current directory:
/Users/gregorybilello/.rvm/gems/ruby-2.1.4/gems/mysql2-0.3.17/ext/mysql2
make "DESTDIR="
compiling infile.c
compiling client.c
client.c:359:33: warning: implicit conversion loses integer precision: 'long' to
'unsigned int' [-Wshorten-64-to-32]
elapsed_time = end_time - start_time;
~ ~~~~~~~~~^~~~~~~~~~~~
client.c:431:3: error: use of undeclared identifier 'my_bool'
my_bool res = mysql_read_query_result(client);
^
client.c:433:19: error: use of undeclared identifier 'res'
return (void *)(res == 0 ? Qtrue : Qfalse);
^
client.c:762:3: error: use of undeclared identifier 'my_bool'
my_bool boolval;
^
client.c:793:7: error: use of undeclared identifier 'boolval'
boolval = (value == Qfalse ? 0 : 1);
^
client.c:794:17: error: use of undeclared identifier 'boolval'
retval = &boolval;
^
client.c:797:10: error: use of undeclared identifier 'MYSQL_SECURE_AUTH'; did
you mean 'MYSQL_DEFAULT_AUTH'?
case MYSQL_SECURE_AUTH:
^~~~~~~~~~~~~~~~~
MYSQL_DEFAULT_AUTH
/usr/local/Cellar/mysql/8.0.12/include/mysql/mysql.h:188:3: note:
'MYSQL_DEFAULT_AUTH' declared here
MYSQL_DEFAULT_AUTH,
^
client.c:798:7: error: use of undeclared identifier 'boolval'
boolval = (value == Qfalse ? 0 : 1);
^
client.c:799:17: error: use of undeclared identifier 'boolval'
retval = &boolval;
^
client.c:830:38: error: use of undeclared identifier 'boolval'
wrapper->reconnect_enabled = boolval;
^
client.c:1163:56: warning: implicit conversion loses integer precision: 'size_t'
(aka 'unsigned long') to 'unsigned int' [-Wshorten-64-to-32]
mysql2rb = mysql2_mysql_enc_name_to_rb(charset_name, charset_name_len);
~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~
client.c:1196:38: error: use of undeclared identifier 'MYSQL_SECURE_AUTH'; did
you mean 'MYSQL_DEFAULT_AUTH'?
return _mysql_client_options(self, MYSQL_SECURE_AUTH, value);
^~~~~~~~~~~~~~~~~
MYSQL_DEFAULT_AUTH
/usr/local/Cellar/mysql/8.0.12/include/mysql/mysql.h:188:3: note:
'MYSQL_DEFAULT_AUTH' declared here
MYSQL_DEFAULT_AUTH,
^
2 warnings and 10 errors generated.
make: *** [client.o] Error 1
make failed, exit code 2
Gem files will remain installed in
/Users/gregorybilello/.rvm/gems/ruby-2.1.4/gems/mysql2-0.3.17 for inspection.
Results logged to
/Users/gregorybilello/.rvm/gems/ruby-2.1.4/extensions/x86_64-darwin-17/2.1.0/mysql2-0.3.17/gem_make.out
An error occurred while installing mysql2 (0.3.17), and Bundler cannot
continue.
Make sure that `gem install mysql2 -v '0.3.17' --source 'https://rubygems.org/'`
succeeds before bundling.
In Gemfile:
mysql2
gregorybilello#Gregorys-MBP-2 portal (production) $ mysql --version
mysql Ver 8.0.12 for osx10.13 on x86_64 (Homebrew)
gregorybilello#Gregorys-MBP-2 portal (production) $ gem install mysql2 -v '0.3.17' -- --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include
Building native extensions with: '--with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include'
This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
current directory: /Users/gregorybilello/.rvm/gems/ruby-2.1.4/gems/mysql2-0.3.17/ext/mysql2
/Users/gregorybilello/.rvm/rubies/ruby-2.1.4/bin/ruby -r ./siteconf20180926-53492-1uypkd1.rb extconf.rb --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
-----
Using mysql_config at /usr/local/bin/mysql_config
-----
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
-----
Setting rpath to /usr/local/Cellar/mysql/8.0.12/lib
-----
creating Makefile
current directory: /Users/gregorybilello/.rvm/gems/ruby-2.1.4/gems/mysql2-0.3.17/ext/mysql2
make "DESTDIR=" clean
current directory: /Users/gregorybilello/.rvm/gems/ruby-2.1.4/gems/mysql2-0.3.17/ext/mysql2
make "DESTDIR="
compiling infile.c
compiling client.c
client.c:359:33: warning: implicit conversion loses integer precision: 'long' to 'unsigned int' [-Wshorten-64-to-32]
elapsed_time = end_time - start_time;
~ ~~~~~~~~~^~~~~~~~~~~~
client.c:431:3: error: use of undeclared identifier 'my_bool'
my_bool res = mysql_read_query_result(client);
^
client.c:433:19: error: use of undeclared identifier 'res'
return (void *)(res == 0 ? Qtrue : Qfalse);
^
client.c:762:3: error: use of undeclared identifier 'my_bool'
my_bool boolval;
^
client.c:793:7: error: use of undeclared identifier 'boolval'
boolval = (value == Qfalse ? 0 : 1);
^
client.c:794:17: error: use of undeclared identifier 'boolval'
retval = &boolval;
^
client.c:797:10: error: use of undeclared identifier 'MYSQL_SECURE_AUTH'; did you mean 'MYSQL_DEFAULT_AUTH'?
case MYSQL_SECURE_AUTH:
^~~~~~~~~~~~~~~~~
MYSQL_DEFAULT_AUTH
/usr/local/Cellar/mysql/8.0.12/include/mysql/mysql.h:188:3: note: 'MYSQL_DEFAULT_AUTH' declared here
MYSQL_DEFAULT_AUTH,
^
client.c:798:7: error: use of undeclared identifier 'boolval'
boolval = (value == Qfalse ? 0 : 1);
^
client.c:799:17: error: use of undeclared identifier 'boolval'
retval = &boolval;
^
client.c:830:38: error: use of undeclared identifier 'boolval'
wrapper->reconnect_enabled = boolval;
^
client.c:1163:56: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'unsigned int' [-Wshorten-64-to-32]
mysql2rb = mysql2_mysql_enc_name_to_rb(charset_name, charset_name_len);
~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~
client.c:1196:38: error: use of undeclared identifier 'MYSQL_SECURE_AUTH'; did you mean 'MYSQL_DEFAULT_AUTH'?
return _mysql_client_options(self, MYSQL_SECURE_AUTH, value);
^~~~~~~~~~~~~~~~~
MYSQL_DEFAULT_AUTH
/usr/local/Cellar/mysql/8.0.12/include/mysql/mysql.h:188:3: note: 'MYSQL_DEFAULT_AUTH' declared here
MYSQL_DEFAULT_AUTH,
^
2 warnings and 10 errors generated.
make: *** [client.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/gregorybilello/.rvm/gems/ruby-2.1.4/gems/mysql2-0.3.17 for inspection.
Results logged to /Users/gregorybilello/.rvm/gems/ruby-2.1.4/extensions/x86_64-darwin-17/2.1.0/mysql2-0.3.17/gem_make.out
I'm sure I've done something wrong with the install, but any ideas of how to get this working? Thanks.

rake db:migrate - rake aborted LoadError: dlopen && Error installing mysql2

So I'm trying to run
rake db:migrate
and got the following error
rake aborted!
LoadError: dlopen(/Users/scott/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/mysql2-0.4.5/lib/mysql2/mysql2.bundle, 9): Library not loaded: /usr/local/opt/mysql/lib/libmysqlclient.20.dylib
Referenced from: /Users/scott/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/mysql2-0.4.5/lib/mysql2/mysql2.bundle
Reason: image not found - /Users/scott/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/mysql2-0.4.5/lib/mysql2/mysql2.bundle
/Users/scott/Google Drive/playground/myApp/myApp/config/application.rb:21:in `<top (required)>'
/Users/scott/Google Drive/playground/myApp/myApp/Rakefile:4:in `<top (required)>'
I uninstalled mysql2 and then ran
gem install mysql2 -v '0.4.5'
and hit the following error....
git:(master) ✗ gem install mysql2 -v '0.4.5'
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
current directory: /Users/scott/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/mysql2-0.4.5/ext/mysql2
/Users/scott/.rbenv/versions/2.4.1/bin/ruby -r ./siteconf20180709-8149-znoxt9.rb extconf.rb
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/mysql/bin/mysql_config
-----
checking for mysql.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 errmsg.h... yes
checking for mysqld_error.h... yes
-----
Setting rpath to /usr/local/mysql/lib
-----
creating Makefile
current directory: /Users/scott/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/mysql2-0.4.5/ext/mysql2
make "DESTDIR=" clean
current directory: /Users/scott/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/mysql2-0.4.5/ext/mysql2
make "DESTDIR="
compiling client.c
In file included from client.c:1:
In file included from ./mysql2_ext.h:41:
./result.h:24:3: error: unknown type name 'my_bool'
my_bool *is_null;
^
./result.h:25:3: error: unknown type name 'my_bool'
my_bool *error;
^
client.c:507:3: error: use of undeclared identifier 'my_bool'
my_bool res = mysql_read_query_result(client);
^
client.c:509:19: error: use of undeclared identifier 'res'
return (void *)(res == 0 ? Qtrue : Qfalse);
^
client.c:828:3: error: use of undeclared identifier 'my_bool'
my_bool boolval;
^
client.c:859:7: error: use of undeclared identifier 'boolval'
boolval = (value == Qfalse ? 0 : 1);
^
client.c:860:17: error: use of undeclared identifier 'boolval'
retval = &boolval;
^
client.c:863:10: error: use of undeclared identifier 'MYSQL_SECURE_AUTH'; did you mean 'MYSQL_DEFAULT_AUTH'?
case MYSQL_SECURE_AUTH:
^~~~~~~~~~~~~~~~~
MYSQL_DEFAULT_AUTH
/usr/local/mysql/include/mysql.h:188:3: note: 'MYSQL_DEFAULT_AUTH' declared here
MYSQL_DEFAULT_AUTH,
^
client.c:864:7: error: use of undeclared identifier 'boolval'
boolval = (value == Qfalse ? 0 : 1);
^
client.c:865:17: error: use of undeclared identifier 'boolval'
retval = &boolval;
^
client.c:896:38: error: use of undeclared identifier 'boolval'
wrapper->reconnect_enabled = boolval;
^
client.c:1285:38: error: use of undeclared identifier 'MYSQL_SECURE_AUTH'; did you mean 'MYSQL_DEFAULT_AUTH'?
return _mysql_client_options(self, MYSQL_SECURE_AUTH, value);
^~~~~~~~~~~~~~~~~
MYSQL_DEFAULT_AUTH
/usr/local/mysql/include/mysql.h:188:3: note: 'MYSQL_DEFAULT_AUTH' declared here
MYSQL_DEFAULT_AUTH,
^
12 errors generated.
make: *** [client.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/scott/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/mysql2-0.4.5 for inspection.
Results logged to /Users/scott/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-15/2.4.0-static/mysql2-0.4.5/gem_make.out
I have tried adding the following to my .bash_profile like other suggestions
export DYLD_LIBRARY_PATH="/usr/local/mysql/lib:$DYLD_LIBRARY_PATH"
But no luck. I also have Mysql 8.0.11 running in the background..
Any ideas?

Installing mongrel on cloud9 giving error

I am running following command to install mongrel (downgraded ruby to 1.8.7p302 for an app and when tried to do bundle create --local, it asks to install mysql which then asked for mongrel)
gem install win32-open3 -v '0.3.2'
(master) $ gem install mongrel -v '1.1.5'
Building native extensions. This could take a while...
ERROR: Error installing mongrel:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-2.1.5/bin/ruby -r ./siteconf20150509-1034-1akenv5.rb extconf.rb
checking for main() in -lc... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling http11.c
http11.c: In function ‘http_field’:
http11.c:70:3: warning: format not a string literal and no format arguments [-Wformat-security]
VALIDATE_MAX_LENGTH(flen, FIELD_NAME);
^
http11.c:71:3: warning: format not a string literal and no format arguments [-Wformat-security]
VALIDATE_MAX_LENGTH(vlen, FIELD_VALUE);
^
http11.c:77:22: error: ‘struct RString’ has no member named ‘ptr’
for(ch = RSTRING(f)->ptr, end = ch + RSTRING(f)->len; ch < end; ch++) {
^
http11.c:77:50: error: ‘struct RString’ has no member named ‘len’
for(ch = RSTRING(f)->ptr, end = ch + RSTRING(f)->len; ch < end; ch++) {
^
http11.c:77:27: warning: left-hand operand of comma expression has no effect [-Wunused-value]
for(ch = RSTRING(f)->ptr, end = ch + RSTRING(f)->len; ch < end; ch++) {
^
http11.c: In function ‘request_uri’:
http11.c:102:3: warning: format not a string literal and no format arguments [-Wformat-security]
VALIDATE_MAX_LENGTH(length, REQUEST_URI);
^
http11.c: In function ‘fragment’:
http11.c:113:3: warning: format not a string literal and no format arguments [-Wformat-security]
VALIDATE_MAX_LENGTH(length, FRAGMENT);
^
http11.c: In function ‘request_path’:
http11.c:124:3: warning: format not a string literal and no format arguments [-Wformat-security]
VALIDATE_MAX_LENGTH(length, REQUEST_PATH);
^
http11.c: In function ‘query_string’:
http11.c:135:3: warning: format not a string literal and no format arguments [-Wformat-security]
VALIDATE_MAX_LENGTH(length, QUERY_STRING);
^
In file included from /usr/include/string.h:635:0,
from /usr/local/rvm/rubies/ruby-2.1.5/include/ruby-2.1.0/ruby/defines.h:45,
from /usr/local/rvm/rubies/ruby-2.1.5/include/ruby-2.1.0/ruby/ruby.h:29,
from /usr/local/rvm/rubies/ruby-2.1.5/include/ruby-2.1.0/ruby.h:33,
from http11.c:5:
http11.c: In function ‘header_done’:
http11.c:172:33: error: ‘struct RString’ has no member named ‘ptr’
colon = strchr(RSTRING(temp)->ptr, ':');
^
http11.c:172:33: error: ‘struct RString’ has no member named ‘ptr’
colon = strchr(RSTRING(temp)->ptr, ':');
^
http11.c:172:33: error: ‘struct RString’ has no member named ‘ptr’
colon = strchr(RSTRING(temp)->ptr, ':');
^
http11.c:174:89: error: ‘struct RString’ has no member named ‘ptr’
rb_hash_aset(req, global_server_name, rb_str_substr(temp, 0, colon - RSTRING(temp)->ptr));
^
http11.c:176:52: error: ‘struct RString’ has no member named ‘ptr’
rb_str_substr(temp, colon - RSTRING(temp)->ptr+1,
^
http11.c:177:26: error: ‘struct RString’ has no member named ‘len’
RSTRING(temp)->len));
^
http11.c: In function ‘HttpParser_execute’:
http11.c:298:23: error: ‘struct RString’ has no member named ‘ptr’
dptr = RSTRING(data)->ptr;
^
http11.c:299:23: error: ‘struct RString’ has no member named ‘len’
dlen = RSTRING(data)->len;
^
http11.c:307:5: warning: format not a string literal and no format arguments [-Wformat-security]
VALIDATE_MAX_LENGTH(http_parser_nread(http), HEADER);
^
make: *** [http11.o] Error 1
make failed, exit code 2
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/mongrel-1.1.5 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.1.5#rails4/extensions/x86_64-linux/2.1.0/mongrel-1.1.5/gem_make.out
Go cd to /usr/local/lib/ruby/gems/1.9.1/gems/mongrel-1.1.5/ext/http11
and Use sudo nano or vi on http11.c and:
replace line 77 with
for(ch = RSTRING_PTR(f), end = ch + RSTRING_LEN(f); ch < end; ch++) {
And then
replace line 172 with
colon = strchr(RSTRING_PTR(temp), ':');
replace line 174 with
rb_hash_aset(req, global_server_name, rb_str_substr(temp, 0, colon - RSTRING_PTR(temp)));
replce line 176,177
rb_str_substr(temp, colon - RSTRING_PTR(temp)+1,
RSTRING_LEN(temp)));
replace lines 298 299
dptr = RSTRING_PTR(data);
dlen = RSTRING_LEN(data);
save the file,
sudo ruby extconf.rb && sudo make && sudo make install
Go cd ../../lib/mongrel
(or the full path “/usr/local/lib/ruby/gems/1.9.1/gems/mongrel-1.1.5/lib/mongrel”
sudo nano handlers.rb
To fix the case statements in
On lines 208-212, change instances of “: false” to “then false”
Then sudo gem install mongrel if that build fails simply
go with the second option like this
You Can Force To Install mongrel like this
sudo gem install mongrel -v 1.2.0.pre2 -- --with-cflags=\"-O2 -pipe -march=native -w\"
This Works For Me hope t will work for you too.

Cannot compile MySQL++

I am trying to compile MySQL++ 3.1.0 with the command:
mingw32-make -f Makefile.mingw
After a set of files gets compiled (e.g. beemutex.cpp, cmdline.cpp, connection.cpp, ...), I get these errors:
g++ -c -o mysqlpp_sql_buffer.o -g -mthreads -DUNICODE -D_UNICODE -DMYSQLPP_NO_DLL -DHAVE_MYSQL_SSL_SET -I"C:\Program Files\MySQL\MySQL Server 5.5\include" -MT
mysqlpp_sql_buffer.o -MFmysqlpp_sql_buffer.o.d -MD -MP lib/sql_buffer.cpp
In file included from lib/sql_buffer.h:31:0,
from lib/sql_buffer.cpp:26:
lib/refcounted.h:258:2: error: 'size_t' does not name a type
lib/refcounted.h: In constructor 'mysqlpp::RefCountedPointer<T, Destroyer>::RefCountedPointer()':
lib/refcounted.h:89:2: error: class 'mysqlpp::RefCountedPointer<T, Destroyer>' does not have any field named 'refs_'
lib/refcounted.h: In constructor 'mysqlpp::RefCountedPointer<T, Destroyer>::RefCountedPointer(T*)':
lib/refcounted.h:100:2: error: class 'mysqlpp::RefCountedPointer<T, Destroyer>' does not have any field named 'refs_'
lib/refcounted.h:104:4: error: 'refs_' was not declared in this scope
lib/refcounted.h:104:16: error: expected type-specifier before 'size_t'
lib/refcounted.h:104:16: error: expected ';' before 'size_t'
lib/refcounted.h: In constructor 'mysqlpp::RefCountedPointer<T, Destroyer>::RefCountedPointer(const ThisType&)':
lib/refcounted.h:112:2: error: class 'mysqlpp::RefCountedPointer<T, Destroyer>' does not have any field named 'refs_'
lib/refcounted.h:115:8: error: 'refs_' was not declared in this scope
lib/refcounted.h: In destructor 'mysqlpp::RefCountedPointer<T, Destroyer>::~RefCountedPointer()':
lib/refcounted.h:125:7: error: 'refs_' was not declared in this scope
lib/refcounted.h: In member function 'void mysqlpp::RefCountedPointer<T, Destroyer>::swap(mysqlpp::RefCountedPointer<T, Destroyer>::ThisType&)':
lib/refcounted.h:246:13: error: 'refs_' was not declared in this scope
mingw32-make: *** [mysqlpp_sql_buffer.o] Error 1
Something could be wrong in my configuration, but I can't find what. It seems strange that it cannot find, e.g., size_t.
Thank you!
Platform:
Windows 7
MinGW 2011.09 / GCC 4.6.1
MySQL 5.5
mysql++ 3.1.0
Changing size_t() with std::size_t() in refcounted.h solved the problem. It now compiles.
I still have linking problems, but they should be different issues.