Mod_ruby 1.0.1 install problems

Hi.

I sent this to the mod_ruby ML, but this one is much more active, so I
thought I’d give it a try.

First I was having trouble with configure.rb, which kept saying:

./configure.rb:286: uninitialized constant CFLAGS (NameError)

I tried exporting the CFLAGS variable, but it wasn’t working, so I just
added the following code to the top of configure.rb:

CFLAGS = ‘’ if !defined? CFLAGS

That seemed to work.

Then I tried ‘make’. It complained:

···

gcc -fPIC -Wall -O2 -march=i386 -mcpu=i686 -I. -I/usr/local/lib/ruby/1.7/i68
6-linux -I/usr/include/httpd -DUSE_ERUBY=1 -c mod_ruby.c
mod_ruby.c:514: conflicting types for ruby_cleanup' /usr/local/lib/ruby/1.7/i686-linux/intern.h:178: previous declaration ofruby_cleanup’
make: *** [mod_ruby.o] Error 1

I’m running RedHat 8, and ‘gcc -v’ gives me:

gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)

and ‘ruby -v’:

ruby 1.7.3 (2002-11-25) [i686-linux]

Is there a quick fix I could make to the source to get this to compile?

Many thanks for any help,

Chris

Chris, I had the same problem too. It turns out that both mod_ruby 1.0.1 and
eruby0.9.8 are INCOMPATIBLE with ruby 1.7.x.

So, what I did is re-install ruby 1.6.7, mod_ruby1.0.1, and eruby0.9.8.

All the compilation, and installation went fine EXCEPT

  • IT NEVER WORKS THRU USING Apache 2.0.43.

I made sure that all the shared library object directory are in
/etc/ld.so.conf, ran ‘ldconfig’, configure apache’s httpd.conf , and
restart the Apache Server.

  1. It never recognize <% … %>. Anything inside is never printed.
  2. *.rhtm(eruby) and *.rbx(mod_ruby) are not recognize either. It’s only
    display the content of those files.
  3. I’m just about to give up!

HELP!

[mod_ruby problems]

I had similar problems with mod_ruby, apache-1.3 and Ruby 1.7.3 on a
redhat-7.3 box. The attached fix made it compile for me. Perhaps you’re
lucky, too.

fix.patch (1.83 KB)

···

On Wed, 2002-12-04 at 05:26, Chris Pine wrote:

Apparently mod_ruby has a function “ruby_cleanup” which conflicts with
ruby 1.7.3 (has another function with the same name).

A simple fix would be to just rename all occurences of ruby_cleanup in
mod_ruby.c to another name, say “mod_ruby_cleanup”, this would be in
lines 513 and 643 of mod_ruby.c.

“Chris Pine” nemo@hellotree.com wrote in message news:085f01c29b4d$562bbfd0$6401a8c0@MELONBALLER
<mod_ruby compile problems>

···

I’m running RedHat 8, and ‘gcc -v’ gives me:

gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)

and ‘ruby -v’:

ruby 1.7.3 (2002-11-25) [i686-linux]

Is there a quick fix I could make to the source to get this to compile?

Many thanks for any help,

Chris

Getting closer!

I was getting an error that apache/ruby-run wasn’t loading. Fine, I just
put in the full path:

RubyRequire /usr/local/lib/ruby/1.7/apache/ruby-run

But now when it loads I get the following error:

[Wed Dec 04 12:49:12 2002] [error] mod_ruby: error in ruby
/usr/local/lib/ruby/1.7/apache/ruby-run.rb:43:in require': No such file to load -- singleton (LoadError) from /usr/local/lib/ruby/1.7/apache/ruby-run.rb:43 from ruby:0:inrequire’
from ruby:0

So it looks like the loadpath is screwed up, I think. Anyone know how I
ought to fix this, so that RubyRequire knows where to look for things?

Thanks,

Chris

Hello,

···

----- Original Message -----
From: “Useko Netsumi” usenets@nyc.rr.com

Chris, I had the same problem too. It turns out that both mod_ruby 1.0.1 and
eruby0.9.8 are INCOMPATIBLE with ruby 1.7.x.

eRuby took a bit of messing with, but with the help of the mod_ruby mailing
list, I got it working just fine with 1.7.3. Not that I care… it’s
mod_ruby that I want. I never use eRuby.

Chris

Chris, would you mind posting your working httpd.conf ? Also, may be a test
*.rbx file to display “Hello Ruby” on the browser. Thanks

/Useko

Could please cut-n-paste(text only) the fix? I can’t accept the attachement.
Thanks.

Apparently mod_ruby has a function “ruby_cleanup” which conflicts with
ruby 1.7.3 (has another function with the same name).

A simple fix would be to just rename all occurences of ruby_cleanup in
mod_ruby.c to another name, say “mod_ruby_cleanup”, this would be in
lines 513 and 643 of mod_ruby.c.

···

----- Original Message -----
From: “Squidster” squidster@techie.com


Great! So, to sum up, here are the things I did:

  1. In the configure.rb files for both eruby and mod_ruby, I added the
    following at the top:

CFLAGS = ‘’ if !defined? CFLAGS

  1. In mod_ruby.c, I changed lines 513 and 643 to call the function
    ’mod_ruby_cleanup’ instead of ‘ruby_cleanup’.

  2. After successfully configuring eruby and mod_ruby, I tried to ‘make’
    them. Both failed. Whatever the last, failed gcc command was, I typed it
    into the commandline, except I added ‘-lruby’ to both of them, and I added
    ’-L’ immediately preceding the path.

  3. I then installed them, which went fine, and I tested eruby, which is
    fine. I still need to get apache configured for mod_ruby, but I’ll tell you
    how that goes!

