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?
.. 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.
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.)
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.
[...] 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?
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'
[...] 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?
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.
I had seen that first link before, but forgot about it until now - but
I've run it anyways (albeit after compiling ruby manually). It doesn't
seem to have made a difference.
Still no luck, same errors as previously described, so I guess the next
step is to follow the link at the bottom of the comments of Lucas
Carlson's post, and install MySQL from DarwinPorts.
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.
* pat allan <pat.allan@gmail.com> [2005-05-19 10:05:13 +0900]:
Hi Jonathon
I had seen that first link before, but forgot about it until now - but
I've run it anyways (albeit after compiling ruby manually). It doesn't
seem to have made a difference.
Still no luck, same errors as previously described, so I guess the next
step is to follow the link at the bottom of the comments of Lucas
Carlson's post, and install MySQL from DarwinPorts.
That readline issue may be a problem with configure.
I have built readline and ruby on OS X and it works fine.
I just recently had to do the same on a Sun and ran
across the this problem: the readline extension did not
build with ruby make, and it should have. So, after
I did ./configure and make, I did:
cd ext/readline
ruby extconfig.rb
make
make install
Then backup up and finished installing ruby:
cd ../..
make install
···
--
Jim Freeze
Ruby: I can explain it to ya but I can't understand it fer ya.
If you install the mysql from http://serverlogistics.com it will work great on tiger. I got it working with the standard tiger ruiby from apple. Butf I actually shunned that ruby and compiled my own from source. But both of them worked with mysql-ruby. The mysql from the link above also has a sytem preference pane for setting mysql passwords and stopping and restarting mysqld. Once I installed that version of mysql the mysql-ruby extension worked fine like this:
$ruby extconf.rb --with-mysql-config
And them make and sudo make install. Hope this helps
-Ezra
···
On May 18, 2005, at 6:05 PM, pat allan wrote:
Hi Jonathon
I had seen that first link before, but forgot about it until now - but
I've run it anyways (albeit after compiling ruby manually). It doesn't
seem to have made a difference.
Still no luck, same errors as previously described, so I guess the next
step is to follow the link at the bottom of the comments of Lucas
Carlson's post, and install MySQL from DarwinPorts.
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
When trying to follow your steps:
# ruby extconf.rb
checking for tgetnum() in -lncurses... no
checking for tgetnum() in -ltermcap... no
checking for tgetnum() in -lcurses... no
checking for readline/readline.h... no
I'm assuming I need at least one yes for it to generate a make file?
Make returns "Nothing to be done for 'all'", too.
And MySQL 4.x through DarwinPorts isn't yet working on Tiger - so that
avenue's closed at the moment. I might try straight from source if I
can be bothered and have the time, or I might just wait till the
DarwinPorts team get their package sorted.
Ezra, I thought you'd found the silver bullet, and found the key to
make this all work.
Unfortuantely, the error messages haven't changed at all.
Although considering you have got it working, I must be doing
*something* wrong. Altho I've no idea what. Perhaps its a readline
problem - is there a simple test I can run to confirm whether it is
installed correctly?
" 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'"
Actually, if you do not have a specified library in your normal library path you have to use DYLD_LIBRARY_PATH on OS X. The dynamic linker settings are prefixed with "DYLD_" instead of the "LD_" on Linux and perhaps other *nix.
You could try to get "mysql_config" into your path and run "ruby ../extconf.rb --with-mysql-config". It will then run the helper to figure out any compiler flags. This might help.
In article <1116657333.349832.310430@g49g2000cwa.googlegroups.com>,
···
"rom" <JeffRamnani@gmail.com> wrote:
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>
Install gem, then do
sudo gem install mysql -- --with-mysql-lib=/sw/lib/mysql
--with-mysql-include=/sw/include
The -- between mysql and --with-mysql-lib is not a typo.
In article <1116657333.349832.310430@g49g2000cwa.googlegroups.com>,
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>
Install gem, then:
sudo gem install mysql -- --with-mysql-lib=/sw/lib/mysql
--with-mysql-include=/sw/include
But if you're running 10.4, there are issues with Apple's shipped
version of ruby that prevent it from making external libraries properly.
A kind soul posted a script that fixes them, though, at: http://tech.rufy.com/entry/46
* pat allan <pat.allan@gmail.com> [2005-05-19 12:55:14 +0900]:
Hi Jim
When trying to follow your steps:
# ruby extconf.rb
checking for tgetnum() in -lncurses... no
checking for tgetnum() in -ltermcap... no
checking for tgetnum() in -lcurses... no
checking for readline/readline.h... no
Ah yes, I left that part out. On Sun I had to install ncurses before
readline. But I thought it was already on OS X. If you
find it on OS X, then set CFLAGS, CPPFLAGS and LDFLAGS
to make sure they have ncurses in their path.
···
I'm assuming I need at least one yes for it to generate a make file?
Make returns "Nothing to be done for 'all'", too.
And MySQL 4.x through DarwinPorts isn't yet working on Tiger - so that
avenue's closed at the moment. I might try straight from source if I
can be bothered and have the time, or I might just wait till the
DarwinPorts team get their package sorted.
--
Jim Freeze
Ruby: I can explain it to ya but I can't understand it fer ya.