Open simogeo opened 5 months ago
By the way, I've seen this topic but it is related to MAC environment
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 !
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 ...
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.
I fixed it on my end after installing libmysqlclient-dev
.
apt-get install -y libmysqlclient-dev
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
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 :
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 :Thanks for your support