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

Having issue when installing mysql2 gem on ubuntu 24.04 #1369

Open
simogeo opened this issue Jun 1, 2024 · 6 comments
Open

Having issue when installing mysql2 gem on ubuntu 24.04 #1369

simogeo opened this issue Jun 1, 2024 · 6 comments

Comments

@simogeo
Copy link

simogeo commented Jun 1, 2024

I'm using ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [x86_64-linux] (installed with RVM) on Ubuntu 24.04 and I get this error when trying to install mysql2 :

bundle install
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Installing mysql2 0.5.6 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /home/ubuntu/.rvm/gems/ruby-3.1.0/gems/mysql2-0.5.6/ext/mysql2
/home/ubuntu/.rvm/rubies/ruby-3.1.0/bin/ruby -I /home/ubuntu/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0 -r
./siteconf20240601-64133-pej7bb.rb extconf.rb
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for rb_gc_mark_movable()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_enc_interned_str() in ruby.h... yes
-----
Cannot find library dir(s) 
-----
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/home/ubuntu/.rvm/rubies/ruby-3.1.0/bin/$(RUBY_BASE_NAME)
	--with-openssl-dir
	--with-openssl-dir
	--with-openssl-include
	--without-openssl-include=${openssl-dir}/include
	--with-openssl-lib
	--without-openssl-lib=${openssl-dir}/lib

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

  /home/ubuntu/.rvm/gems/ruby-3.1.0/extensions/x86_64-linux/3.1.0/mysql2-0.5.6/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/ubuntu/.rvm/gems/ruby-3.1.0/gems/mysql2-0.5.6 for inspection.
Results logged to
/home/ubuntu/.rvm/gems/ruby-3.1.0/extensions/x86_64-linux/3.1.0/mysql2-0.5.6/gem_make.out

  /home/ubuntu/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/rubygems/ext/builder.rb:95:in `run'
/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/rubygems/ext/ext_conf_builder.rb:47:in `block in
build'
  /home/ubuntu/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/tempfile.rb:317:in `open'
  /home/ubuntu/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/rubygems/ext/ext_conf_builder.rb:26:in `build'
  /home/ubuntu/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/rubygems/ext/builder.rb:161:in `build_extension'
/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/rubygems/ext/builder.rb:195:in `block in
build_extensions'
  /home/ubuntu/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/rubygems/ext/builder.rb:192:in `each'
  /home/ubuntu/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/rubygems/ext/builder.rb:192:in `build_extensions'
  /home/ubuntu/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/rubygems/installer.rb:847:in `build_extensions'
/home/ubuntu/.rvm/gems/ruby-3.1.0/gems/bundler-2.5.11/lib/bundler/rubygems_gem_installer.rb:76:in
`build_extensions'
/home/ubuntu/.rvm/gems/ruby-3.1.0/gems/bundler-2.5.11/lib/bundler/rubygems_gem_installer.rb:28:in
`install'
  /home/ubuntu/.rvm/gems/ruby-3.1.0/gems/bundler-2.5.11/lib/bundler/source/rubygems.rb:206:in `install'
/home/ubuntu/.rvm/gems/ruby-3.1.0/gems/bundler-2.5.11/lib/bundler/installer/gem_installer.rb:54:in
`install'
/home/ubuntu/.rvm/gems/ruby-3.1.0/gems/bundler-2.5.11/lib/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
/home/ubuntu/.rvm/gems/ruby-3.1.0/gems/bundler-2.5.11/lib/bundler/installer/parallel_installer.rb:132:in
`do_install'
/home/ubuntu/.rvm/gems/ruby-3.1.0/gems/bundler-2.5.11/lib/bundler/installer/parallel_installer.rb:123:in
`block in worker_pool'
  /home/ubuntu/.rvm/gems/ruby-3.1.0/gems/bundler-2.5.11/lib/bundler/worker.rb:62:in `apply_func'
/home/ubuntu/.rvm/gems/ruby-3.1.0/gems/bundler-2.5.11/lib/bundler/worker.rb:57:in `block in
process_queue'
  /home/ubuntu/.rvm/gems/ruby-3.1.0/gems/bundler-2.5.11/lib/bundler/worker.rb:54:in `loop'
  /home/ubuntu/.rvm/gems/ruby-3.1.0/gems/bundler-2.5.11/lib/bundler/worker.rb:54:in `process_queue'
/home/ubuntu/.rvm/gems/ruby-3.1.0/gems/bundler-2.5.11/lib/bundler/worker.rb:90:in `block (2 levels) in
create_threads'

An error occurred while installing mysql2 (0.5.6), and Bundler cannot continue.

In Gemfile:
  mysql2

Mysql server is 8.0.36-2ubuntu3

I've also tried :
gem install mysql2 -v '0.5.6' -- --srcdir=/var/lib/mysql
gem install mysql2 -v '0.5.6' -- --srcdir=/lib/x86_64-linux-gnu

And :
gem install mysql2 --with-mysql-dir=/lib/x86_64-linux-gnu/ but I get this error message :

ERROR: While executing gem ... (Gem::OptionParser::InvalidOption)
invalid option: --with-mysql-dir=/lib/x86_64-linux-gnu

