Hello Nobu,
Everytime i’ve tried to build ruby with “-O3 -mcpu=i586 -march=k6 -ffast-math -fomit-frame-pointer” with gcc-2.95.2, gcc-2.95.3, gcc-3.01, and gcc-3.1, miniruby has crashed during the building of the default extensions. All I have to do to make it work is take out the “-fomit-frame-pointer”. This has happened on windoze with mingw32 and cygwin, mandrake 6.2, 7.2, and 8.2, vector linux 2.0 (a slackware based mini-distro), and gentoo-linux 1.2. I have set the compiler flags via the $CFLAGS environment variable.
Also yesterday I started having crashes with the C++ bindings for ruby I’m working on, and after a full-day of debugging I tracked it down to having the frame-pointer ommitted by the “maximise speed” optimisation of my MSVC project. As soon as I turned it on (i.e. started generating frame-pointers) everything worked perfectly. Eventually I did this via the “pragma optimise” command in a header, so that anything that includes it gets the frame-pointer generated.
The crashes only began happening after I started wrapping all ruby calls and macros with rb_protect(). Note that I am embedding ruby in a c++ prog, and so cannot allow ruby exceptions to be thrown over c++ code because the stack will not be unwound correctly. I translate the ruby exceptions to c++ exceptions.
I also notice that the msvc makefile for ruby has a fairly carefully selected set of compiler flags that leaves frame-pointer generation turned on.
That said, I have compiled serveral extensions (such as ruby-fltk, fxruby, and some of my own) with frame-pointer generation off, and they have worked perfectly too.
Perhaps yourself or Matz could shed some light on this?
···
On Thu, 12 Sep 2002 14:32:17 +0900 nobu.nokada@softhome.net wrote:
Hi,
At Thu, 12 Sep 2002 08:50:04 +0900, > Lorien Dunn wrote:
I bet you have compiled with stack-frame-pointer ommision
turned on. This is done with -fomit-frame-pointer in gcc, and
is the default with MSVC when you choose the “Maximise Speed”
optimisation. Frame-pointer ommision does not work with ruby
exceptions or threads.I usually use gcc with that option, rather it may be concerned
with platform and compiler version.–
Nobu Nakada