Building mysql extension/gem with MinGW (was Gem build issues Ubuntu 9.10 64 bit)



  • 1. Not able to create using rake
    jagadeesh@jagadeesh-laptop ~/TODO/mysql $ rake db:create:all (in /home/jagadeesh/TODO/mysql) Couldn't create database for {"encoding"=>"utf8", "username"=>"root", "adapter"=>"mysql", "database"=>"todo_production", "pool"=>5, "host"=>"localhost", "password"=>"xxx", "socket"=>"/var/run/mysqld/ mysqld.sock"}, charset: utf8, collation: utf8_general_ci (if you set the charset manually, make sure you have a matching collation) I am using Ubuntu 9.10, Ruby: ruby 1.8.7 (2009-06-12 patchlevel 174) [i486-linux] gem: 1.3.5 mysql: Server version: 5.1.37-1ubuntu5 (Ubuntu) jagadeesh@jagadeesh-laptop ~/TODO/mysql $ rake db:collation (in /home/jagadeesh/TODO/mysql) rake aborted! undefined method `init' for Mysql:Class (See full trace by running task with --trace) What is the solution? Thanks in advance

Building mysql extension/gem with MinGW (was Re: Gem build issues Ubuntu 9.10 64 bit)

Postby Eric Christopherson » Sat, 16 Jan 2010 09:11:23 GMT

On Thu, Jan 14, 2010 at 5:26 PM, Eric Christopherson

Ugh, I top-posted AND forgot to change the subject line. Sorry!

Re: Building mysql extension/gem with MinGW (was Re: Gem build issues Ubuntu 9.10 64 bit)

Postby Luis Lavena » Sun, 17 Jan 2010 05:01:10 GMT

On Jan 14, 9:11m, Eric Christopherson < XXXX@XXXXX.COM >

--with-mysql-dir is the only switch that you need, or --with-mysql-
include and --with-mysql-lib

You're talking about RubyInstaller and combined with DevKit, correct?

If so, then don't install form inside bash or use *nix like paths.

If you have MySQL 5.1, you need:

1) RubyInstaller 1.9.1 installed
2) DevKit installed and configured (edit fstab as indicated in the


3) From a Windows prompt, ensure Ruby and GCC works:

ruby -v
gcc --version

4) Have MySQL installed and know the path where its library is. If you
manually extracted it form the zip, remember the location.

5) proceed to gem installation and indicate the "ruby" platform to
force the compilation. Now use the path to MySQL

gem install mysql --platform ruby -- --with-mysql-include=C:/mysql/
include --with-mysql-lib=C:/mysql/lib/opt

I've indicated "opt" as library because is the "opt"imized version.

Please note that extracting or installing MySQL or Ruby or gems in a
path with spaces can be a problem. Try avoiding them to all cost.

Hope that helps.

Luis Lavena

Similar Threads:

1.Building mysql extension/gem with MinGW (was Gem build issues Ubuntu 9.10 64 bit)

2.Gem build issues Ubuntu 9.10 64 bit

3.MySQL gem on 64-bit Solaris won't compile

4.installing RedCloth gem on ubuntu 9.04 64 -bit

5.Trouble building 64-bit Ruby 1.8.3 on Solaris 10/AMD64

Hello, I'm attempting to build an AMD64 native Ruby interpreter on top
of Solaris 10 with gcc and have been running into a number of

The first is ensuring that the -m64 parameter, which instructs gcc to
build 64-bit executables, is passed correctly.  It seems like LDFLAGS
is ignored.

If I ./configure CC=gcc CFLAGS=-m64 LDFLAGS=-m64 and try to compile I get:

gcc -fPIC -m64 -I. -I../.. -I../../. -I../.././ext/bigdecimal -c bigdecimalc
gcc -Wl,-G  -L'../..' -o ../../.ext/i386-solaris2.10/
bigdecimal.o  -ldl -lm   -lc
ld: fatal: file bigdecimal.o: wrong ELF class: ELFCLASS64

Because the -m64 parameter was not being passed during linking (same
behavior occurs if I set the CC/CFLAGS/LDFLAGS) environment variables.

As a workaround, I tried creating a wrapper script called "gcc64"
which contains the following:


/usr/sfw/bin/gcc -m64 $*

And it compiles successfully, however:

# make test
make: Warning: Illegal dependency list for target `.DEFAULT'
not ok system 1 -- ./sample/test.rb:1643
not ok system 2 -- ./sample/test.rb:1644
not ok system 3 -- ./sample/test.rb:1650
not ok system 4 -- ./sample/test.rb:1651
not ok system 5 -- ./sample/test.rb:1658
not ok system 6 -- ./sample/test.rb:1668
not ok system 7 -- ./sample/test.rb:1669
sample/test.rb:2037: Invalid char `\377' in expression
not ok system 9 -- ./sample/test.rb:1711
test failed
*** Error code 1

Okay, not good.  If I try to make install and install gems...

/root/rubygems-0.8.11/./post-install.rb:73:in `instance_eval': compile
error (SyntaxError)
/root/rubygems-0.8.11/./post-install.rb:73: Invalid char `\377' in
expression   from setup.rb:583:in `try_run_hook'

For some reason there's a corrupt looking character at the bottom of
the file.  If I edit the file with vim, it reports:

"post_install.rb" [Incomplete last line] 73 lines, 2018 characters

If I delete the offending line it solves *that* problem, but begins to
complain about other files in site_ruby having "Invalid char `\377' in
expression".  It seems like virtually every file in site_ruby is

Any ideas?

Tony Arcieri

6. Can't build Ruby 1.9.1p129 on a 64 bit openSUSE 11.0 system

7. Problem building mysql gem

8. archflags for compiling gems 64 bit

Return to ruby


Who is online

Users browsing this forum: No registered users and 94 guest