Thanks for your support

@simogeo
Copy link
Author

simogeo commented Jun 1, 2024

By the way, I've seen this topic but it is related to MAC environment

@simogeo
Copy link
Author

simogeo commented Jun 4, 2024

And from the log located in /home/ubuntu/.rvm/gems/ruby-3.1.0/extensions/x86_64-linux/3.1.0/mysql2-0.5.6/mkmf.log, I can find these information - but I'm not able to understand the problem :


have_func: checking for rb_absint_size()... -------------------- yes

LD_LIBRARY_PATH=.:/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib "gcc -o conftest -I/home/ubuntu/.rvm/rubies/ruby-3.1.0/include/ruby-3.1.0/x86_64-linux -I/home/ubuntu/.rvm/rubies/ruby-3.1.0/include/ruby-3.1.0/ruby/backward -I/home/ubuntu/.rvm/rubies/ruby-3.1.0/include/ruby-3.1.0 -I.    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wundef  -fPIC conftest.c  -L. -L/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -Wl,-rpath,/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed     -Wl,-rpath,/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -L/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -lruby  -lm  -lc" 
checked program was:
/* begin */
1: #include "ruby.h" 
2: 
3: int main(int argc, char **argv)
4: {
5:   return !!argv[argc];
6: }
/* end */

LD_LIBRARY_PATH=.:/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib "gcc -o conftest -I/home/ubuntu/.rvm/rubies/ruby-3.1.0/include/ruby-3.1.0/x86_64-linux -I/home/ubuntu/.rvm/rubies/ruby-3.1.0/include/ruby-3.1.0/ruby/backward -I/home/ubuntu/.rvm/rubies/ruby-3.1.0/include/ruby-3.1.0 -I.    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wundef  -fPIC conftest.c  -L. -L/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -Wl,-rpath,/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed     -Wl,-rpath,/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -L/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -lruby  -lm  -lc" 
checked program was:
/* begin */
 1: #include "ruby.h" 
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     int (* volatile tp)(void)=(int (*)(void))&t;
 9:     printf("%d", (*tp)());
10:   }
11: 
12:   return !!argv[argc];
13: }
14: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_absint_size; return !p; }
/* end */

--------------------

have_func: checking for rb_absint_singlebit_p()... -------------------- yes

LD_LIBRARY_PATH=.:/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib "gcc -o conftest -I/home/ubuntu/.rvm/rubies/ruby-3.1.0/include/ruby-3.1.0/x86_64-linux -I/home/ubuntu/.rvm/rubies/ruby-3.1.0/include/ruby-3.1.0/ruby/backward -I/home/ubuntu/.rvm/rubies/ruby-3.1.0/include/ruby-3.1.0 -I.    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wundef  -fPIC conftest.c  -L. -L/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -Wl,-rpath,/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed     -Wl,-rpath,/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -L/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -lruby  -lm  -lc" 
checked program was:
/* begin */
 1: #include "ruby.h" 
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     int (* volatile tp)(void)=(int (*)(void))&t;
 9:     printf("%d", (*tp)());
10:   }
11: 
12:   return !!argv[argc];
13: }
14: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_absint_singlebit_p; return !p; }
/* end */

--------------------

have_func: checking for rb_gc_mark_movable()... -------------------- yes

LD_LIBRARY_PATH=.:/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib "gcc -o conftest -I/home/ubuntu/.rvm/rubies/ruby-3.1.0/include/ruby-3.1.0/x86_64-linux -I/home/ubuntu/.rvm/rubies/ruby-3.1.0/include/ruby-3.1.0/ruby/backward -I/home/ubuntu/.rvm/rubies/ruby-3.1.0/include/ruby-3.1.0 -I.    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wundef  -fPIC conftest.c  -L. -L/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -Wl,-rpath,/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed     -Wl,-rpath,/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -L/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -lruby  -lm  -lc" 
checked program was:
/* begin */
 1: #include "ruby.h" 
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     int (* volatile tp)(void)=(int (*)(void))&t;
 9:     printf("%d", (*tp)());
10:   }
11: 
12:   return !!argv[argc];
13: }
14: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_gc_mark_movable; return !p; }
/* end */

--------------------

have_func: checking for rb_wait_for_single_fd()... -------------------- yes

LD_LIBRARY_PATH=.:/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib "gcc -o conftest -I/home/ubuntu/.rvm/rubies/ruby-3.1.0/include/ruby-3.1.0/x86_64-linux -I/home/ubuntu/.rvm/rubies/ruby-3.1.0/include/ruby-3.1.0/ruby/backward -I/home/ubuntu/.rvm/rubies/ruby-3.1.0/include/ruby-3.1.0 -I.    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wundef  -fPIC conftest.c  -L. -L/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -Wl,-rpath,/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed     -Wl,-rpath,/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -L/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -lruby  -lm  -lc" 
conftest.c: In function ‘t’:
conftest.c:14:57: error: ‘rb_wait_for_single_fd’ undeclared (first use in this function)
   14 | int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_wait_for_single_fd; return !p; }
      |                                                         ^~~~~~~~~~~~~~~~~~~~~
