svg% ruby -e 'Marshal.dump(File.new("aa", "w").stat)'
-e:1:in `dump': class File::Stat needs to have instance method `_dump_data' (TypeError)
from -e:1
svg%
I’m just starting out, reading the pickaxe, this forum, and trying to
get a handle on OOP/design patterns. I’m hoping to use Ruby for
database applications, as I’ve been going crazy with unstructured code
in FileMaker (!!!).
I’ve just installed dbi (this on OS X):
[Chiclet:~/Desktop] davidd% tar -xzvf ruby-dbi-all-0.0.20.tar.gz
[Chiclet:~/Desktop] davidd% cd ruby-dbi-all
[Chiclet:~/Desktop/ruby-dbi-all] davidd% ruby setup.rb config
–with=dbi,dbd_mysql
(setup fails if I don’t specify --with, I suppose because of missing
modules???)
[Chiclet:~/Desktop/ruby-dbi-all] davidd% ruby setup.rb setup
[Chiclet:~/Desktop/ruby-dbi-all] davidd% sudo ruby setup.rb install
(used sudo because otherwise got permission errors)
[Chiclet:~/Rubydev/dbi] davidd% ruby simple.rb
/sw/lib/ruby/site_ruby/1.6/dbi/dbi.rb:502:in load_driver': Could not load driver (undefined methodDriver’ for nil) (DBI::InterfaceError)
from /sw/lib/ruby/site_ruby/1.6/dbi/dbi.rb:392:in _get_full_driver' from /sw/lib/ruby/site_ruby/1.6/dbi/dbi.rb:372:inconnect’
from simple.rb:7
MySQL itself (Ver 3.23.52-entropy.ch) seems to be fine, I’ve created
appropriate user…
Any clues for the clueless would be greatly appreciated!
bash-2.05b$ ruby tmp.rb
tmp.rb:2:in dump': class File::Stat needs to have instance method _dump_data’ (TypeError)
from tmp.rb:2
I have a hard time believing that you cannot dump stats for a readonly
file. Anyway im dumping to stdout not a file, just to make sure that
there are no misunderstandings there.
btw. I have this behavior both with and without irb and both on
ruby 1.6.7 (2002-03-01) [i686-linux]
and
ruby 1.6.8 (2002-12-24) [i686-cygwin]
any ideas? (i’d rather not update to 1.8 - at least not before 1.8 comes
out of it’s “pre” state…)
I’m just starting out, reading the pickaxe, this forum, and trying to
get a handle on OOP/design patterns. I’m hoping to use Ruby for
database applications, as I’ve been going crazy with unstructured code
in FileMaker (!!!).
[Chiclet:~/Rubydev/dbi] davidd% ruby simple.rb
/sw/lib/ruby/site_ruby/1.6/dbi/dbi.rb:502:in load_driver': Could not load driver (undefined method Driver’ for nil) (DBI::InterfaceError)
You need to install the ruby-mysql package, as well as the ruby-dbi
package. (ruby-dbi is just a wrapper around ruby-dbi, which is in turn a
Ruby wrapper around the native C API)
Regards,
Brian.
···
On Mon, Jun 23, 2003 at 11:12:01PM +0900, David D’Andrea wrote:
Appreciate the pointer, pretty ug primitive mistake there.
However I still can’t get this to work. I think the mysql DBD isn’t
getting installed properly.
[~/Desktop/mysql-ruby-2.4.4a]% ruby extconf.rb
–with-mysql-include=/usr/local/mysql/include
–with-mysql-lib=/usr/local/mysql/lib
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lm… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lz… yes
checking for mysql_query() in -lmysqlclient… yes
checking for mysql.h… yes
creating Makefile
% make
gcc -fno-common -g -O2 -fno-common -pipe -no-cpp-precomp -I.
-I/sw/lib/ruby/1.6/powerpc-darwin6.6 -I. -I/sw/include -DHAVE_MYSQL_H
-I/sw/include -I/usr/local/mysql/include -c -o mysql.o mysql.c
mysql.c: In function Init_mysql': mysql.c:1420: ER_SUBSELECT_NO_’ undeclared (first use in this function)
mysql.c:1420: (Each undeclared identifier is reported only once
mysql.c:1420: for each function it appears in.)
make: *** [mysql.o] Error 1
% ruby -I. ./test.rb localhost root lovelypass
./test.rb:11:in `require’: No such file to load – ./mysql (LoadError)
from ./test.rb:11
‘%make install’ here fails too, and running simple.rb still returns the
same error (undefined method, DBI::InterfaceError)
hrmm…?
I believe I have the include & lib parameters to extconf.rb correctly
set… Running extconf.rb with no args, or as suggested in DuBois’
tutorial also fail (they don’t find the mysql_query())
I’m not sure what to try at this point, I’ve taken a few stabs:
It doesn’t make a difference if I reinstall the DBI after this DBD
install.
I’ve also tried stopping mysqld before installing the DBD, and
installing under bash, no difference.
I’ve even tried editing extconf.rb’s Makefile to fill in an empty
LIBPATH param…
any ideas? I hope I’m not missing something obvious again…
David
···
On Monday, June 23, 2003, at 02:55 PM, Brian Candler wrote:
You need to install the ruby-mysql package, as well as the ruby-dbi
package. (ruby-dbi is just a wrapper around ruby-dbi, which is in turn
a
Ruby wrapper around the native C API)
Appreciate the pointer, pretty ug primitive mistake there.
However I still can’t get this to work. I think the mysql DBD isn’t
getting installed properly.
[~/Desktop/mysql-ruby-2.4.4a]% ruby extconf.rb
–with-mysql-include=/usr/local/mysql/include
–with-mysql-lib=/usr/local/mysql/lib
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lm… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lz… yes
checking for mysql_query() in -lmysqlclient… yes
checking for mysql.h… yes
creating Makefile
% make
gcc -fno-common -g -O2 -fno-common -pipe -no-cpp-precomp -I.
-I/sw/lib/ruby/1.6/powerpc-darwin6.6 -I. -I/sw/include
-DHAVE_MYSQL_H -I/sw/include -I/usr/local/mysql/include -c -o
mysql.o mysql.c
mysql.c: In function Init_mysql': mysql.c:1420: ER_SUBSELECT_NO_’ undeclared (first use in this function)
mysql.c:1420: (Each undeclared identifier is reported only once
mysql.c:1420: for each function it appears in.)
make: *** [mysql.o] Error 1
% ruby -I. ./test.rb localhost root lovelypass
./test.rb:11:in `require’: No such file to load – ./mysql (LoadError)
from ./test.rb:11
‘%make install’ here fails too, and running simple.rb still returns
the same error (undefined method, DBI::InterfaceError)
Hmm, that’s weird. Looks like the configuration process (which configures
mysql.c) doesn’t look for digits in the error constant names. Try this
patch and let us know what happens:
— extconf.rb.orig Sat Feb 22 20:20:50 2003
+++ extconf.rb Tue Jun 24 11:02:53 2003
@@ -44,7 +44,7 @@
next unless l =~ /errmsg.h|mysqld_error.h/
fn = l.split(/"/)[1]
IO::foreach(fn) do |m|
if m =~ /^#define\s+([CE]R_[A-Z_]+)/ then
if m =~ /^#define\s+([CE]R_[A-Z0-9_]+)/ then
error_syms << $1
end
end
If that works for you (it does for me), I’ll send the patch to Tomita.
···
At 17:39 +0900 6/24/03, David D’Andrea wrote:
hrmm…?
I believe I have the include & lib parameters to extconf.rb
correctly set… Running extconf.rb with no args, or as suggested
in DuBois’ tutorial also fail (they don’t find the mysql_query())
I’m not sure what to try at this point, I’ve taken a few stabs:
It doesn’t make a difference if I reinstall the DBI after this DBD install.
I’ve also tried stopping mysqld before installing the DBD, and
installing under bash, no difference.
I’ve even tried editing extconf.rb’s Makefile to fill in an empty
LIBPATH param…
any ideas? I hope I’m not missing something obvious again…
David
On Monday, June 23, 2003, at 02:55 PM, Brian Candler wrote:
You need to install the ruby-mysql package, as well as the ruby-dbi
package. (ruby-dbi is just a wrapper around ruby-dbi, which is in turn a
Ruby wrapper around the native C API)
Thank you for the patch. It seems to help, make now gets further but
fails on the link…
(What file is it looking for? Maybe I need to set some PATH variable??)
(extconf.rb and test.rb before & after make produce the same output as
above)
On Tuesday, June 24, 2003, at 12:04 PM, Paul DuBois wrote:
At 17:39 +0900 6/24/03, David D’Andrea wrote:
Appreciate the pointer, pretty ug primitive mistake there.
However I still can’t get this to work. I think the mysql DBD isn’t
getting installed properly.
[~/Desktop/mysql-ruby-2.4.4a]% ruby extconf.rb
–with-mysql-include=/usr/local/mysql/include
–with-mysql-lib=/usr/local/mysql/lib
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lm… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lz… yes
checking for mysql_query() in -lmysqlclient… yes
checking for mysql.h… yes
creating Makefile
% make
gcc -fno-common -g -O2 -fno-common -pipe -no-cpp-precomp -I.
-I/sw/lib/ruby/1.6/powerpc-darwin6.6 -I. -I/sw/include -DHAVE_MYSQL_H
-I/sw/include -I/usr/local/mysql/include -c -o mysql.o mysql.c
mysql.c: In function Init_mysql': mysql.c:1420: ER_SUBSELECT_NO_’ undeclared (first use in this
function)
mysql.c:1420: (Each undeclared identifier is reported only once
mysql.c:1420: for each function it appears in.)
make: *** [mysql.o] Error 1
% ruby -I. ./test.rb localhost root lovelypass
./test.rb:11:in `require’: No such file to load – ./mysql (LoadError)
from ./test.rb:11
‘%make install’ here fails too, and running simple.rb still returns
the same error (undefined method, DBI::InterfaceError)
Hmm, that’s weird. Looks like the configuration process (which
configures
mysql.c) doesn’t look for digits in the error constant names. Try this
patch and let us know what happens:
— extconf.rb.orig Sat Feb 22 20:20:50 2003
+++ extconf.rb Tue Jun 24 11:02:53 2003
@@ -44,7 +44,7 @@
next unless l =~ /errmsg.h|mysqld_error.h/
fn = l.split(/"/)[1]
IO::foreach(fn) do |m|
if m =~ /^#define\s+([CE]R_[A-Z_]+)/ then
if m =~ /^#define\s+([CE]R_[A-Z0-9_]+)/ then
error_syms << $1
end
end
If that works for you (it does for me), I’ll send the patch to Tomita.
Can’t help you there. I use the Ruby that comes with Mac OS X, not
one installed under /sw. Is that a Fink-installed version?
Here’s what I see on my machine:
% make
gcc -fno-common -g -Os -pipe -no-cpp-precomp -pipe -pipe
-no-precomp -I. -I/usr/lib/ruby/1.6/powerpc-darwin6.0 -I.
-I/usr/include -DHAVE_MYSQL_H -I’/usr/local/mysql/include/mysql’ -c
-o mysql.o mysql.c
gcc: unrecognized option `-no-precomp’
cc1: warning: changing search order for system directory “/usr/include”
cc1: warning: as it has already been specified as a non-system directory
cc -dynamic -bundle -undefined suppress -flat_namespace
-L/usr/lib/ruby/1.6/powerpc-darwin6.0 -L/usr/lib -o mysql.bundle
mysql.o -L’/usr/local/mysql/lib/mysql’ -lmysqlclient -lz -lm
-L/usr/local/ssl/lib -lssl -lcrypto
Mine’s not even looking for -lruby.
···
At 2:22 +0900 6/25/03, David D’Andrea wrote:
On Tuesday, June 24, 2003, at 12:04 PM, Paul DuBois wrote:
At 17:39 +0900 6/24/03, David D’Andrea wrote:
Appreciate the pointer, pretty ug primitive mistake there.
However I still can’t get this to work. I think the mysql DBD
isn’t getting installed properly.
[~/Desktop/mysql-ruby-2.4.4a]% ruby extconf.rb
–with-mysql-include=/usr/local/mysql/include
–with-mysql-lib=/usr/local/mysql/lib
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lm… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lz… yes
checking for mysql_query() in -lmysqlclient… yes
checking for mysql.h… yes
creating Makefile
% make
gcc -fno-common -g -O2 -fno-common -pipe -no-cpp-precomp -I.
-I/sw/lib/ruby/1.6/powerpc-darwin6.6 -I. -I/sw/include
-DHAVE_MYSQL_H -I/sw/include -I/usr/local/mysql/include -c -o
mysql.o mysql.c
mysql.c: In function Init_mysql': mysql.c:1420: ER_SUBSELECT_NO_’ undeclared (first use in this function)
mysql.c:1420: (Each undeclared identifier is reported only once
mysql.c:1420: for each function it appears in.)
make: *** [mysql.o] Error 1
% ruby -I. ./test.rb localhost root lovelypass
./test.rb:11:in `require’: No such file to load – ./mysql (LoadError)
from ./test.rb:11
‘%make install’ here fails too, and running simple.rb still
returns the same error (undefined method, DBI::InterfaceError)
Hmm, that’s weird. Looks like the configuration process (which configures
mysql.c) doesn’t look for digits in the error constant names. Try this
patch and let us know what happens:
— extconf.rb.orig Sat Feb 22 20:20:50 2003
+++ extconf.rb Tue Jun 24 11:02:53 2003
@@ -44,7 +44,7 @@
next unless l =~ /errmsg.h|mysqld_error.h/
fn = l.split(/"/)[1]
IO::foreach(fn) do |m|
if m =~ /^#define\s+([CE]R_[A-Z_]+)/ then
if m =~ /^#define\s+([CE]R_[A-Z0-9_]+)/ then
error_syms << $1
end
end
If that works for you (it does for me), I’ll send the patch to Tomita.
Thank you for the patch. It seems to help, make now gets further
but fails on the link…
(What file is it looking for? Maybe I need to set some PATH variable??)
(extconf.rb and test.rb before & after make produce the same output as above)