Skip to content

Instantly share code, notes, and snippets.

@schneems
Last active Apr 17, 2020
Embed
What would you like to do?
~ $ gem install mysql2
Fetching mysql2-0.5.3.gem
Building native extensions. This could take a while...
ERROR:  Error installing mysql2:
	ERROR: Failed to build gem native extension.

    current directory: /app/vendor/ruby-2.6.5/lib/ruby/gems/2.6.0/gems/mysql2-0.5.3/ext/mysql2
/app/vendor/ruby-2.6.5/bin/ruby -I /app/vendor/ruby-2.6.5/lib/ruby/2.6.0 -r ./siteconf20200417-12-1lo3zcx.rb extconf.rb
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for rb_wait_for_single_fd()... yes
checking for -lmysqlclient... no
-----
mysql client is missing. You may need to 'sudo apt-get install libmariadb-dev', 'sudo apt-get install libmysqlclient-dev' or 'sudo yum install mysql-devel', and try again.
-----
*** 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=/app/vendor/ruby-2.6.5/bin/$(RUBY_BASE_NAME)
	--with-mysql-dir
	--without-mysql-dir
	--with-mysql-include
	--without-mysql-include=${mysql-dir}/include
	--with-mysql-lib
	--without-mysql-lib=${mysql-dir}/lib
	--with-mysql-config
	--without-mysql-config
	--with-mysql-dir
	--without-mysql-dir
	--with-mysql-include
	--without-mysql-include=${mysql-dir}/include
	--with-mysql-lib
	--without-mysql-lib=${mysql-dir}/lib
	--with-mysqlclientlib
	--without-mysqlclientlib

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

  /app/vendor/ruby-2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/mysql2-0.5.3/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /app/vendor/ruby-2.6.5/lib/ruby/gems/2.6.0/gems/mysql2-0.5.3 for inspection.
Results logged to /app/vendor/ruby-2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/mysql2-0.5.3/gem_make.out
~ $ cat   /app/vendor/ruby-2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/mysql2-0.5.3/mkmf.log
have_func: checking for rb_absint_size()... -------------------- yes

"gcc -o conftest -I/app/vendor/ruby-2.6.5/include/ruby-2.6.0/x86_64-linux -I/app/vendor/ruby-2.6.5/include/ruby-2.6.0/ruby/backward -I/app/vendor/ruby-2.6.5/include/ruby-2.6.0 -I.    -O3 -g -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -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 -Wno-maybe-uninitialized  -fPIC conftest.c  -L. -L/app/vendor/ruby-2.6.5/lib -Wl,-rpath,/app/vendor/ruby-2.6.5/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic     -Wl,-rpath,'/../lib' -Wl,-rpath,'/../lib' -lruby  -lm   -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

"gcc -o conftest -I/app/vendor/ruby-2.6.5/include/ruby-2.6.0/x86_64-linux -I/app/vendor/ruby-2.6.5/include/ruby-2.6.0/ruby/backward -I/app/vendor/ruby-2.6.5/include/ruby-2.6.0 -I.    -O3 -g -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -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 -Wno-maybe-uninitialized  -fPIC conftest.c  -L. -L/app/vendor/ruby-2.6.5/lib -Wl,-rpath,/app/vendor/ruby-2.6.5/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic     -Wl,-rpath,'/../lib' -Wl,-rpath,'/../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 0;
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

"gcc -o conftest -I/app/vendor/ruby-2.6.5/include/ruby-2.6.0/x86_64-linux -I/app/vendor/ruby-2.6.5/include/ruby-2.6.0/ruby/backward -I/app/vendor/ruby-2.6.5/include/ruby-2.6.0 -I.    -O3 -g -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -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 -Wno-maybe-uninitialized  -fPIC conftest.c  -L. -L/app/vendor/ruby-2.6.5/lib -Wl,-rpath,/app/vendor/ruby-2.6.5/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic     -Wl,-rpath,'/../lib' -Wl,-rpath,'/../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 0;
13: }
14: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_absint_singlebit_p; return !p; }
/* end */

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

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

"gcc -o conftest -I/app/vendor/ruby-2.6.5/include/ruby-2.6.0/x86_64-linux -I/app/vendor/ruby-2.6.5/include/ruby-2.6.0/ruby/backward -I/app/vendor/ruby-2.6.5/include/ruby-2.6.0 -I.    -O3 -g -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -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 -Wno-maybe-uninitialized  -fPIC conftest.c  -L. -L/app/vendor/ruby-2.6.5/lib -Wl,-rpath,/app/vendor/ruby-2.6.5/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic     -Wl,-rpath,'/../lib' -Wl,-rpath,'/../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)
 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
