Problem building mysql-ruby under 1.8.0

B

Brian Candler

$ pwd
/home/brian/work/mysql-ruby-2.4.4
$ ruby extconf.rb --with-mysql-dir=/usr/local/mysql
checking for mysql_query() in -lmysqlclient... yes
checking for mysql.h... yes
creating Makefile
extconf.rb:33: uninitialized constant CPP (NameError)

Line 33 says:

cpp = Config::expand sprintf(CPP, $CPPFLAGS, $CFLAGS, '')

It seems this was defined in ruby-1.6.8:
$ ruby16 -v -rmkmf -e 'p CPP'
ruby 1.6.8 (2002-12-24) [i386-freebsd4.7]
"gcc -E -E %s -I$(rubylibdir)/$(arch) -g -O2 %s %s conftest.c"

Anybody know what I should change this to?

Thanks,

Brian.
 
T

ts

B> cpp = Config::expand sprintf(CPP, $CPPFLAGS, $CFLAGS, '')

Can you try ?

Config::expand(cpp_command(""))


Guy Decoux
 
B

Brian Candler

B> cpp = Config::expand sprintf(CPP, $CPPFLAGS, $CFLAGS, '')

Can you try ?

Config::expand(cpp_command(""))

$ ruby -v -rmkmf -e 'p Config::expand(cpp_command(""))'
ruby 1.8.0 (2003-08-04) [i386-freebsd4.7]
"gcc -E -I/usr/local/lib/ruby/1.8/i386-freebsd4.7 -I/usr/local/lib/ruby/1.8/i386-freebsd4.7 -g -O2 conftest.c"

So now I have changed the following line in extconf.rb:

#cpp = Config::expand sprintf(CPP, $CPPFLAGS, $CFLAGS, '')
cpp = Config::expand(cpp_command(""))

And the next problem is that 'make' does nothing.

-bash-2.05b$ ruby extconf.rb --with-mysql-dir=/usr/local/mysql
checking for mysql_query() in -lmysqlclient... yes
checking for mysql.h... yes
creating Makefile
-bash-2.05b$ gmake
gmake: Nothing to be done for `all'.

The relevant section of Makefile:

...
all: Makefile

clean:
@$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
...

So indeed, there is nothing to do. Hmm!

Regards,

Brian.
 
B

Brian Candler

B> all: Makefile

Put

create_makefile("mysql")

at the end, i.e. after creation of mysql.c

No joy yet:

$ ruby extconf.rb --with-mysql-dir=/usr/local/mysql
checking for mysql_query() in -lmysqlclient... yes
checking for mysql.h... yes
creating Makefile
creating Makefile
/usr/local/lib/ruby/1.8/mkmf.rb:896:in `create_makefile': undefined method
`close' for nil:NilClass (NoMethodError)
from extconf.rb:63

Regards,

Brian.
 
B

Brian Candler

B> creating Makefile
B> creating Makefile

Try to remove the first create_makefile("mysql")

That was it. Thank you!

For anyone else who needs it, here's a summary of what I needed to do (note:
not tested under 1.6.8, so additional changes may be needed for mysql-ruby
to compile on both platforms)

Regards,

Brian.

--- mysql-ruby-2.4.4.orig/extconf.rb Tue Jan 28 23:59:59 2003
+++ mysql-ruby-2.4.4/extconf.rb Mon Aug 4 16:00:26 2003
@@ -24,13 +24,12 @@
else
exit 1
end
-create_makefile("mysql")

# make mysql constant
File::eek:pen("conftest.c", "w") do |f|
f.puts src
end
-cpp = Config::expand sprintf(CPP, $CPPFLAGS, $CFLAGS, '')
+cpp = Config::expand(cpp_command(""))
unless system "#{cpp} > confout" then
exit 1
end
@@ -58,3 +57,6 @@
end
end
end
+
+create_makefile("mysql")
+
 
O

Ollivier Robert

[courtesy cc of this posting sent to cited author via email]

cpp = Config::expand sprintf(CPP, $CPPFLAGS, $CFLAGS, '')

The following, taken from the FreeBSD port works:

--- extconf.rb.orig Wed Jan 29 08:59:59 2003
+++ extconf.rb Wed Jan 29 19:02:41 2003
@@ -24,13 +24,18 @@
else
exit 1
end
+$objs = ["mysql.o"]
create_makefile("mysql")

# make mysql constant
File::eek:pen("conftest.c", "w") do |f|
f.puts src
end
-cpp = Config::expand sprintf(CPP, $CPPFLAGS, $CFLAGS, '')
+if defined? cpp_command
+ cpp = Config.expand(cpp_command(CONFIG['CPPOUTFILE']))
+else
+ cpp = Config::expand sprintf(CPP, $CPPFLAGS, $CFLAGS, '')
+end
unless system "#{cpp} > confout" then
exit 1
end
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top