Hope this helps others,

Chris

Hi,

···

At Wed, 4 Dec 2002 18:40:10 +0900, Florian Frank wrote:

I had similar problems with mod_ruby, apache-1.3 and Ruby 1.7.3 on a
redhat-7.3 box. The attached fix made it compile for me. Perhaps you’re
lucky, too.

I haven’t consider about programs which doesn’t use extconf.rb
like mod_ruby.

Index: configure.rb

RCS file: /cvs/ruby/src/mod_ruby/configure.rb,v
retrieving revision 1.20
diff -u -2 -p -r1.20 configure.rb
— configure.rb 5 Nov 2002 05:12:15 -0000 1.20
+++ configure.rb 4 Dec 2002 17:14:25 -0000
@@ -4,4 +4,5 @@

require “mkmf”
+require “ftools”

$ac_help = “”
@@ -75,4 +76,5 @@ def AC_OUTPUT(*files)
print "creating ", file, “\n”
open(File.join($srcdir, file + “.in”)) do |fin|

  •  File.makedirs(File.dirname(file))
     open(file, "w") do |fout|
    
    while line = fin.gets
    @@ -294,5 +296,7 @@ $LD = “$(CC)”
    $RANLIB = CONFIG[“RANLIB”]

-if CFLAGS.index(CONFIG[“CCDLFLAGS”])
+if !defined?(CFLAGS)

  • $CFLAGS = CONFIG[“CFLAGS”]
    +elsif CFLAGS.index(CONFIG[“CCDLFLAGS”])
    $CFLAGS = CFLAGS
    else
    Index: configure.in
    ===================================================================
    RCS file: /cvs/ruby/src/ruby/configure.in,v
    retrieving revision 1.154
    diff -u -2 -p -r1.154 configure.in
    — configure.in 2 Dec 2002 07:57:15 -0000 1.154
    +++ configure.in 4 Dec 2002 16:39:26 -0000
    @@ -987,5 +987,5 @@ LIBRUBY_A=‘lib$(RUBY_SO_NAME)-static.a’
    LIBRUBY=‘$(LIBRUBY_A)’
    LIBRUBYARG_STATIC=‘-l$(RUBY_SO_NAME)-static’
    -LIBRUBYARG=‘$(LIBRUBYARG_STATIC)’
    +LIBRUBYARG=“$LIBRUBYARG_STATIC”
    SOLIBS=

@@ -1012,5 +1012,5 @@ if test “$enable_shared” = ‘yes’; then
LIBRUBY=‘$(LIBRUBY_SO)’
LIBRUBYARG_SHARED=‘-l$(RUBY_SO_NAME)’

  • LIBRUBYARG=‘$(LIBRUBYARG_SHARED)’
  • LIBRUBYARG=“$LIBRUBYARG_SHARED”
    CFLAGS=“$CFLAGS $CCDLFLAGS”
    ENABLE_SHARED=yes


Nobu Nakada

No, when I say I got eruby working, but not mod_ruby, I mean just eruby.

In other words, if I have a file called hello.txt which looks like:

hello <% print ‘hi’ %> bye

then I can type in ‘eruby hello.txt’ at my bash prompt and it spits out

hello hi bye

When I said “eruby works” that’s all I meant. I haven’t even looked at my
httpd.conf file yet.

Chris

···

----- Original Message -----
From: “Useko Netsumi” usenets@nyc.rr.com
Newsgroups: comp.lang.ruby
Sent: Tuesday, December 03, 2002 9:39 PM
Subject: Re: mod_ruby 1.0.1 install problems

Chris, would you mind posting your working httpd.conf ? Also, may be a test
*.rbx file to display “Hello Ruby” on the browser. Thanks

/Useko

I still need to get apache configured for mod_ruby, but I’ll tell you how
that goes!

···

----- Original Message -----

Well, it isn’t working. This is from my error_log:

[Wed Dec 04 09:34:18 2002] [error] mod_ruby: error in ruby
(eval): uninitialized constant RubyRun at Apache (NameError)
from ruby:0:in `value’
from ruby:0

So, that’s the state of things. I got mod_ruby and eruby to configure,
compile, and install, but I can’t get Apache to use mod_ruby. Is this just
an Apache 2 problem, or is it something else? Has anyone gotten mod_ruby to
work with Apache 2?

Chris

Thanks nobu, it finally works.

Have you ever successfully implemented the mod_ruby and apache 2.0.43
combination and tested thru a web browser? Thanks

If you do and it works, would u post the httpd.conf and the test file so I
can put it on my configuration. I’ve been struggling to get mod_ruby to work
with a browser. Thanks again.

Chris, thanks for the instruction. It compiles correctly. I even tested with
a few scripts and thru command line.

Next is to get it to work with Apache 2.0.43 and web browser. See if you get
the expected result. I’ve been struggling to get this Apache, mod_ruby, and
eruby combination to work.

Thanks again.

Have you ever execute those file thru a web browser(Netscape or IE)?

Hi,

···

At Thu, 5 Dec 2002 04:11:05 +0900, Useko Netsumi wrote:

Have you ever successfully implemented the mod_ruby and apache 2.0.43
combination and tested thru a web browser? Thanks

If you do and it works, would u post the httpd.conf and the test file so I
can put it on my configuration. I’ve been struggling to get mod_ruby to work
with a browser. Thanks again.

No, I haven’t compiled mod_ruby yet. I’m using ruby 1.7 with
Oniguruma RE engine, but mod_ruby couldn’t compiled with it.

And I still use apache 1.3.26.


Nobu Nakada