Rust hello world的巨大错误

时间:2015-10-20 18:01:57

标签: linker rust

我对Rust很新。它似乎是一种非常有趣的语言,但是当我编译一个简单的hello world程序时,我遇到了一个巨大的错误。这是我得到的错误:

note: "cc" "-m64" "-L" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "hello.0.o" "-o" "hello" "-Wl,-force_load,/usr/local/lib/rustlib/x86_64-apple-darwin/lib/libmorestack.a" "-Wl,-dead_strip" "-nodefaultlibs" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib/libstd-198068b3.rlib" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib/libcollections-198068b3.rlib" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib/librustc_unicode-198068b3.rlib" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib/librand-198068b3.rlib" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib/liballoc-198068b3.rlib" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib/liblibc-198068b3.rlib" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib/libcore-198068b3.rlib" "-L" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "-L" "/Users/<removed>/Documents/cringe/.rust/lib/x86_64-apple-darwin" "-L" "/Users/<removed>/Documents/cringe/lib/x86_64-apple-darwin" "-l" "System" "-l" "pthread" "-l" "c" "-l" "m" "-l" "compiler-rt"
note: couldn't understand kern.osversion `14.5.0'
ld: warning: directory not found for option '-L/Users/<removed>/Documents/cringe/.rust/lib/x86_64-apple-darwin'
ld: warning: directory not found for option '-L/Users/<removed>/Documents/cringe/lib/x86_64-apple-darwin'
Undefined symbols for architecture x86_64:
  "__Unwind_GetLanguageSpecificData", referenced from:
      ___gcc_personality_v0 in libcompiler-rt.a(gcc_personality_v0.o)
  "__Unwind_GetIP", referenced from:
      ___gcc_personality_v0 in libcompiler-rt.a(gcc_personality_v0.o)
  "__Unwind_SetIP", referenced from:
      ___gcc_personality_v0 in libcompiler-rt.a(gcc_personality_v0.o)
  "__Unwind_DeleteException", referenced from:
      rt::lang_start::hd654f015947477d622w       in libstd-198068b3.rlib(std-198068b3.0.o)
  "__Unwind_RaiseException", referenced from:
      rt::unwind::imp::panic::h3a53abf3818f0dd1jqw    in libstd-198068b3.rlib(std-198068b3.0.o)
  "__Unwind_SetGR", referenced from:
      ___gcc_personality_v0 in libcompiler-rt.a(gcc_personality_v0.o)
  "__Unwind_GetIPInfo", referenced from:
      sys::backtrace::write::trace_fn::h510f8e821e33fb3fMus    in libstd-198068b3.rlib(std-198068b3.0.o)
  "__Unwind_Backtrace", referenced from:
      sys::backtrace::write::h71ee98355e9ff89fUss     in libstd-198068b3.rlib(std-198068b3.0.o)
  "__Unwind_GetRegionStart", referenced from:
      ___gcc_personality_v0 in libcompiler-rt.a(gcc_personality_v0.o)
  "__Unwind_Resume", referenced from:
      error::Box$LT$Error$u2b$$u20$Send$u20$$u2b$$u20$Sync$u20$$u2b$$u20$$u27$a$GT$.From$LT$$RF$$u27$b$u20$str$GT$::from::haef03d11abb0506f6da       in libstd-198068b3.rlib(std-198068b3.0.o)
      thread..Inner::drop.33811::h2d4ce2ad919a880a        in libstd-198068b3.rlib(std-198068b3.0.o)
      sys_common::thread_info::current_thread::h002e72f07e6510beVwr        in libstd-198068b3.rlib(std-198068b3.0.o)
      thread::Thread::new::h823fd9fbff518de4EBb     in libstd-198068b3.rlib(std-198068b3.0.o)
      rt::unwind::begin_unwind_inner::h1a353d5ea12e1abeVBw      in libstd-198068b3.rlib(std-198068b3.0.o)
      rt::unwind::begin_unwind_fmt::h523af64a13dd33d21Aw      in libstd-198068b3.rlib(std-198068b3.0.o)
      sys::os::getenv::hdf9b4093693c98ceLLu     in libstd-198068b3.rlib(std-198068b3.0.o)
      ...
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status

error: aborting due to previous error

这是该计划:

fn main() {
    println!("Hello, World!");
}

我在OS X 10.10.5(14F27)上。我的Rust版本为rustc 1.3.0 (9a92aaf19 2015-09-15)

0 个答案:

没有答案