Forum: Ruby on Rails mysql gem problems

8142bbf600dee6052a9eff03f0d25aa5?d=identicon&s=25 Johnny Mejias (webcraft)
on 2011-02-18 08:10
(Received via mailing list)
I have Xcode 3.0+ installed
Ruby 1.9.2
And a direct dmg for mysql


$ sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
Password:
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
ERROR: Failed to build gem native extension.

        /usr/local/bin/ruby extconf.rb --with-mysql-dir=/usr/local/mysql
checking for mysql_ssl_set()... *** 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.

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
/usr/local/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed
to
generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/local/lib/ruby/1.9.1/mkmf.rb:435:in `try_link0'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:440:in `try_link'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:552:in `try_func'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:797:in `block in have_func'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in
postpone'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:796:in `have_func'
from extconf.rb:50:in `<main>'


Gem files will remain installed in
/usr/local/lib/ruby/gems/1.9.1/gems/mysql-2.8.1 for inspection.

I really need to fix this problem and i dont have no idea how to

thanks for the help
F59bbb5527258c3fb5d82a5cb22050f1?d=identicon&s=25 Victor Stan (victor)
on 2011-02-18 14:11
(Received via mailing list)
if you're on a mac, get homebrew, then type in your terminal "brew
install
mysql"
25e32b05b6d799b0f1b5685c938b4094?d=identicon&s=25 Bhasker Harihara (Guest)
on 2011-02-18 17:59
(Received via mailing list)
Hi,

I think you have to install mysql development stuff first.

In Centos I had the same problem, after i installed mysql-devel, I could
install mysql without any erros.

Cheers,
8142bbf600dee6052a9eff03f0d25aa5?d=identicon&s=25 Johnny Mejias (webcraft)
on 2011-02-19 00:26
(Received via mailing list)
where do i find those dev tools?
25e32b05b6d799b0f1b5685c938b4094?d=identicon&s=25 Bhasker Harihara (Guest)
on 2011-02-19 05:24
(Received via mailing list)
In my case (CentOS 5.5) i id a

$sudo yum -y install mysql-devel
8142bbf600dee6052a9eff03f0d25aa5?d=identicon&s=25 Johnny Mejias (webcraft)
on 2011-02-19 12:55
(Received via mailing list)
I cant seem to find the equivalent of those packages for mac. If someone
knows the steps for MacOSX i would sureley apreciate it.
13f137a10c897ff3b75b110115e68373?d=identicon&s=25 Peter Bell (Guest)
on 2011-02-19 15:03
(Received via mailing list)
It might be worth leaving a little more context in your postings. I
don't know offhand which packages you're looking for as I'm just
"checking in" on the list in a spare moment. I may not know the answer
to your question, but if there was some judicious snipping of the
original email I'd have a better shot at being able to answer. I'm sure
I am not the only one.

Just a thought . . .

Best Wishes,
Peter
609c09e50144e8be8db70745ec94f315?d=identicon&s=25 Phil Crissman (Guest)
on 2011-02-19 15:30
(Received via mailing list)
Phil


On Sat, Feb 19, 2011 at 8:02 AM, Peter Bell <peter@pbell.com> wrote:

>
> On Feb 19, 2011, at 6:54 AM, deadnuker wrote:
>
> > I cant seem to find the equivalent of those packages for mac. If someone
> knows the steps for MacOSX i would sureley apreciate it.
> >
>

If you have XCode installed, that's all you need as far as dev packages.
It
includes compilers, development libraries, and so forth. You don't
really
need to worry about it, as long as XCode is more or less completely
installed, you're good. It may be worthwhile making sure you have the
latest
version (free download from Apple, after all), but otherwise, you're
good.

For latest versions of Mac OS X, XCode, and the mysql gem, I've had no
troubles; but you used to need to do something like:

gem install mysql -- with-mysql-config=/usr/local/mysql/bin/mysql_config

The big caveat, of course, is checking to see that this path in the
example
above is actually correct. If your mysql is in /opt/local or somewhere
else,
look there instead. This used to be a very common hurdle for installing
the
mysql gem on Mac OS X, so a few good Google searches should get you more
suggestions than you even want... :)
8142bbf600dee6052a9eff03f0d25aa5?d=identicon&s=25 Johnny Mejias (webcraft)
on 2011-02-19 15:44
(Received via mailing list)
See thats the thing I have done everything by the book. and with the
feedback i been getting but it stil says:

Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
*ERROR: Failed to build gem native extension.*

        /usr/local/bin/ruby extconf.rb
--with-mysql-config=/usr/local/mysql/bin/mysql_config
checking for mysql_ssl_set()... *** 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.

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
/usr/local/lib/ruby/1.9.1/mkmf.rb:368:in `try_do':
*The complier failed to generate an executable file. (RuntimeError)*
*You have to install development tools first.*
from /usr/local/lib/ruby/1.9.1/mkmf.rb:435:in `try_link0'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:440:in `try_link'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:552:in `try_func'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:797:in `block in have_func'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in
postpone'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:796:in `have_func'
from extconf.rb:50:in `<main>'


Gem files will remain installed in
/usr/local/lib/ruby/gems/1.9.1/gems/mysql-2.8.1 for inspection.

:(
13f137a10c897ff3b75b110115e68373?d=identicon&s=25 Peter Bell (Guest)
on 2011-02-19 15:46
(Received via mailing list)
On Feb 19, 2011, at 9:43 AM, deadnuker wrote:

> See thats the thing I have done everything by the book. and with the feedback i
been getting but it stil says:
>
> Building native extensions.  This could take a while...
> ERROR:  Error installing mysql:
>   ERROR: Failed to build gem native extension.
> Check the mkmf.log file for more
> details.  You may need configuration options.

Just to ask, what does it say in mkmf.log?

Best Wishes,
Peter
8142bbf600dee6052a9eff03f0d25aa5?d=identicon&s=25 Johnny Mejias (webcraft)
on 2011-02-19 15:57
(Received via mailing list)
this is what it says

"gcc -o conftest -I/usr/local/include/ruby-1.9.1/x86_64-darwin10.6.0
-I/usr/local/include/ruby-1.9.1/ruby/backward
-I/usr/local/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE
-I/usr/local/mysql/include  -Os -g -fno-common -fno-strict-aliasing
-arch
i386 -D_XOPEN_SOURCE=1 -fno-common -pipe conftest.c  -L.
-L/usr/local/lib
-L.     -L/usr/local/mysql/lib -lmysqlclient   -lpthread
 -lruby.1.9.1-static  -lpthread -ldl -lobjc "
In file included from /usr/local/include/ruby-1.9.1/ruby.h:32,
                 from conftest.c:1:
/usr/local/include/ruby-1.9.1/ruby/ruby.h:108: error: size of array
ruby_check_sizeof_long is negative
/usr/local/include/ruby-1.9.1/ruby/ruby.h:112: error: size of array
ruby_check_sizeof_voidp is negative
In file included from /usr/local/include/ruby-1.9.1/ruby/intern.h:29,
                 from /usr/local/include/ruby-1.9.1/ruby/ruby.h:1327,
                 from /usr/local/include/ruby-1.9.1/ruby.h:32,
                 from conftest.c:1:
/usr/local/include/ruby-1.9.1/ruby/st.h:69: error: size of array
st_check_for_sizeof_st_index_t is negative
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main() {return 0;}
/* end */
609c09e50144e8be8db70745ec94f315?d=identicon&s=25 Phil Crissman (Guest)
on 2011-02-19 16:17
(Received via mailing list)
Phil


On Sat, Feb 19, 2011 at 8:55 AM, deadnuker <jmejias17@gmail.com> wrote:

>                  from conftest.c:1:
> checked program was:
> /* begin */
> 1: #include "ruby.h"
> 2:
> 3: int main() {return 0;}
> /* end */
>
>
I see ruby 1.9.1 there. I would absolutely recommend 1.9.2 or 1.8.7
instead... 1.9.1 had issues running rails, possibly other issues as
well.

Not saying for certain that this is your problem with installing mysql,
but
you definitely want to change this; *don't* use ruby 1.9.1.

So you might as well get the latest 1.9.2 or 1.8.7 (since you'll need
one or
the other anyways) and then try gem install mysql again.
8142bbf600dee6052a9eff03f0d25aa5?d=identicon&s=25 Johnny Mejias (webcraft)
on 2011-02-19 16:20
(Received via mailing list)
the folder says 1.9.1 but im using v 1.9.2
25e32b05b6d799b0f1b5685c938b4094?d=identicon&s=25 Bhasker Harihara (Guest)
on 2011-02-19 16:39
(Received via mailing list)
Hi,

As Phil said,  it's good to change to 1.9.2.

I am also quiet sure (90%) that the problem is because of
mysql-devel.xxx.
I spent more than half day because of this problem.

If there is a way to check if mysql-devel or mysql-dev is installed, do
that
check to confirm the cause of the problem.

You have to get your mysql-devel from somewhere and install it.

Cheers,
8142bbf600dee6052a9eff03f0d25aa5?d=identicon&s=25 Johnny Mejias (webcraft)
on 2011-02-19 16:43
(Received via mailing list)
i think you might be right but im not sure how to check for it. if
someone
knows that be a great help
8142bbf600dee6052a9eff03f0d25aa5?d=identicon&s=25 Johnny Mejias (webcraft)
on 2011-02-19 18:15
(Received via mailing list)
i FINALLY figured out the problem and what a minute detail for the
trouble
it made.

i was using mysql 32bit version

when i changed to mysql64bit version the problem went away


I didnt think that would be such a horrible problem for a minor
compability
detail

Thanks for the feedback guys
A386496e0ac5c64beea0f0631bfaa357?d=identicon&s=25 Bruno S. Barros (Guest)
on 2011-02-19 18:21
(Received via mailing list)
Please check :

The key change for us Ruby developers, is the fact that, in Snow
Leopard, all the interpreted languages (including Ruby) are now running
in 64-bit by default (obviously, only if you have a 64-bit machine). For
pure Ruby applications and libraries this shouldn't pose any problems.
But if you are migrating from a Leopard environment where you compiled C
extensions for 32-bit only, these gems won't properly load in Snow
Leopard. Same thing goes for libraries you might have compiled in 32-bit
mode and that you might want to use on your migrated system. via rails
blog.

Enjoy!

Bruno Barros (@bkether)
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.