FXRuby-1.0.11 install make failed

Hi:

I just installed fox-1.0.11 via ports on FreeBSD and
all worked will. I then downloaded FXRuby-1.0.11 from
sourceforge and installed but it soon failed with
the error listed below:

c++ -fPIC -O -pipe -fPIC -O0 -Iinclude -I. -I/usr/local/lib/ruby/1.6/i386-freebsd4 -I/usr/home/jfreeze/installs/bsd/ruby/FXRuby-1.0.11/ext/fox -DHAVE_SYS_TIME_H -DHAVE_SIGNAL_H -I/usr/local/include -I/usr/local/include/fox -c -o FXRuby.o FXRuby.cpp
FXRuby.cpp: In function void FXRbGcMark(void *)': FXRuby.cpp:186: passingvoid *’ to argument 1 of `rb_gc_mark(long unsigned int)’ lacks a cast
*** Error code 1

Stop in /usr/home/jfreeze/installs/bsd/ruby/FXRuby-1.0.11/ext/fox.
setup failed
’system make’ failed
try ‘ruby install.rb --help’ for usage

Can someone tell me why this failed.

Thanks

Jim
PS The full set of events are listed below.

-> ruby install.rb config
install.rb: entering config phase…
—> lib
—> lib/fox
<— lib/fox
<— lib
—> ext
—> ext/fox
/usr/local/bin/ruby /usr/home/jfreeze/installs/bsd/ruby/FXRuby-1.0.11/ext/fox/extconf.rb
checking for sys/time.h… yes
checking for signal.h… yes
checking for png_create_read_struct() in -lpng… yes
checking for deflate() in -lz… yes
checking for jpeg_mem_init() in -ljpeg… yes
checking for TIFFSetErrorHandler() in -ltiff… yes
checking for XShmQueryVersion() in -lXext… yes
checking for XFindContext() in -lX11… yes
checking for glXCreateContext() in -lGL… no
checking for gluNewQuadric() in -lGLU… no
creating Makefile
—> ext/fox/include
<— ext/fox/include
<— ext/fox
<— ext
install.rb: config done.
jfreeze@rabbit (‘tty’) ~/installs/bsd/ruby/FXRuby-1.0.11 38 -> ruby install.rb setup
install.rb: entering setup phase…
—> lib
—> lib/fox
<— lib/fox
<— lib
—> ext
—> ext/fox
make
cc -fPIC -O -pipe -fPIC -O0 -Iinclude -I. -I/usr/local/lib/ruby/1.6/i386-freebsd4 -I/usr/home/jfreeze/installs/bsd/ruby/FXRuby-1.0.11/ext/fox -DHAVE_SYS_TIME_H -DHAVE_SIGNAL_H -I/usr/local/include -I/usr/local/include/fox -c -o librb.o librb.c
c++ -fPIC -O -pipe -fPIC -O0 -Iinclude -I. -I/usr/local/lib/ruby/1.6/i386-freebsd4 -I/usr/home/jfreeze/installs/bsd/ruby/FXRuby-1.0.11/ext/fox -DHAVE_SYS_TIME_H -DHAVE_SIGNAL_H -I/usr/local/include -I/usr/local/include/fox -c -o core_wrap.o core_wrap.cpp
c++ -fPIC -O -pipe -fPIC -O0 -Iinclude -I. -I/usr/local/lib/ruby/1.6/i386-freebsd4 -I/usr/home/jfreeze/installs/bsd/ruby/FXRuby-1.0.11/ext/fox -DHAVE_SYS_TIME_H -DHAVE_SIGNAL_H -I/usr/local/include -I/usr/local/include/fox -c -o dialogs_wrap.o dialogs_wrap.cpp
c++ -fPIC -O -pipe -fPIC -O0 -Iinclude -I. -I/usr/local/lib/ruby/1.6/i386-freebsd4 -I/usr/home/jfreeze/installs/bsd/ruby/FXRuby-1.0.11/ext/fox -DHAVE_SYS_TIME_H -DHAVE_SIGNAL_H -I/usr/local/include -I/usr/local/include/fox -c -o FXRbApp.o FXRbApp.cpp
c++ -fPIC -O -pipe -fPIC -O0 -Iinclude -I. -I/usr/local/lib/ruby/1.6/i386-freebsd4 -I/usr/home/jfreeze/installs/bsd/ruby/FXRuby-1.0.11/ext/fox -DHAVE_SYS_TIME_H -DHAVE_SIGNAL_H -I/usr/local/include -I/usr/local/include/fox -c -o FXRbDataTarget.o FXRbDataTarget.cpp
c++ -fPIC -O -pipe -fPIC -O0 -Iinclude -I. -I/usr/local/lib/ruby/1.6/i386-freebsd4 -I/usr/home/jfreeze/installs/bsd/ruby/FXRuby-1.0.11/ext/fox -DHAVE_SYS_TIME_H -DHAVE_SIGNAL_H -I/usr/local/include -I/usr/local/include/fox -c -o FXRuby.o FXRuby.cpp
FXRuby.cpp: In function void FXRbGcMark(void *)': FXRuby.cpp:186: passingvoid *’ to argument 1 of `rb_gc_mark(long unsigned int)’ lacks a cast
*** Error code 1

