mysql2-0.3.11 can not be installed - mysql

Hi I want to install Gitlab on Debian 7.0 when i want to install the bundle i get follor error by mysql2-0.3.11
root#v22013051598612672:/home/git/gitlab# gem install mysql2 -v '0.3.11'
Fetching: mysql2-0.3.11.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
*** 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.
Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1 /gems/mysql2-0.3.11 for inspecti on.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11/ext/mysql2/gem_make.out
I have you a idea?
Mfg user2182545 (ternes3)
PS: I need it for GitLAB

Try to install mysql + libraries via apt-get install mysql-server libmysqlclient libmysqlclient-dev mysql-client mysql-common

The issue 754 mentions seeing this error even after gem install mysql2 and apt-get install libmysqlclient-dev.
But it also adds:
EDIT: Solved!
sudo apt-get install libmariadbclient16-dev
Check if this is the actual missing piece on your Debian.

Related

Fail to install MySQL2 gem on Mac

I'm trying to install mysql2 gem for rails applications but it gives me following error while running sudo gem install mysql2
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
current directory: /Users/ateeq/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mysql2-0.4.5/ext/mysql2
/Users/ateeq/.rbenv/versions/2.3.1/bin/ruby -r ./siteconf20161103-83594-10ft58j.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/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
-----
Don't know how to set rpath on your system, if MySQL libraries are not in path mysql2 may not load
-----
-----
Setting libpath to /usr/local/Cellar/mysql/5.7.16/lib
-----
creating Makefile
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/ateeq/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-16/2.3.0-static/mysql2-0.4.5/mkmf.log
current directory: /Users/ateeq/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mysql2-0.4.5/ext/mysql2
make "DESTDIR=" clean
current directory: /Users/ateeq/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mysql2-0.4.5/ext/mysql2
make "DESTDIR="
compiling client.c
compiling infile.c
compiling mysql2_ext.c
compiling result.c
compiling statement.c
linking shared-object mysql2/mysql2.bundle
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mysql2.bundle] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/ateeq/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mysql2-0.4.5 for inspection.
Results logged to /Users/ateeq/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-16/2.3.0-static/mysql2-0.4.5/gem_make.out
I installed rails via brew & rbenv. Versions are mentioned below:
Ruby Version: ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin16]
Rails Version: Rails 4.2.6
MySql Version: mysql-5.7.16
Pull up an instance of Terminal and run:
brew doctor
It's likely that one or more dependencies for building the mysql gem are out of date.
You'll have to run:
brew update
You probably also upgraded to the Sierra release of OS X recently. Make sure your XCode command line tools is up to date. Run:
xcode-select --install
Make sure you accept the license for the new version of XCode by running:
sudo xcodebuild -license
Here is my solution for above error:
I just uninstalled mysql by running brew remove mysql and then run following command to install mysql2 gem sudo gem install mysql2. It worked for me. After this, I reinstalled mysql by running brew install mysql.
P.s. I don't know about this behaviour. If anyone can explain, it'd be great.

Error installing do_mysql in Windows for Ruby

I have recently installed Ruby in my Windows machine and trying to setup in localhost a project that is built in Sinatara framework. For this I need to run few commands like below.
gem install bundle
bundle install
The first command executed without any issue. When I tried to execute second command, it throws below error after a while.
Installing do_mysql 0.10.16 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
C:/Ruby22-x64/bin/ruby.exe -r ./siteconf20150808-5540-i2wwjw.rb extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
generating do_mysql-x64-mingw32.def
compiling do_common.c
compiling do_mysql.c
do_mysql.c:5:19: fatal error: mysql.h: No such file or directory
compilation terminated.
make: *** [do_mysql.o] Error 1
make failed, exit code 2
Gem files will remain installed in C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/do_mys
ql-0.10.16 for inspection.
Results logged to C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0
/do_mysql-0.10.16/gem_make.out
An error occurred while installing do_mysql (0.10.16), and Bundler cannot
continue.
Make sure that `gem install do_mysql -v '0.10.16'` succeeds before bundling.
As the above error sugested me to run "gem install do_mysql -v '0.10.16'", I did and again got same error. I have attached the error below.
C:\Users\binoy\live>gem install do_mysql -v '0.10.16'
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing do_mysql:
ERROR: Failed to build gem native extension.
C:/Ruby22-x64/bin/ruby.exe -r ./siteconf20150808-9876-odu2ng.rb extconf.rb
checking for my_global.h... no
checking for mysql.h... no
checking for main() in -llibmysql... no
checking for mysql_query() in mysql.h... no
checking for mysql_ssl_set() in mysql.h... no
checking for localtime_r()... yes
checking for gmtime_r()... yes
checking for mysql.h... no
checking for MYSQL_TYPE_STRING in mysql.h... no
checking for MYSQL_TYPE_BIT in mysql.h... no
checking for MYSQL_TYPE_NEWDECIMAL in mysql.h... no
checking for mysql_query() in mysql.h... no
checking for mysql_ssl_set() in mysql.h... no
checking for mysql_sqlstate() in mysql.h... no
checking for mysql_get_ssl_cipher() in mysql.h... no
checking for mysql_set_character_set() in mysql.h... no
checking for mysql_get_server_version() in mysql.h... no
checking for MYSQL_FIELD.charsetnr in mysql.h... no
checking for rb_thread_fd_select()... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
generating do_mysql-x64-mingw32.def
compiling do_common.c
compiling do_mysql.c
do_mysql.c:5:19: fatal error: mysql.h: No such file or directory
compilation terminated.
make: *** [do_mysql.o] Error 1
make failed, exit code 2
Gem files will remain installed in C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/do_mys
ql-0.10.16 for inspection.
Results logged to C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0
/do_mysql-0.10.16/gem_make.out
I got stuck here. I will really appreciate your help.
Thanks, Binoy

