问题
Rails ask me to succeed with gem install mysql2 and on trying I got the following error.So what is mostly problem with such error? Detail of error is below: 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=/usr/local/bin/ruby
--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
--with-mlib
--without-mlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-zlib
--without-zlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-socketlib
--without-socketlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-nsllib
--without-nsllib
--with-mysqlclientlib
--without-mysqlclientlib
--with-mygcclib
--without-mygcclib
--with-mysqlclientlib
--without-mysqlclientlib
Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.7 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.7/ext/mysql2/gem_make.out
This error occured in the result of
sudo gem install mysql2
Is there any problem in installation of mysql? Please tell whatever you know about that, I really appreciate your spent time on reading my question.
thanks
回答1:
if you have not installed mysql try adding the following full packages:
sudo apt-get install mysql-server mysql-server-5.1 libmysql-ruby libmysqlclient-dev mysql-client-5.1 mysql-common
Also checkout this heroku db:pull cant connect to my DB in ubuntu
回答2:
This should solve your problem
sudo apt-get install libmysqld-dev libmysqlclient-dev mysql-client
gem install mysql2
回答3:
I had a lot of problems installing Rails and especially mysql first time around... try reading this post: Error installing mysql2: Failed to build gem native extension
来源:https://stackoverflow.com/questions/7967648/facing-error-installing-mysql2-gem