Stop in /usr/home/jfreeze/installs/bsd/ruby/FXRuby-1.0.11/ext/fox.
setup failed
’system make’ failed
try ‘ruby install.rb --help’ for usage

···


Jim Freeze
If only I had something clever to say for my comment…

Jim Freeze wrote:

Hi:

I just installed fox-1.0.11 via ports on FreeBSD and
all worked will. I then downloaded FXRuby-1.0.11 from
sourceforge and installed but it soon failed with
the error listed below:

c++ -fPIC -O -pipe -fPIC -O0 -Iinclude -I.
-I/usr/local/lib/ruby/1.6/i386-freebsd4
-I/usr/home/jfreeze/installs/bsd/ruby/FXRuby-1.0.11/ext/fox
-DHAVE_SYS_TIME_H -DHAVE_SIGNAL_H -I/usr/local/include
-I/usr/local/include/fox -c -o FXRuby.o FXRuby.cpp
FXRuby.cpp: In function void FXRbGcMark(void *)': FXRuby.cpp:186: passing void *’ to argument 1 of
`rb_gc_mark(long unsigned int)’ lacks a cast
*** Error code 1

Stop in /usr/home/jfreeze/installs/bsd/ruby/FXRuby-1.0.11/ext/fox.
setup failed
‘system make’ failed
try ‘ruby install.rb --help’ for usage

Can someone tell me why this failed.

Thanks

The problem is in the Ruby header files. The FXRuby build instructions (I
believe that is in chapter 2 of the FXRUby users guide) discuss things that
can go wrong with the FXRuby build and what to do about it. Your problem is
mentioned their, along with the solution.

Regards,
Curt

Hmmm, maybe you can explain. I did not change the ruby header files
but changed two fxruby files:

FXRuby.h
----From—
id FXRbGcMark(void obj){
if(obj){
VALUE value=FXRbGetRubyObj(obj); // only search FXRuby_ObjMap!
if(value!=Qnil){
#if RUBY_VERSION_CODE < 172
rb_gc_mark(reinterpret_cast<void
>(value));
#else
rb_gc_mark(value);
#endif
}
}
}
----To—
id FXRbGcMark(void *obj){
if(obj){
VALUE value=FXRbGetRubyObj(obj); // only search FXRuby_ObjMap!
if(value!=Qnil){
#if RUBY_VERSION_CODE < 172
rb_gc_mark(value);
#else
rb_gc_mark(value);
#endif
}
}
}

···

On Mon, Jul 22, 2002 at 07:30:35PM +0900, Curt Hibbs wrote:

Jim Freeze wrote:

The problem is in the Ruby header files. The FXRuby build instructions (I
believe that is in chapter 2 of the FXRUby users guide) discuss things that
can go wrong with the FXRuby build and what to do about it. Your problem is
mentioned their, along with the solution.


I am using 1.6.7. Maybe I should have changed ’ < 172’ to ’ < 167’?

markfuncs.cpp
----From—
#if RUBY_VERSION_CODE < 172
#define MARK(p) rb_gc_mark(reinterpret_cast<void *>((p)))
#else
#define MARK(p) rb_gc_mark(reinterpret_cast((p)))
#endif
----To-----
#if RUBY_VERSION_CODE < 172
#define MARK(p) rb_gc_mark(reinterpret_cast((p)))
#else
#define MARK(p) rb_gc_mark(reinterpret_cast((p)))
#endif

Again, I could have changed the test from 172 to 167.

My question is, why are these tests for 172 and not against
167?

Thanks

Jim Freeze
If only I had something clever to say for my comment…
~

“Jim Freeze” jfreeze@freebsdportal.com wrote in message
news:20020722072231.A45239@freebsdportal.com

Hmmm, maybe you can explain. I did not change the ruby header files
but changed two fxruby files:

Good grief, I thought that this was covered in adequate detail in the build
instructions. OK, you asked for it, you got it.

In the source code for Ruby 1.6.7, we have two conflicting declarations for
the function rb_gc_mark(). If you look at its declaration in the “intern.h”
header file, you’ll see it declared as:

void rb_gc_mark();

which is to say, rb_gc_mark() is a void function that takes no arguments.
But if you look at the implementation of rb_gc_mark() in “gc.c”, you’ll see
that it in fact takes one argument of type “void *”:

void
rb_gc_mark(ptr)
    void *ptr;
{
    ...
}

Now, for Ruby 1.7.2 Matz decided to correct this inconsistency, and so if
you inspect the declaration of rb_gc_mark() in the Ruby 1.7.2 version of
“intern.h” you’ll instead see:

void rb_gc_mark(VALUE);

If you’re thinking to yourself, “Whoa Nelly, he changed the type of that
argument, didn’t he?”, well, you’re right. So it goes. At least it’s
consistent, because the implementation of rb_gc_mark() changed as well to
read:

void
rb_gc_mark(ptr)
    VALUE ptr;
{
    ...
}

So, the moral of the story is that if you’re building FXRuby against the
Ruby 1.6 sources – or more specifically, for any Ruby earlier than version
1.7.2 – you need to fix the declaration of rb_gc_mark() in “intern.h” to
read:

void rb_gc_mark(void *);

You do NOT need to modify the FXRuby sources at all. The bits in the FXRuby
source code that are checking the Ruby version (i.e. “#if RUBY_VERSION_CODE
< 172”) are making sure that we call rb_gc_mark() with the correct argument
type: a pointer-to-void for pre-Ruby 1.7.2 and a VALUE for later versions of
Ruby.

Hi,

···

At Tue, 23 Jul 2002 05:25:16 +0900, Lyle Johnson wrote:

Now, for Ruby 1.7.2 Matz decided to correct this inconsistency, and so if
you inspect the declaration of rb_gc_mark() in the Ruby 1.7.2 version of
“intern.h” you’ll instead see:

intern.h in recent 1.6 branch also has those prototypes.


Nobu Nakada

OK, this is good to hear. I was just considering the (released) Ruby
1.6.7 sources.

···

nobu.nokada@softhome.net wrote:

Hi,

At Tue, 23 Jul 2002 05:25:16 +0900, > Lyle Johnson wrote:

Now, for Ruby 1.7.2 Matz decided to correct this inconsistency, and so if
you inspect the declaration of rb_gc_mark() in the Ruby 1.7.2 version of
“intern.h” you’ll instead see:

intern.h in recent 1.6 branch also has those prototypes.