Problem building mysql-ruby under 1.8.0

Discussion in 'Ruby' started by Brian Candler, Aug 4, 2003.

  1. $ 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.
    Brian Candler, Aug 4, 2003
    #1
    1. Advertising

  2. Brian Candler

    ts Guest

    >>>>> "B" == Brian Candler <> writes:

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

    Can you try ?

    Config::expand(cpp_command(""))


    Guy Decoux
    ts, Aug 4, 2003
    #2
    1. Advertising

  3. On Mon, Aug 04, 2003 at 10:59:05PM +0900, ts wrote:
    > >>>>> "B" == Brian Candler <> writes:

    >
    > 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.
    Brian Candler, Aug 4, 2003
    #3
  4. On Mon, Aug 04, 2003 at 11:22:26PM +0900, ts wrote:
    > >>>>> "B" == Brian Candler <> writes:

    >
    > 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.
    Brian Candler, Aug 4, 2003
    #4
  5. On Mon, Aug 04, 2003 at 11:45:39PM +0900, ts wrote:
    > >>>>> "B" == Brian Candler <> writes:

    >
    > 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")
    +
    Brian Candler, Aug 4, 2003
    #5
  6. [courtesy cc of this posting sent to cited author via email]

    In article <>,
    Brian Candler <> wrote:
    > 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


    --
    Ollivier ROBERT -=- Eurocontrol EEC/ITM -=-
    Usenet Canal Historique FreeBSD: The Power to Serve!
    Ollivier Robert, Aug 4, 2003
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    6,172
  2. Luke Kenneth Casson Leighton
    Replies:
    0
    Views:
    355
    Luke Kenneth Casson Leighton
    Jan 15, 2009
  3. Randy Lawrence

    mysql-ruby or ruby-mysql?

    Randy Lawrence, May 23, 2004, in forum: Ruby
    Replies:
    3
    Views:
    99
    Randy Lawrence
    May 24, 2004
  4. Dido Sevilla
    Replies:
    0
    Views:
    95
    Dido Sevilla
    Mar 4, 2005
  5. Mark Meijer

    mySQL Ruby Gem and MAMP mySQL

    Mark Meijer, Feb 2, 2008, in forum: Ruby
    Replies:
    3
    Views:
    160
    louis
    Feb 3, 2008
Loading...

Share This Page