Hello,

I'm glad to here the solution of this problem.
Thanks to all the people that tackled it.

There is only one proposal from me.
In mswin, /Oy- is always specified.
So, in mingw, We should specify -fno-omit-frame-pointer, I think.
# Of course, if this option does not exist depending on a compiler
# version, we should check it in configure script.

Nobu and Luis, how do you think?


In message "[ruby-core:40204] [Ruby 1.9 - Bug #5407] Cannot build ruby-1.9.3-rc1 with TDM-GCC 4.6.1 on Windows XP SP3"
    on Oct.18,2011 20:11:41, <h.shirosaki / gmail.com> wrote:
> 
> Issue #5407 has been updated by Hiroshi Shirosaki.
> 
> 
> I have same issues as above.
> trunk@33473 and 1.9.3dev build fails on Windows XP SP3 with gcc version 4.6.1 (tdm-1).
> 
> And build with -fno-omit-frame-pointer flag works fine.
> 
> 
> This document explains about setjmp and Frame-Pointer Omission.
> http://msdn.microsoft.com/en-us/library/2kxx5t2c.aspx
> 
> I tried to write a patch of this issue.
> 
> diff --git a/configure.in b/configure.in
> index fff3a07..1ca63b3 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -44,6 +44,12 @@ target_os="`echo ${target_os} | sed 's/msvc$//'`"
>  AS_CASE(["$target_cpu-$target_os"], [x86_64-mingw*], [
>  target_cpu=x64
>  ])
> +AS_CASE(["$target_os"], [mingw*], [
> +kernel_name=`uname -s`
> +gcc_version=`$CC --version | head -n1`
> +AS_CASE(["$kernel_name-$gcc_version"],
> +  [*NT-5.1-*" 4.6."*], [optflags="-O3 -fno-omit-frame-pointer"])
> +])
>  ])
> 
>  AC_DEFUN([RUBY_CPPOUTFILE],
> 
> ----------------------------------------
> Bug #5407: Cannot build ruby-1.9.3-rc1 with TDM-GCC 4.6.1 on Windows XP SP3
> http://redmine.ruby-lang.org/issues/5407
> 
> Author: Heesob Park
> Status: Open
> Priority: Normal
> Assignee: 
> Category: 
> Target version: 
> ruby -v: -
> 
> 
> I guess this bug is related with Bug #5375(http://redmine.ruby-lang.org/issues/5375).
> 
> 
> First, it fails when configuring tk.
> 
> $ make
>         CC = gcc
>         LD = ld
>         LDSHARED = gcc -shared -s
>         CFLAGS = -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long
> -long -Wno-missing-field-initializers -Werror=pointer-arith -Werror=write-string
> s -Werror=declaration-after-statement -Werror=implicit-function-declaration
>         XCFLAGS = -include ruby/config.h -include ruby/missing.h -fvisibility=hi
> dden -DRUBY_EXPORT
>         CPPFLAGS =   -I. -I.ext/include/i386-mingw32 -I./include -I.
>         DLDFLAGS = -Wl,--enable-auto-image-base,--enable-auto-import -Wl,--out-i
> mplib=libmsvcrt-ruby191.dll.a msvcrt-ruby191.def
>         SOLIBS = msvcrt-ruby191.res.o -lshell32 -lws2_32 -limagehlp
> generating enc.mk
> generating encdb.h
> encdb.h unchanged
> making enc
> make[1]: Entering directory `/c/work/ruby-1.9.3-rc1'
> make[1]: Nothing to be done for `enc'.
> make[1]: Leaving directory `/c/work/ruby-1.9.3-rc1'
> making srcs under enc
> make[1]: Entering directory `/c/work/ruby-1.9.3-rc1'
> make[1]: Nothing to be done for `srcs'.
> make[1]: Leaving directory `/c/work/ruby-1.9.3-rc1'
> generating transdb.h
> transdb.h unchanged
> making trans
> make[1]: Entering directory `/c/work/ruby-1.9.3-rc1'
> make[1]: Nothing to be done for `./enc/trans'.
> make[1]: Leaving directory `/c/work/ruby-1.9.3-rc1'
> making encs
> make[1]: Entering directory `/c/work/ruby-1.9.3-rc1'
> make[1]: Leaving directory `/c/work/ruby-1.9.3-rc1'
> configuring tk
> c:/work/ruby-1.9.3-rc1/lib/mkmf.rb:1398: [BUG] Segmentation fault
> ruby 1.9.3dev (2011-09-23) [i386-mingw32]
> 
> -- Control frame information -----------------------------------------------
> c:0016 p:---- s:0129 b:0129 l:000128 d:000128 CFUNC  :fetch
> c:0015 p:0081 s:0125 b:0125 l:000124 d:000124 METHOD c:/work/ruby-1.9.3-rc1/lib/
> mkmf.rb:1398
> c:0014 p:0036 s:0118 b:0118 l:002678 d:002678 METHOD c:/work/ruby-1.9.3-rc1/lib/
> mkmf.rb:1417
> c:0013 p:0014 s:0112 b:0112 l:000102 d:000111 BLOCK  c:/work/ruby-1.9.3-rc1/ext/
> tk/extconf.rb:64
> c:0012 p:---- s:0108 b:0108 l:000107 d:000107 FINISH
> c:0011 p:---- s:0106 b:0106 l:000105 d:000105 CFUNC  :each_key
> c:0010 p:0339 s:0103 b:0103 l:000102 d:000102 TOP    c:/work/ruby-1.9.3-rc1/ext/
> tk/extconf.rb:63
> c:0009 p:---- s:0073 b:0073 l:000072 d:000072 FINISH
> c:0008 p:---- s:0071 b:0071 l:000070 d:000070 CFUNC  :load
> c:0007 p:0759 s:0067 b:0067 l:000066 d:000066 METHOD ./ext/extmk.rb:174
> c:0006 p:0046 s:0045 b:0045 l:0000dc d:000044 BLOCK  ./ext/extmk.rb:468
> c:0005 p:---- s:0042 b:0042 l:000041 d:000041 FINISH
> c:0004 p:---- s:0040 b:0040 l:000039 d:000039 CFUNC  :each
> c:0003 p:1285 s:0037 b:0037 l:0000dc d:001728 EVAL   ./ext/extmk.rb:464
> c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
> c:0001 p:0000 s:0002 b:0002 l:0000dc d:0000dc TOP
> 
> -- Ruby level backtrace information ----------------------------------------
> ./ext/extmk.rb:464:in `<main>'
> ./ext/extmk.rb:464:in `each'
> ./ext/extmk.rb:468:in `block in <main>'
> ./ext/extmk.rb:174:in `extmake'
> ./ext/extmk.rb:174:in `load'
> c:/work/ruby-1.9.3-rc1/ext/tk/extconf.rb:63:in `<top (required)>'
> c:/work/ruby-1.9.3-rc1/ext/tk/extconf.rb:63:in `each_key'
> c:/work/ruby-1.9.3-rc1/ext/tk/extconf.rb:64:in `block in <top (required)>'
> c:/work/ruby-1.9.3-rc1/lib/mkmf.rb:1417:in `with_config'
> c:/work/ruby-1.9.3-rc1/lib/mkmf.rb:1398:in `arg_config'
> c:/work/ruby-1.9.3-rc1/lib/mkmf.rb:1398:in `fetch'
> 
> -- C level backtrace information -------------------------------------------
> F:\WINDOWS\system32\ntdll.dll(KiFastSystemCallRet+0x0) [0x7c93e514]
> F:\WINDOWS\system32\kernel32.dll(WaitForSingleObject+0x12) [0x7c7d2542]
> 
> -- Other runtime information -----------------------------------------------
> 
> * Loaded script: ./ext/extmk.rb
> 
> * Loaded features:
> 
>     0 enumerator.so
>     1 c:/work/ruby-1.9.3-rc1/rbconfig.rb
>     2 mkmf.rb
>     3 c:/work/ruby-1.9.3-rc1/lib/fileutils.rb
>     4 c:/work/ruby-1.9.3-rc1/lib/shellwords.rb
>     5 c:/work/ruby-1.9.3-rc1/lib/optparse.rb
>     6 c:/work/ruby-1.9.3-rc1/lib/optparse/shellwords.rb
> 
> [NOTE]
> You may have encountered a bug in the Ruby interpreter or extension libraries.
> Bug reports are welcome.
> For details: http://www.ruby-lang.org/bugreport.html
> 
> 
> This application has requested the Runtime to terminate it in an unusual way.
> Please contact the application's support team for more information.
> make: *** [exts.mk] Error 3
> 
> ================================================================================
> 
> Second, if I skip tk by removing tk, it fails when making rdoc.
> 
> Generating RDoc documentation
> Parsing sources...
>   0% [ 1/767]  addr2line.c
>   0% [ 2/767]  array.c
>   0% [ 3/767]  bignum.c
>   0% [ 4/767]  class.c
>   0% [ 5/767]  compar.c
>   0% [ 6/767]  compile.c
>   0% [ 7/767]  complex.c
>   1% [ 8/767]  cont.c
>   1% [ 9/767]  debug.c
>   1% [10/767]  dir.c
>   1% [11/767]  dln.c
>   1% [12/767]  dln_find.c
>   1% [13/767]  dmydln.c
>   1% [14/767]  dmyencoding.c
>   1% [15/767]  dmyext.c
>   2% [16/767]  dmyversion.c
>   2% [17/767]  encoding.c
>   2% [18/767]  enum.c
>   2% [19/767]  enumerator.c
>   2% [20/767]  error.c
> c:/work/ruby-1.9.3-rc1/lib/rdoc/parser/c.rb:846: [BUG] Segmentation fault
> ruby 1.9.3dev (2011-09-23) [i386-mingw32]
> 
> -- Control frame information -----------------------------------------------
> c:0016 p:---- s:0078 b:0078 l:000077 d:000077 CFUNC  :Integer
> c:0015 p:0172 s:0074 b:0074 l:000073 d:000073 METHOD c:/work/ruby-1.9.3-rc1/lib/
> rdoc/parser/c.rb:846
> c:0014 p:0075 s:0057 b:0057 l:000042 d:000056 BLOCK  c:/work/ruby-1.9.3-rc1/lib/
> rdoc/parser/c.rb:345
> c:0013 p:---- s:0049 b:0049 l:000048 d:000048 FINISH
> c:0012 p:---- s:0047 b:0047 l:000046 d:000046 CFUNC  :scan
> c:0011 p:0015 s:0043 b:0043 l:000042 d:000042 METHOD c:/work/ruby-1.9.3-rc1/lib/
> rdoc/parser/c.rb:326
> c:0010 p:0041 s:0040 b:0040 l:000039 d:000039 METHOD c:/work/ruby-1.9.3-rc1/lib/
> rdoc/parser/c.rb:1039
> c:0009 p:0164 s:0037 b:0037 l:000036 d:000036 METHOD c:/work/ruby-1.9.3-rc1/lib/
> rdoc/rdoc.rb:334
> c:0008 p:0020 s:0028 b:0028 l:000019 d:000027 BLOCK  c:/work/ruby-1.9.3-rc1/lib/
> rdoc/rdoc.rb:379
> c:0007 p:---- s:0025 b:0025 l:000024 d:000024 FINISH
> c:0006 p:---- s:0023 b:0023 l:000022 d:000022 CFUNC  :map
> c:0005 p:0095 s:0020 b:0020 l:000019 d:000019 METHOD c:/work/ruby-1.9.3-rc1/lib/
> rdoc/rdoc.rb:377
> c:0004 p:0222 s:0014 b:0014 l:000013 d:000013 METHOD c:/work/ruby-1.9.3-rc1/lib/
> rdoc/rdoc.rb:434
> c:0003 p:0067 s:0008 b:0008 l:000e8c d:002094 EVAL   ./bin/rdoc:20
> c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
> c:0001 p:0000 s:0002 b:0002 l:000e8c d:000e8c TOP
> 
> -- Ruby level backtrace information ----------------------------------------
> ./bin/rdoc:20:in `<main>'
> c:/work/ruby-1.9.3-rc1/lib/rdoc/rdoc.rb:434:in `document'
> c:/work/ruby-1.9.3-rc1/lib/rdoc/rdoc.rb:377:in `parse_files'
> c:/work/ruby-1.9.3-rc1/lib/rdoc/rdoc.rb:377:in `map'
> c:/work/ruby-1.9.3-rc1/lib/rdoc/rdoc.rb:379:in `block in parse_files'
> c:/work/ruby-1.9.3-rc1/lib/rdoc/rdoc.rb:334:in `parse_file'
> c:/work/ruby-1.9.3-rc1/lib/rdoc/parser/c.rb:1039:in `scan'
> c:/work/ruby-1.9.3-rc1/lib/rdoc/parser/c.rb:326:in `do_methods'
> c:/work/ruby-1.9.3-rc1/lib/rdoc/parser/c.rb:326:in `scan'
> c:/work/ruby-1.9.3-rc1/lib/rdoc/parser/c.rb:345:in `block in do_methods'
> c:/work/ruby-1.9.3-rc1/lib/rdoc/parser/c.rb:846:in `handle_method'
> c:/work/ruby-1.9.3-rc1/lib/rdoc/parser/c.rb:846:in `Integer'
> 
> -- C level backtrace information -------------------------------------------
> F:\WINDOWS\system32\ntdll.dll(KiFastSystemCallRet+0x0) [0x7c93e514]
> F:\WINDOWS\system32\kernel32.dll(WaitForSingleObject+0x12) [0x7c7d2542]
> 
> -- Other runtime information -----------------------------------------------
> 
> * Loaded script: ./bin/rdoc
> 
> * Loaded features:
> 
>     0 enumerator.so
>     1 c:/work/ruby-1.9.3-rc1/.ext/i386-mingw32/enc/encdb.so
>     2 c:/work/ruby-1.9.3-rc1/.ext/i386-mingw32/enc/cp949.so
>     3 c:/work/ruby-1.9.3-rc1/.ext/i386-mingw32/enc/trans/transdb.so
>     4 c:/work/ruby-1.9.3-rc1/lib/rdoc.rb
>     5 c:/work/ruby-1.9.3-rc1/lib/rdoc/encoding.rb
>     6 c:/work/ruby-1.9.3-rc1/.ext/i386-mingw32/strscan.so
>     7 c:/work/ruby-1.9.3-rc1/lib/rdoc/text.rb
>     8 c:/work/ruby-1.9.3-rc1/lib/rdoc/code_object.rb
>     9 c:/work/ruby-1.9.3-rc1/lib/rdoc/context.rb
>    10 c:/work/ruby-1.9.3-rc1/lib/rdoc/top_level.rb
>    11 c:/work/ruby-1.9.3-rc1/lib/rdoc/class_module.rb
>    12 c:/work/ruby-1.9.3-rc1/lib/rdoc/normal_class.rb
>    13 c:/work/ruby-1.9.3-rc1/lib/rdoc/normal_module.rb
>    14 c:/work/ruby-1.9.3-rc1/lib/rdoc/anon_class.rb
>    15 c:/work/ruby-1.9.3-rc1/lib/rdoc/single_class.rb
>    16 c:/work/ruby-1.9.3-rc1/lib/rdoc/method_attr.rb
>    17 c:/work/ruby-1.9.3-rc1/lib/rdoc/token_stream.rb
>    18 c:/work/ruby-1.9.3-rc1/lib/rdoc/any_method.rb
>    19 c:/work/ruby-1.9.3-rc1/lib/rdoc/alias.rb
>    20 c:/work/ruby-1.9.3-rc1/lib/rdoc/ghost_method.rb
>    21 c:/work/ruby-1.9.3-rc1/lib/rdoc/meta_method.rb
>    22 c:/work/ruby-1.9.3-rc1/lib/rdoc/attr.rb
>    23 c:/work/ruby-1.9.3-rc1/lib/rdoc/constant.rb
>    24 c:/work/ruby-1.9.3-rc1/lib/rdoc/require.rb
>    25 c:/work/ruby-1.9.3-rc1/lib/rdoc/include.rb
>    26 c:/work/ruby-1.9.3-rc1/lib/rdoc/code_objects.rb
>    27 c:/work/ruby-1.9.3-rc1/lib/rdoc/markup/blank_line.rb
>    28 c:/work/ruby-1.9.3-rc1/lib/rdoc/markup/document.rb
>    29 c:/work/ruby-1.9.3-rc1/lib/rdoc/markup/heading.rb
>    30 c:/work/ruby-1.9.3-rc1/lib/rdoc/markup/list.rb
>    31 c:/work/ruby-1.9.3-rc1/lib/rdoc/markup/list_item.rb
>    32 c:/work/ruby-1.9.3-rc1/lib/rdoc/markup/raw.rb
>    33 c:/work/ruby-1.9.3-rc1/lib/rdoc/markup/paragraph.rb
>    34 c:/work/ruby-1.9.3-rc1/lib/rdoc/markup/indented_paragraph.rb
>    35 c:/work/ruby-1.9.3-rc1/lib/rdoc/markup/rule.rb
>    36 c:/work/ruby-1.9.3-rc1/lib/rdoc/markup/verbatim.rb
>    37 c:/work/ruby-1.9.3-rc1/lib/rdoc/markup/parser.rb
>    38 c:/work/ruby-1.9.3-rc1/lib/rdoc/markup/attribute_manager.rb
>    39 c:/work/ruby-1.9.3-rc1/lib/rdoc/markup/inline.rb
>    40 c:/work/ruby-1.9.3-rc1/lib/rdoc/markup.rb
>    41 c:/work/ruby-1.9.3-rc1/lib/rdoc/markup/pre_process.rb
>    42 c:/work/ruby-1.9.3-rc1/lib/rdoc/stats.rb
>    43 c:/work/ruby-1.9.3-rc1/lib/rdoc/parser/simple.rb
>    44 c:/work/ruby-1.9.3-rc1/lib/rdoc/parser.rb
>    45 c:/work/ruby-1.9.3-rc1/lib/rdoc/ruby_token.rb
>    46 c:/work/ruby-1.9.3-rc1/lib/e2mmap.rb
>    47 c:/work/ruby-1.9.3-rc1/lib/irb/output-method.rb
>    48 c:/work/ruby-1.9.3-rc1/lib/irb/notifier.rb
>    49 c:/work/ruby-1.9.3-rc1/lib/irb/slex.rb
>    50 c:/work/ruby-1.9.3-rc1/.ext/i386-mingw32/stringio.so
>    51 c:/work/ruby-1.9.3-rc1/lib/rdoc/ruby_lex.rb
>    52 c:/work/ruby-1.9.3-rc1/lib/rdoc/parser/ruby_tools.rb
>    53 c:/work/ruby-1.9.3-rc1/lib/rdoc/parser/ruby.rb
>    54 c:/work/ruby-1.9.3-rc1/lib/rdoc/known_classes.rb
>    55 c:/work/ruby-1.9.3-rc1/lib/rdoc/parser/c.rb
>    56 c:/work/ruby-1.9.3-rc1/lib/optparse.rb
>    57 c:/work/ruby-1.9.3-rc1/.ext/i386-mingw32/etc.so
>    58 c:/work/ruby-1.9.3-rc1/lib/fileutils.rb
>    59 c:/work/ruby-1.9.3-rc1/lib/rdoc/ri/store.rb
>    60 c:/work/ruby-1.9.3-rc1/lib/rdoc/ri.rb
>    61 c:/work/ruby-1.9.3-rc1/rbconfig.rb
>    62 c:/work/ruby-1.9.3-rc1/lib/rdoc/ri/paths.rb
>    63 c:/work/ruby-1.9.3-rc1/lib/rdoc/options.rb
>    64 c:/work/ruby-1.9.3-rc1/lib/find.rb
>    65 c:/work/ruby-1.9.3-rc1/.ext/i386-mingw32/date_core.so
>    66 c:/work/ruby-1.9.3-rc1/.ext/common/date/format.rb
>    67 c:/work/ruby-1.9.3-rc1/.ext/common/date.rb
>    68 c:/work/ruby-1.9.3-rc1/lib/time.rb
>    69 c:/work/ruby-1.9.3-rc1/lib/rubygems/defaults.rb
>    70 c:/work/ruby-1.9.3-rc1/lib/rubygems/deprecate.rb
>    71 c:/work/ruby-1.9.3-rc1/lib/rubygems/exceptions.rb
>    72 c:/work/ruby-1.9.3-rc1/lib/rubygems/custom_require.rb
>    73 c:/work/ruby-1.9.3-rc1/lib/rubygems.rb
>    74 c:/work/ruby-1.9.3-rc1/lib/rubygems/version.rb
>    75 c:/work/ruby-1.9.3-rc1/lib/rubygems/requirement.rb
>    76 c:/work/ruby-1.9.3-rc1/lib/rubygems/platform.rb
>    77 c:/work/ruby-1.9.3-rc1/lib/rubygems/specification.rb
>    78 c:/work/ruby-1.9.3-rc1/lib/rubygems/path_support.rb
>    79 c:/work/ruby-1.9.3-rc1/.ext/i386-mingw32/pathname.so
>    80 c:/work/ruby-1.9.3-rc1/.ext/common/pathname.rb
>    81 c:/work/ruby-1.9.3-rc1/lib/erb.rb
>    82 c:/work/ruby-1.9.3-rc1/lib/rdoc/erbio.rb
>    83 c:/work/ruby-1.9.3-rc1/lib/rdoc/generator.rb
>    84 c:/work/ruby-1.9.3-rc1/lib/rdoc/markup/formatter.rb
>    85 c:/work/ruby-1.9.3-rc1/lib/cgi/core.rb
>    86 c:/work/ruby-1.9.3-rc1/lib/cgi/cookie.rb
>    87 c:/work/ruby-1.9.3-rc1/lib/cgi/util.rb
>    88 c:/work/ruby-1.9.3-rc1/lib/cgi.rb
>    89 c:/work/ruby-1.9.3-rc1/lib/rdoc/markup/to_html.rb
>    90 c:/work/ruby-1.9.3-rc1/lib/rdoc/cross_reference.rb
>    91 c:/work/ruby-1.9.3-rc1/lib/rdoc/markup/to_html_crossref.rb
>    92 c:/work/ruby-1.9.3-rc1/lib/rdoc/generator/markup.rb
>    93 c:/work/ruby-1.9.3-rc1/lib/rdoc/generator/darkfish.rb
>    94 c:/work/ruby-1.9.3-rc1/lib/rdoc/generator/ri.rb
>    95 c:/work/ruby-1.9.3-rc1/lib/rdoc/rdoc.rb
>    96 c:/work/ruby-1.9.3-rc1/lib/rdoc/stats/quiet.rb
>    97 c:/work/ruby-1.9.3-rc1/lib/rdoc/stats/normal.rb
>    98 c:/work/ruby-1.9.3-rc1/.ext/i386-mingw32/enc/utf_16le.so
>    99 c:/work/ruby-1.9.3-rc1/.ext/i386-mingw32/enc/trans/single_byte.so
>   100 c:/work/ruby-1.9.3-rc1/.ext/i386-mingw32/enc/trans/utf_16_32.so
> 
> [NOTE]
> You may have encountered a bug in the Ruby interpreter or extension libraries.
> Bug reports are welcome.
> For details: http://www.ruby-lang.org/bugreport.html
> 
> 
> This application has requested the Runtime to terminate it in an unusual way.
> Please contact the application's support team for more information.
> make: *** [rdoc] Error 3
> 
> 
> 
> 
> -- 
> http://redmine.ruby-lang.org


Regards,
-- 
U.Nakamura <usa / garbagecollect.jp>