Weird mysql error `checking for main() in -llibmysql... no`

I've successfully installed the gem mysql2 with ruby under windows in the past, but now it's showing a weird error
checking for main() in -llibmysql... no
There is no typo, my console really shows -llibmysql and not -libmysql (and I think it should even be just libmysql without any dash)
I have followed all the instructions from this link, and my command looks like
gem install mysql2 -- '--with-mysql-lib="c:\Dev\MySQL_Connector\lib" --with-mysql-include="c:\Dev\MySQL_Connector\include"'
...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
C:/Bibliotheques/Dev/Ruby200-x64/bin/ruby.exe extconf.rb --with-mysql-lib=c:\Dev\MySQL_Connector\lib --with-mysql-in
clude=c:\Dev\MySQL_Connector\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 --with-mysql-dir=c:\Dev\MySQL_Connector
-----
checking for main() in -llibmysql... no

Ruby on Rails installation issue (Windows)

I installed Ruby 2.0.0 and DevKit from RuyInstaller. I have an error message when I'm creating new project:
rails new testtest -d mysql
..... a lot of output here ........
Installing mysql2 (0.3.14)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
C:/Ruby200/bin/ruby.exe 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
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
*** 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.
How can I install dependencies to make this gem without any errors?
You need MySQL 32-bit (or MySQL Connector C) to compile mysql2 gem compiling on Windows (even if you are using a 64-bit version of the OS).
Follow these steps:
Download MySQL Server 32-bit .zip file (Alternatively MySQL Connector C is also fine)
Copy libmysql.dll to %RUBY_HOME%\bin (or simply add MySQL 32-bit lib directory to PATH)
Install mysql2 gem with --with-mysql-lib and --with-mysql-include options
gem install mysql2 -- '--with-mysql-lib="c:\path\to\32-bit-MySQL-Server\lib\opt" --with-mysql-include="c:\\path\to\32-bit-MySQL-Server\include"'
Here is my story. Tried to install mysql2 gem on windows 7 with devkit.
First you need to install connector libraries and headers.
Don't use default folder "Program Files", gem failed to include folders with spaces.
I've substed connector folder through subst X:\ "C:\Program File\Mysql Connector 6 C\"
and then used following cmd:
gem install mysql2 -- --with-mysql-dir=X:\
Then realised that I'm using 64 bit connector libraries with 32 bit ruby.
Reinstalled connector.
And then gem was successfully installed.
But failed to run, complaining on missing mysql dll. So, I've put libmysql.dll and *.lib to ruby\bin folder. And after all this was able to user mysql2 gem.

Can't run install MySQL gem Fedora 14, even after installing mysql-devel, ruby-devel, and rubygems

I'm trying to install the mysql gem via
sudo gem install mysql --version 2.7
However, I get the following error:
Building native extensions. This could take a while...
...........
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no
*** 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.
Any ideas?
somethings to try:
gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
of course use path of where your mysql_config is. mysql_config will be there if you've installed a mysql client
gem install mysql -- \
--with-mysql-include=/usr/include/mysql \
--with-mysql-lib=/usr/lib/mysql
use paths of where your lib and headers are for mysql.