连接miniruby时的分段错误

时间:2011-12-16 05:12:43

标签: ruby

我尝试在Mac OSX Lion(10.7.2)上安装Ruby 2.0.0dev(2011-12-15 trunk 34025)。

但我在链接 miniruby 时遇到了'Segmentation Fault'。

我尝试过的顺序如下:

$ autoconf
$ ./configure --prefix=$HOME/tmp/ruby --enable-shared
(snip)
$ make
(snip)
compiling dmyext.c
linking miniruby
<internal:prelude>:1: [BUG] Segmentation fault
ruby 2.0.0dev (2011-12-15 trunk 34025) [x86_64-darwin11.2.0]

-- Control frame information -----------------------------------------------
c:0003 p:0002 s:0006 b:0006 l:000005 d:000005 TOP    <internal:prelude>:1
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001248 d:001248 TOP   

-- Ruby level backtrace information ----------------------------------------
<internal:prelude>:1:in `<compiled>'

-- C level backtrace information -------------------------------------------

   See Crash Report log file under ~/Library/Logs/CrashReporter or
   /Library/Logs/CrashReporter, for the more detail of.

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

* Loaded script: ./miniruby

* Loaded features:

    0 enumerator.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

make: *** [.rbconfig.time] Abort trap: 6

我有这样的CrashReport:

Process:         miniruby [3571]
Path:            /Users/USER/*/miniruby
Identifier:      miniruby
Version:         ??? (???)
Code Type:       X86-64 (Native)
Parent Process:  gnumake [1617]

Date/Time:       2011-12-16 13:47:24.753 +0900
OS Version:      Mac OS X 10.7.2 (11C74)
Report Version:  9
Sleep/Wake UUID: 0A0C0C42-7935-495E-AE81-F7C6C21A4599

Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Exception Type:  EXC_BAD_ACCESS (SIGABRT)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000841f0f

VM Regions Near 0x841f0f:
--> 
    __TEXT                 000000010dd7e000-000000010df64000 [ 1944K] r-x/rwx SM=COW  /Users/USER/*

Application Specific Information:
objc[3571]: garbage collection is OFF
abort() called

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib          0x00007fff94d22ce2 __pthread_kill + 10
1   libsystem_c.dylib               0x00007fff95c8a7d2 pthread_kill + 95
2   libsystem_c.dylib               0x00007fff95c7ba7a abort + 143
3   miniruby                        0x000000010ddae079 rb_bug + 185
4   miniruby                        0x000000010de5cc8c sigsegv + 76 (signal.c:592)
5   libsystem_c.dylib               0x00007fff95cdccfa _sigtramp + 26
6   miniruby                        0x000000010deb4ef0 vm_exec_core + 2976 (vm_insnhelper.c:1144)
7   miniruby                        0x000000010dec04be vm_exec + 94 (vm.c:1218)
8   miniruby                        0x000000010dec03f1 rb_iseq_eval + 401 (vm.c:1444)
9   miniruby                        0x000000010de581d8 ruby_process_options + 1432 (ruby.c:1098)
10  miniruby                        0x000000010ddb24f0 ruby_options + 128 (eval.c:73)
11  miniruby                        0x000000010dd7eac7 main + 71 (main.c:38)
12  miniruby                        0x000000010dd7ea74 start + 52

Thread 1:
0   libsystem_kernel.dylib          0x00007fff94d22df2 __select + 10
1   miniruby                        0x000000010decfd9c thread_timer + 380 (thread_pthread.c:1164)
2   libsystem_c.dylib               0x00007fff95c888bf _pthread_start + 335
3   libsystem_c.dylib               0x00007fff95c8bb75 thread_start + 13

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000000  rbx: 0x0000000000000006  rcx: 0x00007fa48309c338  rdx: 0x0000000000000000
  rdi: 0x0000000000000303  rsi: 0x0000000000000006  rbp: 0x00007fa48309c360  rsp: 0x00007fa48309c338
   r8: 0x00007fff7b01afb8   r9: 0x00007fa48309c1e8  r10: 0x00007fff94d22d0a  r11: 0xffffff80002d8220
  r12: 0x000000010e200028  r13: 0x00007fa482c0d2d0  r14: 0x00007fff7b01d960  r15: 0x000000010e2fff50
  rip: 0x00007fff94d22ce2  rfl: 0x0000000000000246  cr2: 0x000000010dec6b80
Logical CPU: 0

Binary Images:
       0x10dd7e000 -        0x10df63ff7 +miniruby (??? - ???) <584607C5-64CE-3DB6-B848-3E915D864EF4> /Users/USER/*/miniruby
    0x7fff6d97e000 -     0x7fff6d9b2ac7  dyld (195.5 - ???) <4A6E2B28-C7A2-3528-ADB7-4076B9836041> /usr/lib/dyld
    0x7fff8aa13000 -     0x7fff8aa18ff7  libsystem_network.dylib (??? - ???) <5DE7024E-1D2D-34A2-80F4-08326331A75B> /usr/lib/system/libsystem_network.dylib
    0x7fff8aa81000 -     0x7fff8aa86fff  libcompiler_rt.dylib (6.0.0 - compatibility 1.0.0) <98ECD5F6-E85C-32A5-98CD-8911230CB66A> /usr/lib/system/libcompiler_rt.dylib
    0x7fff8b8f3000 -     0x7fff8b92eff7  libsystem_info.dylib (??? - ???) <9C8C2DCB-96DB-3471-9DCE-ADCC26BE2DD4> /usr/lib/system/libsystem_info.dylib
    0x7fff8be12000 -     0x7fff8be54ff7  libcommonCrypto.dylib (55010.0.0 - compatibility 1.0.0) <A5B9778E-11C3-3F61-B740-1F2114E967FB> /usr/lib/system/libcommonCrypto.dylib
    0x7fff8c00b000 -     0x7fff8c015ff7  liblaunch.dylib (392.18.0 - compatibility 1.0.0) <39EF04F2-7F0C-3435-B785-BF283727FFBD> /usr/lib/system/liblaunch.dylib
    0x7fff8c1b8000 -     0x7fff8c1c3ff7  libc++abi.dylib (14.0.0 - compatibility 1.0.0) <8FF3D766-D678-36F6-84AC-423C878E6D14> /usr/lib/libc++abi.dylib
    0x7fff8c9cb000 -     0x7fff8c9ccff7  libremovefile.dylib (21.0.0 - compatibility 1.0.0) <C6C49FB7-1892-32E4-86B5-25AD165131AA> /usr/lib/system/libremovefile.dylib
    0x7fff8ddc0000 -     0x7fff8ddc4fff  libmathCommon.A.dylib (2026.0.0 - compatibility 1.0.0) <FF83AFF7-42B2-306E-90AF-D539C51A4542> /usr/lib/system/libmathCommon.A.dylib
    0x7fff8e164000 -     0x7fff8e164fff  libkeymgr.dylib (23.0.0 - compatibility 1.0.0) <61EFED6A-A407-301E-B454-CD18314F0075> /usr/lib/system/libkeymgr.dylib
    0x7fff90298000 -     0x7fff902a0fff  libsystem_dnssd.dylib (??? - ???) <7749128E-D0C5-3832-861C-BC9913F774FA> /usr/lib/system/libsystem_dnssd.dylib
    0x7fff90865000 -     0x7fff90869fff  libdyld.dylib (195.5.0 - compatibility 1.0.0) <F1903B7A-D3FF-3390-909A-B24E09BAD1A5> /usr/lib/system/libdyld.dylib
    0x7fff9086a000 -     0x7fff9086bfff  libunc.dylib (24.0.0 - compatibility 1.0.0) <C67B3B14-866C-314F-87FF-8025BEC2CAAC> /usr/lib/system/libunc.dylib
    0x7fff90eb1000 -     0x7fff90f95def  libobjc.A.dylib (228.0.0 - compatibility 1.0.0) <C5F2392D-B481-3A9D-91BE-3D039FFF4DEC> /usr/lib/libobjc.A.dylib
    0x7fff91a7b000 -     0x7fff91af0ff7  libc++.1.dylib (19.0.0 - compatibility 1.0.0) <C0EFFF1B-0FEB-3F99-BE54-506B35B555A9> /usr/lib/libc++.1.dylib
    0x7fff91e72000 -     0x7fff91e9ffe7  libSystem.B.dylib (159.1.0 - compatibility 1.0.0) <095FDD3C-3961-3865-A59B-A5B0A4B8B923> /usr/lib/libSystem.B.dylib
    0x7fff91ec9000 -     0x7fff91ecafff  libsystem_sandbox.dylib (??? - ???) <8D14139B-B671-35F4-9E5A-023B4C523C38> /usr/lib/system/libsystem_sandbox.dylib
    0x7fff91fd8000 -     0x7fff9204bfff  libstdc++.6.dylib (52.0.0 - compatibility 7.0.0) <6BDD43E4-A4B1-379E-9ED5-8C713653DFF2> /usr/lib/libstdc++.6.dylib
    0x7fff935ff000 -     0x7fff93605fff  libmacho.dylib (800.0.0 - compatibility 1.0.0) <D86F63EC-D2BD-32E0-8955-08B5EAFAD2CC> /usr/lib/system/libmacho.dylib
    0x7fff93c9d000 -     0x7fff93ca6ff7  libsystem_notify.dylib (80.1.0 - compatibility 1.0.0) <A4D651E3-D1C6-3934-AD49-7A104FD14596> /usr/lib/system/libsystem_notify.dylib
    0x7fff93fee000 -     0x7fff93ffcfff  libdispatch.dylib (187.7.0 - compatibility 1.0.0) <712AAEAC-AD90-37F7-B71F-293FF8AE8723> /usr/lib/system/libdispatch.dylib
    0x7fff943d6000 -     0x7fff943ddfff  libcopyfile.dylib (85.1.0 - compatibility 1.0.0) <172B1985-F24A-34E9-8D8B-A2403C9A0399> /usr/lib/system/libcopyfile.dylib
    0x7fff9440e000 -     0x7fff9445cfff  libauto.dylib (??? - ???) <D8AC8458-DDD0-3939-8B96-B6CED81613EF> /usr/lib/libauto.dylib
    0x7fff9468f000 -     0x7fff946acff7  libxpc.dylib (77.17.0 - compatibility 1.0.0) <72A16104-2F23-3C22-B474-1953F06F9376> /usr/lib/system/libxpc.dylib
    0x7fff94884000 -     0x7fff94886fff  libquarantine.dylib (36.0.0 - compatibility 1.0.0) <4C3BFBC7-E592-3939-B376-1C2E2D7C5389> /usr/lib/system/libquarantine.dylib
    0x7fff94d0c000 -     0x7fff94d2cfff  libsystem_kernel.dylib (1699.22.73 - compatibility 1.0.0) <69F2F501-72D8-3B3B-8357-F4418B3E1348> /usr/lib/system/libsystem_kernel.dylib
    0x7fff94d2d000 -     0x7fff94d33ff7  libunwind.dylib (30.0.0 - compatibility 1.0.0) <1E9C6C8C-CBE8-3F4B-A5B5-E03E3AB53231> /usr/lib/system/libunwind.dylib
    0x7fff95158000 -     0x7fff9515dfff  libcache.dylib (47.0.0 - compatibility 1.0.0) <B7757E2E-5A7D-362E-AB71-785FE79E1527> /usr/lib/system/libcache.dylib
    0x7fff95340000 -     0x7fff95341ff7  libsystem_blocks.dylib (53.0.0 - compatibility 1.0.0) <8BCA214A-8992-34B2-A8B9-B74DEACA1869> /usr/lib/system/libsystem_blocks.dylib
    0x7fff95c3a000 -     0x7fff95d17fef  libsystem_c.dylib (763.12.0 - compatibility 1.0.0) <FF69F06E-0904-3C08-A5EF-536FAFFFDC22> /usr/lib/system/libsystem_c.dylib
    0x7fff95d18000 -     0x7fff95d19fff  libdnsinfo.dylib (395.6.0 - compatibility 1.0.0) <718A135F-6349-354A-85D5-430B128EFD57> /usr/lib/system/libdnsinfo.dylib

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 1313925
    thread_create: 1
    thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=54.5M resident=16.3M(30%) swapped_out_or_unallocated=38.3M(70%)
Writable regions: Total=83.5M written=240K(0%) resident=1432K(2%) swapped_out=0K(0%) unallocated=82.1M(98%)

REGION TYPE                      VIRTUAL
===========                      =======
MALLOC                             19.2M
MALLOC guard page                    16K
STACK GUARD                           4K
Stack                              64.0M
__DATA                              676K
__LINKEDIT                         48.0M
__TEXT                             6640K
shared memory                        12K
===========                      =======
TOTAL                             138.4M

我应该做什么或做什么我忽略了什么?

提前致谢。

3 个答案:

答案 0 :(得分:2)

这对我有用:

$export CC=/usr/bin/gcc-4.2

答案 1 :(得分:1)

尝试以下步骤。

找一个gcc:

$ ls /usr/bin/gcc-*

重新尝试使用找到的gcc:

$ autoconf
$ CC=/usr/bin/gcc-4.2 ./configure --prefix=$HOME/tmp/ruby --enable-shared
$ make

答案 2 :(得分:0)

这适用于从官方Ruby站点下载和构建的1.9.3-p547。

CFLAGS="-mmacosx-version-min=10.9" LDFLAGS="-mmacosx-version-min=10.9" CPPFLAGS="-mmacosx-version-min=10.9" ./configure
make
make install