conftest.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-tautological-compare’
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
cc1: warning: unrecognized command line option ‘-Wno-cast-function-type’
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 0;
13: }
14: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_wait_for_single_fd; return !p; }
/* end */

"gcc -o conftest -I/app/vendor/ruby-2.6.5/include/ruby-2.6.0/x86_64-linux -I/app/vendor/ruby-2.6.5/include/ruby-2.6.0/ruby/backward -I/app/vendor/ruby-2.6.5/include/ruby-2.6.0 -I.    -O3 -g -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -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 -Wno-maybe-uninitialized  -fPIC conftest.c  -L. -L/app/vendor/ruby-2.6.5/lib -Wl,-rpath,/app/vendor/ruby-2.6.5/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic     -Wl,-rpath,'/../lib' -Wl,-rpath,'/../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 0;
13: }
14: extern void rb_wait_for_single_fd();
15: int t(void) { rb_wait_for_single_fd(); return 0; }
/* end */

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

find_library: checking for -lmysqlclient... -------------------- no

"gcc -o conftest -I/app/vendor/ruby-2.6.5/include/ruby-2.6.0/x86_64-linux -I/app/vendor/ruby-2.6.5/include/ruby-2.6.0/ruby/backward -I/app/vendor/ruby-2.6.5/include/ruby-2.6.0 -I. -I/usr/local/include    -O3 -g -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -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 -Wno-maybe-uninitialized  -fPIC conftest.c  -L. -L/app/vendor/ruby-2.6.5/lib -Wl,-rpath,/app/vendor/ruby-2.6.5/lib -L/usr/local/lib -Wl,-rpath,/usr/local/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic     -Wl,-rpath,'/../lib' -Wl,-rpath,'/../lib' -lruby -lmysqlclient  -lm   -lc"
/usr/bin/ld: cannot find -lmysqlclient
collect2: error: ld returned 1 exit status
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 0;
13: }
14:
15: int t(void) { ; return 0; }
/* end */

"gcc -o conftest -I/app/vendor/ruby-2.6.5/include/ruby-2.6.0/x86_64-linux -I/app/vendor/ruby-2.6.5/include/ruby-2.6.0/ruby/backward -I/app/vendor/ruby-2.6.5/include/ruby-2.6.0 -I. -I/usr/local/include    -O3 -g -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -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 -Wno-maybe-uninitialized  -fPIC conftest.c  -L. -L/app/vendor/ruby-2.6.5/lib -Wl,-rpath,/app/vendor/ruby-2.6.5/lib -L/usr/local/lib -Wl,-rpath,/usr/local/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic     -Wl,-rpath,'/../lib' -Wl,-rpath,'/../lib' -lruby -lmysqlclient  -lm   -lc"
/usr/bin/ld: cannot find -lmysqlclient
collect2: error: ld returned 1 exit status
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 0;
13: }
14:
15: int t(void) { ; return 0; }
/* end */

"gcc -o conftest -I/app/vendor/ruby-2.6.5/include/ruby-2.6.0/x86_64-linux -I/app/vendor/ruby-2.6.5/include/ruby-2.6.0/ruby/backward -I/app/vendor/ruby-2.6.5/include/ruby-2.6.0 -I. -I/usr/local/include    -O3 -g -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -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 -Wno-maybe-uninitialized  -fPIC conftest.c  -L. -L/app/vendor/ruby-2.6.5/lib -Wl,-rpath,/app/vendor/ruby-2.6.5/lib -L/usr/local/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib/mysql -Wl,-rpath,/usr/local/lib/mysql -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic     -Wl,-rpath,'/../lib' -Wl,-rpath,'/../lib' -lruby -lmysqlclient  -lm   -lc"
/usr/bin/ld: cannot find -lmysqlclient
collect2: error: ld returned 1 exit status
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 0;
13: }
14:
15: int t(void) { ; return 0; }
/* end */

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

~ $ dpkg -l | grep mysqlclient
ii  libmysqlclient20:amd64       5.7.29-0ubuntu0.16. amd64               MySQL database client library
~ $ gem install mysql2
Fetching: mysql2-0.5.3.gem (100%)
Building native extensions.  This could take a while...
Successfully installed mysql2-0.5.3
Parsing documentation for mysql2-0.5.3
unable to convert "\xF8" from ASCII-8BIT to UTF-8 for lib/mysql2/mysql2.so, skipping
Installing ri documentation for mysql2-0.5.3
1 gem installed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment