I ma trying to install fat free crm on windows using these instructions http://guides.fatfreecrm.com/Setup-Microsoft-Windows.html
I am on the part where we install mysql2 lib and libmysql.dll
The command "gem install --no-rdoc --no-ri mysql2 -v 0.2.7 -- with-mysql-dir=X: --with-mysql-lib=X:\bin --with-mysql-include=X:\include" fails and error comes "Error installing mysql2:
ERROR: Failed to build gem native extension.".I fixed this part my changing the version of mysql in the command to 0.3.11.Now the last step says to copy libmysql.dll but I cant find that file in the specified directory.
If it's of interest, Bitnami has recently published a one-click installer for FFCRM. See https://bitnami.com/stack/fat-free-crm I'll also update the FFCRM docs to note this.
Related
I am having problems installing mysql2 gem on my windows machine, usually it worked, but now I get Failed to build native extension. I googled around, but there were a lot of linux fixes. I know its not the best thing to work on windows with ruby. Back to the problem, I used gem install mysql2 -- --with-mysql-dir=C:\wamp\bin\mysql\mysql5.6.12\bin --with-mysql-lib=C:\wamp\bin\mysql\mysql5.6.12\lib to install mysql2, it works with mysql, but rails requires mysql2.
Thank you.
mysql2 can be tricky to install. We JUST got a dev box working with Ruby 2.0.0p247, Windows 64bit and mysql 0.3.13. Here are some suggestions:
Make sure you have the latest DevKit installed (http://rubyinstaller.org/downloads/). On the right column of the page, it tells you which version of the DevKit you'll need for your particular version of Ruby. We've found it was easiest to install it to C:\DevKit
Now try and run the gem install mysql2 ... command you listed in your question. Alternatively, for 32bit installs we do:
subst X: "C:\Program Files (x86)\MySQL\MySQL Server 5.6"
gem install mysql2 -v=0.3.13 --platform=ruby -- --with-mysql-include=X:\include --with-mysql-lib=X:\lib
subst X: /d
The subst command creates a virtual drive and helps with the spaces in the path name.
Copy the C:\Program Files (x86)\MySQL\MySQL Server 5.6\lib\libmysql.dll to your Ruby bin directory. You should be off and running if you're working with 32bit.
64bit users however will likely run into another bug once they get mysql2 to build. The above steps will appear to work, but when they actually go to use the mysql2 gem to do something useful, like run rake db:create, they get a segmentation fault. More info and a fix for the issue can be found at https://github.com/brianmario/mysql2/issues/372, https://bugs.ruby-lang.org/issues/8591, https://groups.google.com/forum/#!topic/rubyinstaller/uTNffOt6Yqo
Long story short, a compatible mysql connector c needs to be used instead of the MySQL server directory. A helpful user provided the right connector c and it can be downloaded here (https://www.copy.com/s/CHZ4eT4us6f1/mysql-connector-c-noinstall-6.0.2-winx64.zip). Extract that zip file, and point your gem install mysql2 ... command to the appropriate directories and 64bit happiness will follow. (Don't forget to grab the libmysql.dll from the downloaded connector c folder and place it in your ruby bin directory).
Execute this command in command prompt.
gem install mysql2 -- '--with-mysql-lib="c:\Program Files\MySQL\MySQL Server 5.1\lib\opt" --with-mysql-include="c:\Program Files\MySQL\MySQL Server 5.1\include"'
note: change the Mysql installation directory as per your installation.
That should work perfectly
Download the 32-bit Zip Archive of connector from here. Then copy the extracted folder to the root of your C drive for ease of access so that your connector folder path will be something like this
C:\mysql-connector-c-6.1.3-win32\
Now copy this line of code to your cmd and execute (remember to change the connector version number with your one)
gem install mysql2 --platform=ruby -- '--with-mysql-dir="C:/mysql-connector-c-6.1.3-win32/"'
After trying for a long time I successfully installed mysql2 gem in both of my 32 and 64 bit windows 7 in this way. Cheers!
Environment:
Windows 7 64bit (Home Premium)
Ruby 1.9.2 p290 (2011-07-09) [i386-mingw32]
Rails 3.0.10
MySQL 5.5
Ruby, despite my having successfully installed the mysql2 rubygem thinks that the gem is missing when I invoke a rails command that requires it.
After having spent the evening getting the mysql rubygem installed on Windows 64 bit, I decided to (finally) get cracking on linking mysql to a local rails server. This is how I was trying to do it...
(Fairly) Exact transcript from cmd.exe
C:\rails\cookbook>gem install mysql --platform=ruby -- --with-mysql-include=c:\mysql\include --with-mysql-lib=c:\mysql\lib
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed mysql-2.8.1
1 gem installed
Installing ri documentation for mysql-2.8.1...
Installing RDoc documentation for mysql-2.8.1...
(I thought this was successful mysql install, should I test it somehow?)
C:\>gem install mysql2 --platform=ruby -- --with-mysql-include=c:\mysql\include --with-mysql-lib=c:\mysql\lib
Fetching: mysql2-0.3.7.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed mysql2-0.3.7
1 gem installed
Installing ri documentation for mysql2-0.3.7...
Enclosing class/module 'mMysql2' for class Client not known
Installing RDoc documentation for mysql2-0.3.7...
Enclosing class/module 'mMysql2' for class Client not known
(Same as above - I thought this was successful mysql install)
C:\rails>rails new cookbook -d mysql
(successfully creates directories for project in c:\rails\cookbook)
C:\rails\cookbook>rails server
?[31mCould not find gem 'mysql2 (~> 0.2.11)' in any of the gem sources listed in your Gemfile.?[0m
?[33mRun `bundle install` to install missing gems.?[0m
Notes:
I noticed it wants rubygem mysql2-0.2.11, I have 0.3.7. I tried installing 0.2.11 specifically by the method I used to install the two gems above. No dice, it couldn't find a gem by the name mysql2-0.2.11 in 'any repository'
I'm stumped, any thoughts fellas (and gals)?
I believe your MySQL installation is a 64bits (like Windows), correct?
Ruby is 32bits, so you cannot link 32bits against 64bits.
I've posted a article covering the installation steps on my blog:
http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/
These steps use MySQL Connector/C to workaround the 32bits versus 64bits issues.
Both mysql or mysql2 gem should work with this.
Have you included mysql2 in your Gemfile and subsequently executed bundle install ?
## my sql installation (on 64 bit architecture)
download connector (download zip file and extract it to c drive)
http://dev.mysql.com/downloads/connector/c/
download mysql
http://dev.mysql.com/downloads/installer/5.6.html
command to install mysql with connector
C:\Sites\rails_project\resume>gem install mysql --platform=ruby -- --with-mysql-
dir=C:/mysql-connector-c-6.1.0-win32
After this copy libmysql.dll from connector folder and paste it to ruby>bin folder
I'm trying to move a small Sinatra app I have going on an Ubuntu box to a redhat box.
While installing gems, I get a "Can't build native extension" error while trying to install the gem dm-mysql-adapter.
I have mysql-devel installed, which I believe is the required library, but it doesn't seem to work.
All the info I can find online is for Ubuntu and says installing libmysqlclient-dev (which doesn't exist for Redhat; again, I believe mysql-devel is the appropriate package).
Any advice for someone using redhat?
you have the correct package "mysql-devel-5.1.48-1" but the gem installs fine on my centos5 box without the package installed, you could try the ruby-mysql gem instead.
[11:13:01][root#HOST:~]# gem search mysql
*** LOCAL GEMS ***
[11:13:03][root#HOST:~]# rpm -qa | grep -i mysql
perl-DBD-MySQL-3.0007-2.el5
mysql-5.0.77-4.el5_5.4
[11:13:11][root#HOST:~]# gem install mysql
Building native extensions. This could take a while...
Successfully installed mysql-2.8.1
1 gem installed
Installing ri documentation for mysql-2.8.1...
...
[11:13:22][root#HOST:~]#
I am trying to use the mysql package included in xampp with ruby on rails on windows 7, but cannot seem to get them to work together.
I have rails 3.0.0 and xampp 1.7.3
rails works with sqlite within xampp just fine, but when attempting to use mysql via "rails new project -d mysql; cd project; bundle install"
I get the following:
Installing mysql2 (0.2.4) with native extensions C:/xampp/Ruby192/lib/ruby/1.9.1
/rubygems/installer.rb:483:in `rescue in block in build_extensions': ERROR: Fail
ed to build gem native extension. (Gem::Installer::ExtensionBuildError)
C:/xampp/Ruby192/bin/ruby.exe extconf.rb
checking for rb_thread_blocking_region()... *** 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.
Am I missing anything? All the posts about this issue tell me to use gem install mysql -- --with-mysql-config=PATH, but this does not seem to work with Windows, as I get the same error regardless.
And if it's just not possible, are there any drawbacks to using sqlite now, then trying to migrate the databse over to mysql (or another more robust database) later?
Did you install the mysql gem?
gem install mysql
After this you need to go to the mysql\bin directory in your XAMPP folder and copy the
libmysql.dll
into your ruby\bin folder.
Give it a try and let me know if it works. Also if your MySql version is 5.1 you may need to download a 5.0 version of the same dll.
gem install mysql --no-rdoc --no-ri -- '--with-mysql-lib="D:\xampp\mysql\lib" --with-mysql-include="D:\xampp\mysql\include"'
I used this code for my solution of mysql this is the right way you can USE mysql for xampp.
I once had a similar issue. The important things i noted was that i already have mysql installed for usage via xampp. Firstly, you should make sure that the mysql installation is accessible from cmd by typing
mysql --version
If it gives you a reply of our installation then you're good to go to the next step else copy the mysql bin directory and save it in your user environment variable called PATH. This should allow you to run the cmd code above fruitfully.
Next Step: run (on cmd)
gem install mysql2 --no-rdoc --no-ri
This worked for me.
So I am getting the same issue as mentioned here -
gem install mysql failure in Snow Leopard
But I haven't been able to get it fixed using the answers on this link.
Here's a brief history -
I had MAMP on my machine,
but now I downloaded the latest MySQL from mysql.com and installed version 5.1.46
this new version runs fine and client "mysql" is able to connect
and I also have XCode v3.2.1, since someone mentioned that it can cause issues.
Here's the error -
**Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb --with-mysql-config=/usr/local/mysql/bin/mysql_config
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out**
"can't find header files for ruby" usually means that the system can't locate the header files for Ruby. This happened to me when I upgraded to 10.6 from 10.5. Download the latest XCode from Apple's site and reinstall it. Make sure that you check the box for "UNIX Development" during the install. The header files for Ruby are not in the main package.
Have you installed other versions of Ruby or are you using the standard 1.8.7 that comes with OS X? You can check your version of ruby by typing ruby -v at a terminal prompt.