Hi, I’m currently trying to compile FXRuby 1.0.17 with the latest version of
minGW/msys installed on Windows XP:
normsu[170]$ uname -sr
MINGW32_NT-5.1 1.0.8(0.46/3/2)
normsu[171]$ gcc -v
…
Thread model: win32
gcc version 3.2 (mingw special 20020817-1)
I’ve managed to compile fox-1.0.17 and ruby-1.6.8 (preview 4) without a hitch.
(I had to change some paths for ruby though-- for example /usr/local =>
c:/msys/1.0/local) However, once I got to compiling FXRuby, I had to get rid
of the -fno-strict-prototype flags being added in /ext/fox/extconf.rb because
gcc was complaining. After that, I get farther but run into the following error:
g++ -DIMPORT -DNT -D__NO_ISOCEXT -g -O2 -DWIN32 -Iinclude -I. -IC:/msys/1.0/local/
lib/ruby/1.6/i686-mingw32 -IC:/msys/1.0/home/normsu/FXRuby-1.0.17/ext/fox
-DHAVE_SYS_TIME_H -DHAVE_SIGNAL_H -IC:/msys/1.0/local/include/fox -I/usr/local/
include -c -o opengl_wrap.o opengl_wrap.cpp
opengl_wrap.cpp: In function VALUE FXGLViewer_readPixels(FXGLViewer*, int, int, int, int)': opengl_wrap.cpp:724:alloca’ undeclared (first use this function)
opengl_wrap.cpp:724: (Each undeclared identifier is reported only once for each
function it appears in.)
make: *** [opengl_wrap.o] Error 1
I scoured the mailing lists and I’ve seen some related errors with Solaris, but
apparently no solutions. I’ve tried fiddling with ruby.h’s
"if defined(HAVE_ALLOCA_H) etc." as described by Lyle in previous postings, but
the error persists. I also tried changing some of the intern.h definitions as
described in “list of things that can go wrong” section, but that doesn’t help
as well.
Any ideas? Am I supposed to use a different version of ruby? Am I doing
something incredibly stupid?
Any ideas? Am I supposed to use a different version of ruby? Am I doing
something incredibly stupid?
I doubt this has been fixed on the (CVS) trunk or it would have been
back-ported to the 1.6 branch. ISTR the other time we saw it was for the
Solaris build.
I was trying to do the Right Thing ™ by using Ruby’s ALLOCA_N() but
this kind of hassle (for you and other users) just isn’t worth it. I’ll
change those cases so that they use FXMALLOC (a wrapper around the
regular malloc) for next time. As a workaround, you should be able to
modify the code for FXGLViewer_readPixels() to look like this:
VALUE FXGLViewer_readPixels(FXGLViewer *self,FXint x,FXint y,FXint
w,FXint h){
FXuchar buffer;
VALUE pixels = Qnil;
if (self->readPixels(buffer, x, y, w, h)) {
FXint size = 3w*h;
pixels = rb_str_new((char *) buffer, size);
FXFREE(&buffer);
}
return pixels;
}
Looks like there are a few more of them in ui_wrap.cpp. If it’s not
clear how to hack those to use FXMALLOC() or just a regular malloc(),
let me know and I can post some patches for those functions as well.
Hope this helps,
Lyle
P.S. I’ll take out that ‘-fno-strict-prototype’ too. That was a way to
work around the broken Ruby header files, but since they’re fixed for
Ruby 1.6.8 this shouldn’t be needed anymore…
I have faced the same kind of problem today. You can add:
#define alloca(size) __builtin_alloca(size)
to opnegl_wrap.cpp and ui_wrap.cpp.
p.f.
tested on: mingw-2.0.0-3, msys-1.0.8, ruby-1.6.8-preview4, fox-1.0.28,
fxruby-1.0.17
Norman Su wrote:
···
Hi, I’m currently trying to compile FXRuby 1.0.17 with the latest version of
minGW/msys installed on Windows XP:
normsu[170]$ uname -sr
MINGW32_NT-5.1 1.0.8(0.46/3/2)
normsu[171]$ gcc -v
…
Thread model: win32
gcc version 3.2 (mingw special 20020817-1)
I’ve managed to compile fox-1.0.17 and ruby-1.6.8 (preview 4) without a hitch.
(I had to change some paths for ruby though-- for example /usr/local =>
c:/msys/1.0/local) However, once I got to compiling FXRuby, I had to get rid
of the -fno-strict-prototype flags being added in /ext/fox/extconf.rb because
gcc was complaining. After that, I get farther but run into the following error:
g++ -DIMPORT -DNT -D__NO_ISOCEXT -g -O2 -DWIN32 -Iinclude -I. -IC:/msys/1.0/local/
lib/ruby/1.6/i686-mingw32 -IC:/msys/1.0/home/normsu/FXRuby-1.0.17/ext/fox
-DHAVE_SYS_TIME_H -DHAVE_SIGNAL_H -IC:/msys/1.0/local/include/fox -I/usr/local/
include -c -o opengl_wrap.o opengl_wrap.cpp
opengl_wrap.cpp: In function VALUE FXGLViewer_readPixels(FXGLViewer*, int, int, int, int)': opengl_wrap.cpp:724: alloca’ undeclared (first use this function)
opengl_wrap.cpp:724: (Each undeclared identifier is reported only once for each
function it appears in.)
make: *** [opengl_wrap.o] Error 1
I scoured the mailing lists and I’ve seen some related errors with Solaris, but
apparently no solutions. I’ve tried fiddling with ruby.h’s
“if defined(HAVE_ALLOCA_H) etc.” as described by Lyle in previous postings, but
the error persists. I also tried changing some of the intern.h definitions as
described in “list of things that can go wrong” section, but that doesn’t help
as well.
Any ideas? Am I supposed to use a different version of ruby? Am I doing
something incredibly stupid?
I have faced the same kind of problem today. You can add:
#define alloca(size) __builtin_alloca(size)
to opnegl_wrap.cpp and ui_wrap.cpp.
This worked great! Thanks so much.
Just to let you guys know that, unfortunantely, taking out the
“-D__NO_ISOCEXT” did not solve the problem:
gcc -DIMPORT -DNT -g -O2 -fpermissive -DWIN32 -Iinclude -I. -IC:/msys/1.0/h
ome/normsu/local/lib/ruby/1.6/i686-mingw32 -IC:/msys/1.0/home/normsu/src/FXR
uby-1.0.17/ext/fox -DHAVE_SYS_TIME_H -DHAVE_SIGNAL_H -IC:/msys/1.0/home/no
rmsu/local/include/fox -I/usr/local/include -c -o librb.o librb.c
In file included from
C:/msys/1.0/home/normsu/local/lib/ruby/1.6/i686-mingw32/defines.h:36,
from
C:/msys/1.0/home/normsu/local/lib/ruby/1.6/i686-mingw32/ruby.h:22,
from librb.c:212:
C:/msys/1.0/home/normsu/local/lib/ruby/1.6/i686-mingw32/win32/win32.h:225:
parse error before “sizeof”
C:/msys/1.0/home/normsu/local/lib/ruby/1.6/i686-mingw32/win32/win32.h:226:
parse error before “sizeof”
make: *** [librb.o] Error 1
I did not try out Lyle’s suggestion, since the other one worked =) One more
question, are FXRuby versions ONLY compatible with their equivalent
versions? For example if I use FXRuby-1.0.17, does that mean I can ONLY use
it with Fox version 1.0.17, or is it ok to use newer versions like 1.0.28?
(so far 1.0.28 seems to work fine with FXRuby-1.0.17)
I did not try out Lyle’s suggestion, since the other one worked =)
A pragmatic choice
But I did go ahead and made those fixes for the next release, so that in
the future people won’t have to modify those compiler flags.
One more question, are FXRuby versions ONLY compatible with their equivalent
versions? For example if I use FXRuby-1.0.17, does that mean I can ONLY use
it with Fox version 1.0.17, or is it ok to use newer versions like 1.0.28?
(so far 1.0.28 seems to work fine with FXRuby-1.0.17)
Any FXRuby-1.0.x release should work with any fox-1.0.x release. So yes,
it is fine to use fox-1.0.28 and FXRuby-1.0.17 together.