Issue #6391 has been updated by raylinn / gmail.com (ray linn).


Here is the update:

1. I renamed my folder local to local.old, so that any 3rd partt lib will not be linked.
2. Rolled back GCC from 4.7.0 to 4.6.2.
3. just use the following command to configure : ./configure --build=x86_64-w64-mingw32 CFLAGS="-Ox" x will be replaced as 2 or 3.

after took all these actions, I got the following result:

1. Ruby 1.9.3P0                      x=3 passed; x=2 failed
2. Ruby 1.9.3P194                    x=3 passed; x=2 failed
3. Snapshot {ruby 2.0.0)             x=3 passed; x=2 failed.
----------------------------------------
Bug #6391: Segment Fault while execute make_encmake.rb for Ruby 1.9.3 P194 ( MinGW64)
https://bugs.ruby-lang.org/issues/6391#change-26399

Author: raylinn / gmail.com (ray linn)
Status: Feedback
Priority: Normal
Assignee: luislavena (Luis Lavena)
Category: build
Target version: 
ruby -v: ruby 1.9.3p194 (2012-04-20) [x64-mingw32]


The Ruby is compiled by MinGW64 (GCC 4.7.0 ), configure script is :

./configure --build=x86_64-w64-mingw32 CFLAGS="-O2 -mieee-fp -I/usr/local/include" LDFLAGS="-L/usr/local/include"

when miniruby executing, error occurs with the following message:


        CC = gcc
        LD = ld
        LDSHARED = gcc -shared
        CFLAGS = -O2 -mieee-fp -I/usr/local/include
        XCFLAGS = -include ruby/config.h -include ruby/missing.h -fvisibility=hi
dden -DRUBY_EXPORT
        CPPFLAGS =   -I. -I.ext/include/x64-mingw32 -I./include -I.
        DLDFLAGS = -Wl,--enable-auto-image-base,--enable-auto-import -Wl,--out-i
mplib=libx64-msvcrt-ruby191.dll.a x64-msvcrt-ruby191.def
        SOLIBS = x64-msvcrt-ruby191.res.o -lshell32 -lws2_32 -limagehlp
generating enc.mk
C:/msys/1.0/home/beta/ruby-1.9.3-p194/lib/mkmf.rb:5: [BUG] Segmentation fault
ruby 1.9.3p194 (2012-04-20) [x64-mingw32]

-- Control frame information -----------------------------------------------
c:td p:---- s:td b:td l:td d:td CFUNC  :require
c:td p:td s:td b:td l:td d:td TOP    C:/msys/1.0/home/beta/ruby-1.9.3-p194/lib/m
kmf.rb:5
c:td p:---- s:td b:td l:td d:td FINISH
c:td p:---- s:td b:td l:td d:td CFUNC  :load
c:td p:td s:td b:td l:tx d:tx EVAL   ./enc/make_encmake.rb:8
c:td p:---- s:td b:td l:td d:td FINISH
c:td p:td s:td b:td l:tx d:tx TOP

-- Ruby level backtrace information ----------------------------------------
./enc/make_encmake.rb:8:in `<main>'
./enc/make_encmake.rb:8:in `load'
C:/msys/1.0/home/beta/ruby-1.9.3-p194/lib/mkmf.rb:5:in `<top (required)>'
C:/msys/1.0/home/beta/ruby-1.9.3-p194/lib/mkmf.rb:5:in `require'

-- C level backtrace information -------------------------------------------
C:\windows\SYSTEM32\ntdll.dll(NtWaitForSingleObject+0xa) [0x0000000076EE135A]
C:\windows\system32\KERNELBASE.dll(WaitForSingleObjectEx+0x9c) [0x000007FEFD5710
DC]
 [0x000000000051FA34]
 [0x000000000042EBD7]
 [0x000000000042F076]
 [0x00000000004C3BD4]
 [0x0000000000533F25]
C:\windows\SYSTEM32\ntdll.dll(_C_specific_handler+0x9c) [0x0000000076EA85A8]
C:\windows\SYSTEM32\ntdll.dll(RtlDecodePointer+0xbd) [0x0000000076EB9D0D]
C:\windows\SYSTEM32\ntdll.dll(RtlUnwindEx+0xbbf) [0x0000000076EA91AF]
C:\windows\SYSTEM32\ntdll.dll(KiUserExceptionDispatcher+0x2e) [0x0000000076EE127
8]
 [0x0000000000441810]
 [0x0000000000441713]
 [0x0000000000507685]
 [0x00000000004412FA]
 [0x0000000000441713]
 [0x0000000000507685]
 [0x00000000004412FA]
 [0x0000000000441713]
 [0x0000000000507685]
 [0x00000000004412FA]
 [0x000000000050D095]
 [0x00000000004412FA]
 [0x000000000050BB59]
 [0x00000000004CB35E]
 [0x000000000050BC3A]
 [0x00000000004412FA]
 [0x000000000044305D]
 [0x0000000000443AFF]
 [0x00000000004CE7D1]
 [0x00000000004D04AE]
 [0x0000000000477792]
 [0x0000000000486445]
 [0x000000000048E5F5]
 [0x0000000000521068]
 [0x0000000000525890]
 [0x000000000047BFB2]
 [0x00000000004C218B]
 [0x0000000000432D67]
 [0x00000000004C294B]
 [0x0000000000434556]
 [0x000000000043574C]
 [0x000000000051B50A]
 [0x0000000000510F7F]
 [0x0000000000515EA0]
 [0x000000000051DABC]
 [0x00000000004345C0]
 [0x00000000004346D1]
 [0x000000000051B50A]
 [0x0000000000510F7F]
 [0x0000000000515EA0]
 [0x000000000051DB88]
 [0x0000000000431AF7]
 [0x00000000004325AD]
 [0x0000000000433F50]
 [0x0000000000538627]
 [0x00000000004013C9]
 [0x00000000004014E8]
C:\windows\system32\kernel32.dll(BaseThreadInitThunk+0xd) [0x0000000076C2652D]

-- Other runtime information -----------------------------------------------

* Loaded script: ./enc/make_encmake.rb

* Loaded features:

    0 enumerator.so
    1 mkmf.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: *** [enc.mk] Error 3


-----------------------------------------------------------------------------------

Once changed the "-O2" to "-Ofast -fno-finite-math-only" , issue disappeared. 


-- 
http://bugs.ruby-lang.org/