I have created a Openshift application on Rails 4, ruby 2, with MySQL 5.5, scaling.
When trying to deploy, I keep getting this error:
remote: Installing mysql2 (0.3.20)
remote: Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
remote:
remote: /opt/rh/ruby200/root/usr/bin/ruby extconf.rb
remote: checking for ruby/thread.h... yes
remote: checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
remote: checking for rb_thread_blocking_region()... yes
remote: checking for rb_wait_for_single_fd()... yes
remote: checking for rb_hash_dup()... yes
remote: checking for rb_intern3()... yes
remote: -----
remote: Using mysql_config at /opt/rh/mysql55/root/usr/bin/mysql_config
remote: -----
remote: checking for mysql.h... yes
remote: checking for errmsg.h... yes
remote: checking for mysqld_error.h... yes
remote: -----
remote: Don't know how to set rpath on your system, if MySQL libraries are not in path mysql2 may not load
remote: -----
remote: -----
remote: Setting libpath to /opt/rh/mysql55/root/usr/lib64/mysql
remote: -----
remote: creating Makefile
remote:
remote: make "DESTDIR="
remote: gcc -I. -I/opt/rh/ruby200/root/usr/include -I/opt/rh/ruby200/root/usr/include/ruby/backward -I/opt/rh/ruby200/root/usr/include -I. -I/opt/rh/mysql55/root/usr/include/mysql -DHAVE_RUBY_THREAD_H -DHAVE_RB_THREAD_CALL_WITHOUT_GVL -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_RB_WAIT_FOR_SINGLE_FD -DHAVE_RB_HASH_DUP -DHAVE_RB_INTERN3 -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -mtune=generic -fPIC -m64 -o client.o -c client.c
remote: gcc -I. -I/opt/rh/ruby200/root/usr/include -I/opt/rh/ruby200/root/usr/include/ruby/backward -I/opt/rh/ruby200/root/usr/include -I. -I/opt/rh/mysql55/root/usr/include/mysql -DHAVE_RUBY_THREAD_H -DHAVE_RB_THREAD_CALL_WITHOUT_GVL -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_RB_WAIT_FOR_SINGLE_FD -DHAVE_RB_HASH_DUP -DHAVE_RB_INTERN3 -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -mtune=generic -fPIC -m64 -o infile.o -c infile.c
remote: gcc -I. -I/opt/rh/ruby200/root/usr/include -I/opt/rh/ruby200/root/usr/include/ruby/backward -I/opt/rh/ruby200/root/usr/include -I. -I/opt/rh/mysql55/root/usr/include/mysql -DHAVE_RUBY_THREAD_H -DHAVE_RB_THREAD_CALL_WITHOUT_GVL -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_RB_WAIT_FOR_SINGLE_FD -DHAVE_RB_HASH_DUP -DHAVE_RB_INTERN3 -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -mtune=generic -fPIC -m64 -o mysql2_ext.o -c mysql2_ext.c
remote: gcc -I. -I/opt/rh/ruby200/root/usr/include -I/opt/rh/ruby200/root/usr/include/ruby/backward -I/opt/rh/ruby200/root/usr/include -I. -I/opt/rh/mysql55/root/usr/include/mysql -DHAVE_RUBY_THREAD_H -DHAVE_RB_THREAD_CALL_WITHOUT_GVL -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_RB_WAIT_FOR_SINGLE_FD -DHAVE_RB_HASH_DUP -DHAVE_RB_INTERN3 -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -mtune=generic -fPIC -m64 -o result.o -c result.c
remote: rm -f mysql2.so
remote: gcc -shared -o mysql2.so client.o infile.o mysql2_ext.o result.o -L. -L/opt/rh/ruby200/root/usr/lib64 -L/opt/rh/mysql55/root/usr/lib64/mysql -L. -fstack-protector -rdynamic -Wl,-export-dynamic -m64 -lruby -L/opt/rh/mysql55/root/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -lrt -lssl -lcrypto -ldl -lpthread -lrt -ldl -lcrypt -lm -lc
remote: /usr/bin/ld: cannot find -lmysqlclient
remote: collect2: ld returned 1 exit status
remote: make: *** [mysql2.so] Error 1
I tried doing the suggested here:
Cannot install mysql2 gem on openshift scaled app
but it didn't work, I keep getting the error.
Related
I was trying ZSON compression in postgres using this doc: https://sudonull.com/post/77435-ZSON-PostgreSQL-extension-for-transparent-JSONB-compression . However, while running make I got below error:
sudo make install
gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --
param=ssp-
buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -DLINUX_OOM_SCORE_ADJ=0 -Wall -Wmissing-
prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-
attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -fPIC -g -
O2 -I. -I. -I/usr/include/pgsql/server -I/usr/include/pgsql/internal -D_GNU_SOURCE -
I/usr/include/libxml2 -c -o zson.o zson.c
zson.c:6:25: fatal error: utils/jsonb.h: No such file or directory
#include <utils/jsonb.h>
^
compilation terminated.
make: *** [zson.o] Error 1
any way to avoid/fix the error? The error says the file doesn't exist. However, how can I get this file to make it working.
I am using:
R version: 3.3.3.
OS: RHEL 7.3 on EC2.
I am trying to install RMysql.
So in R terminal I submit command: install.packages("RMySQL")
First attempt was unsuccessful and gave error that libmysqlclient was not found.
Using PKG_LIBS=-lmysqlclient
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libmysqlclient was not found. Try installing:
* deb: libmariadb-client-lgpl-dev (Debian, Ubuntu 16.04)
libmariadbclient-dev (Ubuntu 14.04)
* rpm: mariadb-devel | mysql-devel (Fedora, CentOS, RHEL)
* csw: mysql56_dev (Solaris)
* brew: mariadb-connector-c (OSX)
If libmysqlclient is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libmysqlclient.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘RMySQL’
* removing ‘/usr/lib64/R/library/RMySQL’
The downloaded source packages are in
‘/tmp/Rtmpx1vsUG/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("RMySQL") :
installation of package ‘RMySQL’ had non-zero exit status
So I installed mysql-devel. (sudo yum install mysql-devel)
After this I am trying to install RMysql again.
But that does not work again. Something is wrong with PKG_LIBS -lmariadb.
gcc -m64 -std=gnu99 -shared -L/usr/lib64/R/lib -Wl,-z,relro -o RMySQL.so RMySQL-init.o connection.o db-apply.o driver.o exception.o fields.o result.o utils.o -L/usr/lib64/ -lmariadb -lpthread -ldl -lm -lssl -lcrypto -L/usr/lib64/R/lib -lR
/bin/ld: cannot find -lmariadb
Here is the whole R output.
* installing *source* package ‘RMySQL’ ...
** package ‘RMySQL’ successfully unpacked and MD5 sums checked
Found mysql_config cflags and libs!
Using PKG_CFLAGS=-I/usr/include/mysql -I/usr/include/mysql/mysql
Using PKG_LIBS=-L/usr/lib64/ -lmariadb -lpthread -ldl -lm -lssl -lcrypto
** libs
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include/mysql -I/usr/include/mysql/mysql -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c RMySQL-init.c -o RMySQL-init.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include/mysql -I/usr/include/mysql/mysql -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c connection.c -o connection.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include/mysql -I/usr/include/mysql/mysql -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c db-apply.c -o db-apply.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include/mysql -I/usr/include/mysql/mysql -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c driver.c -o driver.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include/mysql -I/usr/include/mysql/mysql -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c exception.c -o exception.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include/mysql -I/usr/include/mysql/mysql -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c fields.c -o fields.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include/mysql -I/usr/include/mysql/mysql -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c result.c -o result.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include/mysql -I/usr/include/mysql/mysql -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c utils.c -o utils.o
gcc -m64 -std=gnu99 -shared -L/usr/lib64/R/lib -Wl,-z,relro -o RMySQL.so RMySQL-init.o connection.o db-apply.o driver.o exception.o fields.o result.o utils.o -L/usr/lib64/ -lmariadb -lpthread -ldl -lm -lssl -lcrypto -L/usr/lib64/R/lib -lR
/bin/ld: cannot find -lmariadb
collect2: error: ld returned 1 exit status
make: *** [RMySQL.so] Error 1
ERROR: compilation failed for package ‘RMySQL’
* removing ‘/usr/lib64/R/library/RMySQL’
The downloaded source packages are in
‘/tmp/RtmpYEs7XA/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("RMySQL") :
installation of package ‘RMySQL’ had non-zero exit status
Ok so finally I get how to resolve this issue !!!
Proud of myself:)
I had mariadb-devel installed
Name : MariaDB-devel
Arch : x86_64
Version : 10.2.6
Release : 1.el7.centos
libmariadb.so was misssing.
Instead I had libmariadbclient.a. (/usr/lib64/libmariadbclient.a)
So I had to make a symbolic link:
sudo ln -s /usr/lib64/libmariadbclient.a /usr/lib64/libmariadb.a
After this installation of RMysql was succesfull:
** building package indices
** testing if installed package can be loaded
* DONE (RMySQL)
Making 'packages.html' ... done
EHLO
I am trying to compile an example of mysql connecion on C with Clang, while I can do it with gcc easily like this:
gcc mysql1.c -o mysql1 -std=c99 `mysql_config --cflags --libs`
I don't know how to pass the script mysql_config parameter to clang. I did it without them, but clang gave me errors about the include on library mysql.h and others.
what can I do?
Well this is how I figured out:
clang mysql1.c -o mysql1 -I/usr/include/mysql -Wa, -gdwarf-4 -fvar-tracking-assignments -frecord-gcc-switches -Wstrict-aliasing=2 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -fstack-protector-all -fPIC -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -g -DNDEBUG -rdynamic -L/usr/local/lib/mysql -lmysqlclient -lpthread -lz -lm -lssl -lcrypto -O2
Just have in mind where are mysqlclient lib and mysql sources.
I'm trying to get mysql gem installed for use on rails, using jruby, can't figure this out...any help is appreciated!
$ sudo gem install mysql2
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/Users/masedesign/Work/repos/code/conf/vms/ruby/jruby/bin/jruby extconf.rb
WARNING: JRuby does not support native extensions or the `mkmf' library very well.
Check http://kenai.com/projects/jruby/pages/Home for alternatives.
checking for rb_thread_blocking_region()... checking for rb_wait_for_single_fd()... no
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
creating Makefile
make
cc -I. -I. -I/Users/masedesign/Work/repos/code/conf/vms/ruby/jruby/lib/native/include/ruby -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/mysql/include -g -Os -arch x86_64 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL -fPIC -DTARGET_RT_MAC_CFM=0 -fno-omit-frame-pointer -fno-strict-aliasing -fexceptions -Wall -funroll-loops -arch x86_64 -c client.c
cc -I. -I. -I/Users/masedesign/Work/repos/code/conf/vms/ruby/jruby/lib/native/include/ruby -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/mysql/include -g -Os -arch x86_64 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL -fPIC -DTARGET_RT_MAC_CFM=0 -fno-omit-frame-pointer -fno-strict-aliasing -fexceptions -Wall -funroll-loops -arch x86_64 -c mysql2_ext.c
cc -I. -I. -I/Users/masedesign/Work/repos/code/conf/vms/ruby/jruby/lib/native/include/ruby -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/mysql/include -g -Os -arch x86_64 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL -fPIC -DTARGET_RT_MAC_CFM=0 -fno-omit-frame-pointer -fno-strict-aliasing -fexceptions -Wall -funroll-loops -arch x86_64 -c result.c
cc -dynamic -bundle -undefined dynamic_lookup -o mysql2.bundle client.o mysql2_ext.o result.o -L"." -L"/Users/masedesign/Work/repos/code/conf/vms/ruby/jruby-1.6.5/lib" -bundle -framework JavaVM -Wl,-syslibroot, -mmacosx-version-min=10.4 -Wl,-rpath,/usr/local/mysql/lib -arch x86_64 -L/usr/local/mysql/lib -lmysqlclient_r -lz -lm -lmygcc
ld: library not found for -lbundle1.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mysql2.bundle] Error 1
Gem files will remain installed in /Users/masedesign/Work/repos/code/conf/vms/ruby/jruby-1.6.5/lib/ruby/gems/1.8/gems/mysql2-0.3.11 for inspection.
Results logged to /Users/masedesign/Work/repos/code/conf/vms/ruby/jruby-1.6.5/lib/ruby/gems/1.8/gems/mysql2-0.3.11/ext/mysql2/gem_make.out
The mysql gem was developed and tested only against MRI (Ruby 1.8). As such it uses old-style C-extensions for most of their implementation. While they are technically supported by JRuby, they are slow and error-prone. So don't use them.
If you use JRuby, you are much better off of using the JDBC adapters which use the java-native database interface and are thus much faster and much better supported. The high-level interface (as e.g. used by Rails) is roughly the same, you shouldn't notice any difference.
So for JRuby you should use the jdbc-mysql gem, or - if you use Rails - the activerecord-jdbcmysql-adapter gem which requires that gem and adds the appropriate database adapter.
It seems that this comes up from time to time. Here is an SO post with some information (the second and third answers are more along what you are looking for).
On another note this blog suggests using jdbc-mysql.
I'm trying to install a mysql2 gem on a ruby on rails app. I'm currently running Ubuntu 11.04 and this is the error I get when I run sudo gem install mysql2 or bundle install:
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... no
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
creating Makefile
make
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -I/usr/include/mysql -DBIG_JOINS=1 -fno-strict-aliasing -g -fPIC -fno-strict-aliasing -g -g -O2 -fPIC -Wall -funroll-loops -c client.c
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -I/usr/include/mysql -DBIG_JOINS=1 -fno-strict-aliasing -g -fPIC -fno-strict-aliasing -g -g -O2 -fPIC -Wall -funroll-loops -c mysql2_ext.c
./client.h:16:1: warning: ‘rb_thread_blocking_region’ defined but not used
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -I/usr/include/mysql -DBIG_JOINS=1 -fno-strict-aliasing -g -fPIC -fno-strict-aliasing -g -g -O2 -fPIC -Wall -funroll-loops -c result.c
gcc -shared -o mysql2.so client.o mysql2_ext.o result.o -L. -L/usr/lib -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic -Wl,-rpath,/usr/lib/x86_64-linux-gnu -lruby1.8 -L/usr/lib/x86_64-linux-gnu -lmysqlclient_r -lpthread -lz -lm -lrt -ldl -lpthread -lrt -ldl -lcrypt -lm -lc
/usr/bin/ld: cannot find -lmysqlclient_r
collect2: ld returned 1 exit status
make: *** [mysql2.so] Error 1
Gem files will remain installed in /var/lib/gems/1.8/gems/mysql2-0.3.11 for inspection.
Results logged to /var/lib/gems/1.8/gems/mysql2-0.3.11/ext/mysql2/gem_make.out
I've tried installing with mysql_config, I've installed the libmysqlclient-dev and libmysql-ruby libraries, I've tried uninstalling and reinstalling mysql. None of it works. I am able to successfully install mysql gem but not mysql2.
I'm running ruby1.8 and Rails 2.3.5. Can anyone help me out?
try this:
sudo apt-get install libmysql-ruby
sudo apt-get install libmysqlclient-dev
sudo gem install mysql2
Look at this blog and others like it. But ultimately, I recommend upgrading from 11.04 to 11.10. I experienced many strange errors when running 11.04, since moving to 11.10 everything is much more stable.
If you are running CentOS/Redhat, try install the following packages (using yum):
MySQL-devel-5.5.22-1.el6.x86_64
MySQL-shared-5.5.22-1.el6.x86_64
MySQL-shared-compat-5.5.22-2.el6.x86_64