Dick Davies wrote:
I dont have the mysql.h header file on my system - perhaps installed
through rpm? No developer pack. No header files.
You need those.
Took me awhile but i figured that out. It is not exactly clear from any
of the docs from anywhere i could find. My inexperience with linux has
been a real detriment to my health the last month.
Not your fault, it’s RedHats. Having the headers in a separate RPM
is a bloody stupid idea.
I certainly can agree.
[root@u15154846 include]# locate mysql.h
/usr/local/lib/mysql-standard-4.0.20-pc-linux-i686/include/mysql.h
I have not installed mysql 4 above yet and when i point
–with-mysql-include to that dir it still fails.
It looks like there’s bits of an install left behind in usr/local.
Here is the view from ssh.
[root@u15154846 mysql-ruby-2.4.5]# ruby extconf.rb
–with-mysql-include=/usr/local/lib/mysql-standard-4.0.20-pc-linux-i686/include
–with-mysql-lib=/usr/local/lib
checking for mysql_query() in -lmysqlclient… yes
checking for mysql.h… yes
creating Makefile
[root@u15154846 mysql-ruby-2.4.5]# make && make install
gcc -fPIC -g -O2 -I. -I/usr/local/lib/ruby/1.8/i686-linux
-I/usr/local/lib/ruby/1.8/i686-linux -I. -DHAVE_MYSQL_H
-I/usr/local/lib/mysql-standard-4.0.20-pc-linux-i686/include
-I/usr/local/include -c mysql.c
gcc -shared -L"/usr/local/lib" -L"/usr/local/lib" -o mysql.so mysql.o
-lmysqlclient -ldl -lcrypt -lm -lc
install -c -p -m 0755 mysql.so /usr/local/lib/ruby/site_ruby/1.8/i686-linux
[root@u15154846 mysql-ruby-2.4.5]# ruby -I. ./test.rb localhost admin @ou812
connect…ok
create_db…ok
create_table…ok
insert…ok
select…ok
update…ok
drop_table…ok
drop_db…ok
close…ok
All seems ok.
here is dbi.
[root@u15154846 ruby-dbi-all]# ruby setup.rb config
–with=dbi,dbd_mysql,dbd_pg
entering config phase…
config done.
[root@u15154846 ruby-dbi-all]# ruby setup.rb setup
entering setup phase…
setting #! line to “#!/usr/local/bin/ruby”
setup.rb: skip bin/proxyserver(dbd_proxy) by user option
setup.rb: skip ext/dbd_sqlite(dbd_sqlite) by user option
setup.rb: skip ext/dbd_sybase(dbd_sybase) by user option
setup done.
[root@u15154846 ruby-dbi-all]# ruby setup.rb install
entering install phase…
mkdir -p /usr/local/bin
install sqlsh.rb /usr/local/bin
setup.rb: skip bin/proxyserver(dbd_proxy) by user option
setup.rb: skip lib/dbd_ado(dbd_ado) by user option
setup.rb: skip lib/dbd_db2(dbd_db2) by user option
setup.rb: skip lib/dbd_frontbase(dbd_frontbase) by user option
setup.rb: skip lib/dbd_interbase(dbd_interbase) by user option
setup.rb: skip lib/dbd_msql(dbd_msql) by user option
mkdir -p /usr/local/lib/ruby/site_ruby/1.8/DBD/Mysql
install Mysql.rb /usr/local/lib/ruby/site_ruby/1.8/DBD/Mysql
setup.rb: skip lib/dbd_odbc(dbd_odbc) by user option
setup.rb: skip lib/dbd_oracle(dbd_oracle) by user option
mkdir -p /usr/local/lib/ruby/site_ruby/1.8/DBD/Pg
install Pg.rb /usr/local/lib/ruby/site_ruby/1.8/DBD/Pg
setup.rb: skip lib/dbd_proxy(dbd_proxy) by user option
setup.rb: skip lib/dbd_sqlrelay(dbd_sqlrelay) by user option
mkdir -p /usr/local/lib/ruby/site_ruby/1.8/dbi
install columninfo.rb /usr/local/lib/ruby/site_ruby/1.8/dbi
install dbi.rb /usr/local/lib/ruby/site_ruby/1.8/dbi
install row.rb /usr/local/lib/ruby/site_ruby/1.8/dbi
install sql.rb /usr/local/lib/ruby/site_ruby/1.8/dbi
install trace.rb /usr/local/lib/ruby/site_ruby/1.8/dbi
install utils.rb /usr/local/lib/ruby/site_ruby/1.8/dbi
install version.rb /usr/local/lib/ruby/site_ruby/1.8/dbi
mkdir -p /usr/local/lib/ruby/site_ruby/1.8/.
install dbi.rb /usr/local/lib/ruby/site_ruby/1.8/.
setup.rb: skip ext/dbd_sqlite(dbd_sqlite) by user option
setup.rb: skip ext/dbd_sybase(dbd_sybase) by user option
install done.
In lieu of grabbing the dev packages i installed 4.0 - headers and all.
Then ran through dbi, mysql-ruby(pointing to new headers) - pointing
mysql-ruby to
the headers installed. Life was good. Untill i tried running selects.
Where all goes south - exhibiting the same symptoms as my current host.
I’m using apache 2 here - was 1.3 - so it aint apache. I’m 90% sure it
has some library incompatibility in mysql 4.0.
It being ruby? To be honest I only threw in the DBI stuff and
checked it could connect and read tables/databases, so maybe.
I could move back to 3.23, but then, i’d just be back where i was.
No that shouldn’t matter, from the output below I thought you
wanted 3.23.
ruby 1.81
redhat
mysql-ruby 2.4.5
mysql 3.23
Ultimately, i want 4.0+ but tried 3.23 just to simplify before moving to
4.0. That is when the headers were found missing for 3.23.
I don’t think that’s true so much anymore, I think you’ve just had
trouble because the build of mysql you have is screwed.
Have you tried just building from source? I know this is seen as
‘l33t’ by a lot of new users, but to be honest it’s usually the
safest way to get a working system. Beats the usual ‘this rpm was
compiled for somelib version bla, go get that’ nonsense.
This has been my experience. I compiled mysql from src.(that is implied
with the config,make,make install ?? forgive my ignorance)
The rpm detected dependancies with the previous installation - even
after first running the ‘shared’ version of the rpm.
Here are some tests i’m running to conclusively narrow down where things
are going wrong.
this work
require "mysql"
m = Mysql.new('localhost', 'admin', '@ou812')
m.list_dbs.each do |db|
puts db
end
#this works
require ‘dbi’
c = DBI::connect(‘dbi:Mysql:dev’,‘admin’,‘@ou812’)
c.do(‘insert into categories(name) values(?)’,‘value’)
#this does not
require “mysql”
m = Mysql.new(‘localhost’, ‘admin’, ‘@ou812’,‘dev’)
res = m.query("select * from categories")
#dies on next line
fields = res.fetch_fields.filter do |f| f.name end
puts fields.join(“\t”)
res.each do |row|
puts row.join("\t")
end
#neither does this
require ‘dbi’
c = DBI::connect('dbi:Mysql:dev','admin','xxxxx')
c.do('insert into categories(name) values(?)','value')
p 'before'
#dies
r = c.select_all('select * from categories')
#done get nothing from here out. nothing. not even headers. fails
silently and painfully
p ‘after’
p r.size
Has something to do with hashes in mysql-ruby, as far as i can tell.
Thanks for any help.
:paul