conftest.c:14:57: note: each undeclared identifier is reported only once for each function it appears in
At top level:
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
checked program was:
/* begin */
 1: #include "ruby.h" 
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     int (* volatile tp)(void)=(int (*)(void))&t;
 9:     printf("%d", (*tp)());
10:   }
11: 
12:   return !!argv[argc];
13: }
14: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_wait_for_single_fd; return !p; }
/* end */

LD_LIBRARY_PATH=.:/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib "gcc -o conftest -I/home/ubuntu/.rvm/rubies/ruby-3.1.0/include/ruby-3.1.0/x86_64-linux -I/home/ubuntu/.rvm/rubies/ruby-3.1.0/include/ruby-3.1.0/ruby/backward -I/home/ubuntu/.rvm/rubies/ruby-3.1.0/include/ruby-3.1.0 -I.    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wundef  -fPIC conftest.c  -L. -L/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -Wl,-rpath,/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed     -Wl,-rpath,/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -L/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -lruby  -lm  -lc" 
checked program was:
/* begin */
 1: #include "ruby.h" 
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     int (* volatile tp)(void)=(int (*)(void))&t;
 9:     printf("%d", (*tp)());
10:   }
11: 
12:   return !!argv[argc];
13: }
14: extern void rb_wait_for_single_fd();
15: int t(void) { rb_wait_for_single_fd(); return 0; }
/* end */

--------------------

have_func: checking for rb_enc_interned_str() in ruby.h... -------------------- yes

LD_LIBRARY_PATH=.:/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib "gcc -o conftest -I/home/ubuntu/.rvm/rubies/ruby-3.1.0/include/ruby-3.1.0/x86_64-linux -I/home/ubuntu/.rvm/rubies/ruby-3.1.0/include/ruby-3.1.0/ruby/backward -I/home/ubuntu/.rvm/rubies/ruby-3.1.0/include/ruby-3.1.0 -I.    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wundef  -fPIC conftest.c  -L. -L/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -Wl,-rpath,/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed     -Wl,-rpath,/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -L/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -lruby  -lm  -lc" 
conftest.c: In function ‘t’:
conftest.c:16:57: error: ‘rb_enc_interned_str’ undeclared (first use in this function); did you mean ‘rb_interned_str’?
   16 | int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_enc_interned_str; return !p; }
      |                                                         ^~~~~~~~~~~~~~~~~~~
      |                                                         rb_interned_str
conftest.c:16:57: note: each undeclared identifier is reported only once for each function it appears in
At top level:
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
checked program was:
/* begin */
 1: #include "ruby.h" 
 2: 
 3: #include <ruby.h>
 4: 
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     int (* volatile tp)(void)=(int (*)(void))&t;
11:     printf("%d", (*tp)());
12:   }
13: 
14:   return !!argv[argc];
15: }
16: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_enc_interned_str; return !p; }
/* end */

LD_LIBRARY_PATH=.:/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib "gcc -o conftest -I/home/ubuntu/.rvm/rubies/ruby-3.1.0/include/ruby-3.1.0/x86_64-linux -I/home/ubuntu/.rvm/rubies/ruby-3.1.0/include/ruby-3.1.0/ruby/backward -I/home/ubuntu/.rvm/rubies/ruby-3.1.0/include/ruby-3.1.0 -I.    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wundef  -fPIC conftest.c  -L. -L/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -Wl,-rpath,/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed     -Wl,-rpath,/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -L/home/ubuntu/.rvm/rubies/ruby-3.1.0/lib -lruby  -lm  -lc" 
checked program was:
/* begin */
 1: #include "ruby.h" 
 2: 
 3: #include <ruby.h>
 4: 
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     int (* volatile tp)(void)=(int (*)(void))&t;
11:     printf("%d", (*tp)());
12:   }
13: 
14:   return !!argv[argc];
15: }
16: extern void rb_enc_interned_str();
17: int t(void) { rb_enc_interned_str(); return 0; }
/* end */

--------------------

Thanks for your help !

@simogeo
Copy link
Author

simogeo commented Jun 4, 2024

I did handle this by changing the value in the gemfile from :

gem "mysql2", "~> 0.5.0", :platforms => [:mri, :mingw, :x64_mingw]

to

gem "mysql2", "0.5.4", :platforms => [:mri, :mingw, :x64_mingw]

Seems to be ok ...

@gajet5
Copy link

gajet5 commented Jun 5, 2024

I am installing a higher version "mysql2" -> "0.5.6".

The information I found says that the problem should be solved in 5.4.0, but in fact it is not.

@tenshiAMD
Copy link

I fixed it on my end after installing libmysqlclient-dev.

apt-get install -y libmysqlclient-dev

@JonTheStone
Copy link

JonTheStone commented Aug 22, 2024

I removed the platform versions in my Gemfile.lock for the ffi gem as well as added this to my Gemfile:

gem 'ffi', '1.17.0', force_ruby_platform: true

This works for me

EDIT: Updated to include the correct stanza for after the gem

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

4 participants