简体   繁体   中英

Broken assembler on Snow Leopard

This is XCode 3.2.6 on snow leopard (gcc 4.2.1). Trying to compile a Hello World program and get a segfault, with a crash report like the one below (this was trying the first example in Learn C the Hard Way). Any hints towards a possible solution would be great.

Additionally, XCode crashes with "+entityForName: could not locate an NSManagedObjectModel for entity name 'DTExtensionPointDescription'" when you try to open or create a project.

Process:         as [44911]
Path:            /usr/bin/as
Identifier:      as
Version:         ??? (???)
Code Type:       X86-64 (Native)
Parent Process:  i686-apple-darwin10-gcc-4.2.1 [44909]

Date/Time:       2012-06-11 08:47:14.521 -0400
OS Version:      Mac OS X 10.6.8 (10K549)
Report Version:  6

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   libSystem.B.dylib               0x00007fff851cdad2 rindex + 8
1   as                              0x0000000100000775 0x100000000 + 1909
2   as                              0x00000001000006d4 0x100000000 + 1748

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000000  rbx: 0x00007fff5fbff2a0  rcx: 0x000000000000002f  rdx: 0x0000000000000000
  rdi: 0x0000000000000000  rsi: 0x000000000000002f  rbp: 0x00007fff5fbfee40  rsp: 0x00007fff5fbfee40
   r8: 0x0000000000000001   r9: 0x8080808080808080  r10: 0x00007fff8a96c169  r11: 0x00007fff851cdaca
  r12: 0x00007fff5fbfee98  r13: 0x0000000000000000  r14: 0x00007fff5fbff708  r15: 0x0000000000000007
  rip: 0x00007fff851cdad2  rfl: 0x0000000000010246  cr2: 0x0000000000000000

Binary Images:
       0x100000000 -        0x100002fff  as ??? (???) <44A4A2BA-257C-914C-FA97-714D15FFDBE1> /usr/libexec/gcc/i686-apple-darwin10/4.2.1/as
    0x7fff5fc00000 -     0x7fff5fc3be0f  dyld 132.1 (???) <DD3F7F3E-8612-A7BD-F508-9EF29132C419> /usr/lib/dyld
    0x7fff82f8a000 -     0x7fff82f8eff7  libmathCommon.A.dylib 315.0.0 (compatibility 1.0.0) <95718673-FEEE-B6ED-B127-BCDBDB60D4E5> /usr/lib/system/libmathCommon.A.dylib
    0x7fff85191000 -     0x7fff85352fef  libSystem.B.dylib 125.2.11 (compatibility 1.0.0) <9AB4F1D1-89DC-0E8A-DC8E-A4FE4D69DB69> /usr/lib/libSystem.B.dylib
    0x7fffffe00000 -     0x7fffffe01fff  libSystem.B.dylib ??? (???) <9AB4F1D1-89DC-0E8A-DC8E-A4FE4D69DB69> /usr/lib/libSystem.B.dylib

Here's something interesting-- here are all the 'as' binaries (and/or links) on my system:

/Developer/usr/bin/as
/Developer/usr/libexec/gcc/darwin/i386/as
/Developer/usr/libexec/gcc/darwin/ppc/as
/Developer/usr/libexec/gcc/darwin/ppc64/as
/Developer/usr/libexec/gcc/darwin/x86_64/as
/Developer/usr/libexec/gcc/i686-apple-darwin10/4.0.1/as
/Developer/usr/libexec/gcc/i686-apple-darwin10/4.2.1/as
/Developer/usr/libexec/gcc/powerpc-apple-darwin10/4.0.1/as
/Developer/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as
/Developer/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin10/4.2.1/as
/Developer/usr/llvm-gcc-4.2/libexec/gcc/powerpc-apple-darwin10/4.2.1/as

It's the i686 ones that segfault (even when called with no input). Is there a way (an environment variable) I can use to tell GCC to use the x86_64 architecture (I'm on an i7, so it should be the appropriate one anyways)

The point of a Hello World program is to confirm that your compilation system is working and you know how to use it.

Blowing up the assembler with a Hello World is pretty clear indication that your compilation system is not working.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM