[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Compiling MySQL-Ruby on Tiger

pat allan

5/18/2005 1:08:00 PM

Hi all

I've been trying to compile mysql-ruby on MacOS X 10.4 Tiger, but
having no luck.

When I run ruby extconf.rb --with-mysql-dir=/usr/local/mysql:
# ruby extconf.rb --with-mysql-dir=/usr/local/mysql
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... no
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

... from what I can tell, that's because the mac version of MySQL
doesn't come with libmysqlclient.so - apparently the only way to get
that is to build mysql from source, which i'd like to avoid if
possible.

The install guide also suggests a different flag, --with-mysql-config:
# ruby extconf.rb --with-mysql-config
checking for mysql_ssl_set()... no
checking for mysql.h... yes
creating Makefile

Success? Well, just that step. I then run make, and get the following
output:
# make
gcc -fno-common -arch i386 -arch ppc -g -Os -pipe -fno-common -arch
i386 -arch ppc -pipe -pipe -fno-common -I.
-I/usr/lib/ruby/1.8/powerpc-darwin8.0
-I/usr/lib/ruby/1.8/powerpc-darwin8.0 -I. -DHAVE_MYSQL_H
-I/usr/local/mysql/include -fno-omit-frame-pointer -c mysql.c
gcc: installation problem, cannot exec 'i686-apple-darwin8-gcc-4.0.0':
No such file or directory
mysql.c: In function 'query':
mysql.c:635: error: invalid storage class for function 'res_free'
lipo: can't figure out the architecture type of: /var/tmp//ccoPCQRI.out
make: *** [mysql.o] Error 255

'i686' looks strange to me. The version of gcc is 4.0.0 - if I run the
above gcc command with gcc-3.3 it comes up with a single line:
# gcc-3.3 -fno-common -arch i386 -arch ppc -g -Os -pipe -fno-common
-arch i386 -ar ppc -pipe -pipe -fno-common -I.
-I/usr/lib/ruby/1.8/powerpc-darwin8.0
-I/usr/lib/ruby/1.8/powerpc-darwin8.0 -I. -DHAVE_MYSQL_H
-I/usr/local/mysql/include -fno-omit-frame-pointer -c mysql.c
gcc-3.3: cannot read specs file for arch `i386'

For reference's sake, I'm using MySQL 4.1.11 from the installer at
dev.mysql.org - which is why I'm not trying Ruby-MySQL (since it
doesn't like 4.1.*)

This happens on both 10.4.0 (which I was using last night) and 10.4.1.
I've not used ruby before, but the gems, rake and rails installs were
fine.

Any clues? Or should I just give in and compile mysql from scratch?

14 Answers

Philipp Kern

5/18/2005 6:50:00 PM

0

pat allan wrote:
> .. from what I can tell, that's because the mac version of MySQL
> doesn't come with libmysqlclient.so - apparently the only way to get
> that is to build mysql from source, which i'd like to avoid if
> possible.

Well, I did not yet install it here on Tiger, but it would be
libmysqlclientX.dylib instead of .so, try to look for it by using
"mdfind" or "locate".

> gcc -fno-common -arch i386 -arch ppc -g -Os -pipe -fno-common -arch
> i386 -arch ppc -pipe -pipe -fno-common -I.
> [...]
> 'i686' looks strange to me. The version of gcc is 4.0.0 - if I run the
> above gcc command with gcc-3.3 it comes up with a single line:

The hole compiler command seems messed. You really need to kick the
"-arch i386" out of the line.

Kind regards,
Philipp Kern

tdgrmsn@gmail.com

5/18/2005 7:42:00 PM

0

Possibly avoiding the issue, one workaround might be building your own
ruby 1.8.2 in /usr/local and using that instead of the Apple version. I
haven't tried on Tiger but the build was simple on Panther (./configure
; make; sudo make install), and I've generally had better luck with
self-compiled versions of langs included with OS X (like ruby, python,
etc.)

Philipp Kern

5/18/2005 11:25:00 PM

0

ToddG wrote:
> [...] and I've generally had better luck with self-compiled
> versions of langs included with OS X (like ruby, python, etc.)

The only thing the Ruby build included in Tiger lacks is readline. Sadly
this is really important when one is used to work in the "irb" all the
time. Does anyone know of a solution to this problem?

Kind regards,
Philipp Kern

Jonathan Weiss

5/18/2005 11:50:00 PM

0

> ToddG wrote:
>> [...] and I've generally had better luck with self-compiled
>> versions of langs included with OS X (like ruby, python, etc.)
>
> The only thing the Ruby build included in Tiger lacks is readline. Sadly
> this is really important when one is used to work in the "irb" all the
> time. Does anyone know of a solution to this problem?
>
> Kind regards,
> Philipp Kern
>

http://tech.rufy.co...
and
http://blog.innerewut.de/articles/2005/05/08/tiger-and-rub...


Jonathan




pat allan

5/19/2005 12:16:00 AM

0

Hi Philipp, Todd

There's no file on my machine which starts with libmysqlclient
according to locate, mdfind and spotlight.

And taking -arch i386 out of the compile command removes the i868 error
line, but there's still:
mysql.c: In function 'query':
mysql.c:635: error: invalid storage class for function 'res_free'

I'll try compiling ruby from scratch (which worked fine on Panther for
me too), and see if that provides a solution.

Thanks for the help :)

Patrick Gundlach

5/19/2005 8:59:00 AM

0


Hi,

> There's no file on my machine which starts with libmysqlclient
> according to locate, mdfind and spotlight.

same here.

> And taking -arch i386 out of the compile command removes the i868 error
> line, but there's still:
> mysql.c: In function 'query':
> mysql.c:635: error: invalid storage class for function 'res_free'


It worked for me using 2.5.2
(http://www.tmtm.org/en/mysql/ruby/mysql-ruby-2....) and
typing:

tar xzf mysql-ruby-2.5.2.tar.gz
cd mysql-ruby-2.5.2
ruby extconf.rb --with-mysql-dir=/usr/local/mysql
make
make install


Patrick

Philipp Kern

5/19/2005 9:09:00 AM

0

Jonathan Weiss wrote:
> http://blog.innerewut.de/articles/2005/05/08/tiger-and-rub...

Thank you for this nice little script which made all this fix a one
liner. It works fine now.

Kind regards,
Philipp Kern

pat allan

5/19/2005 11:53:00 AM

0

Ye gods I think that did it.

Well, with some modifications. I used the --with-mysql-config flag and
the serverlogistics.com version of mysql (I assume you're not using the
default mysql package?). I also had to manually remove the -arch i386
from its two points in the Makefile.

But it has compiled and installed. From one Pat to another, thankyou.
And a massive thanks to all who've provided any input into this thread.

Patrick Gundlach

5/19/2005 12:05:00 PM

0

Hi,

> Well, with some modifications. I used the --with-mysql-config flag and
> the serverlogistics.com version of mysql (I assume you're not using the
> default mysql package?). I also had to manually remove the -arch i386
> from its two points in the Makefile.

I use the one from the mysql site. Don't ask me for the filename, but
it was the 'standard binary distribution for panther', version 4.11.
IIRC. I just installed the pkg, nothing more (and I am using a launchd
xml file instead of the startup script).


> But it has compiled and installed. From one Pat to another, thankyou.

You're very welcome.

Patrick

rom

5/21/2005 6:36:00 AM

0

I might be forking this thread, but I'm having the same problem. I'm
using mySQL 4.1.10 compiled from source via Fink. Don't get me wrong,
if there isn't a fix for this I will definately try the install that
was illustrated earlier using the ServerLogistics install.

I've been hacking at this for about 2 hours, and it just seems too
close to abandon completely. I found the following in the
documentation for mysql-ruby:
" If you get error like 'libmysqlclient not found' when testing, you
need to specify the directory in which the library is located so that
make can find it.
'% env LD_RUN_PATH=libmysqlclient.so directory make'"

I used 'mdfind' to find the libmysqlclient at:
'/sw/lib/mysql/libmysqlclient.14.0.0.dylib'

However, I don't know how to get extconf.rb find it. I'd appreciate
any help with this. I've been working on this so long, I can't see the
forest for the trees, right now. I may not even be grokking the 'env'
command right now...

Thanks!

> Pat Allan wrote:
<snip>

I've been trying to compile mysql-ruby on MacOS X 10.4 Tiger, but
having no luck.

When I run ruby extconf.rb --with-mysql-dir=/usr/local/mysql:
# ruby extconf.rb --with-mysql-dir=/usr/local/mysql
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... no
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

</snip>