简体   繁体   English

无法编译基本的锈文件

[英]Cannot compile basic rust file

  • OS: macOS Mojave 10.14.4 x86_64 操作系统:macOS Mojave 10.14.4 x86_64
  • LLVM version: 8.0 LLVM版本:8.0
  • xcode-select version: 2354 xcode-select版本:2354
  • rustc 1.34.1 rustc 1.34.1

When run: rustc main.rs 运行时: rustc main.rs

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-m64" "-L" "/Users/abhay/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "main.main.7rcbfp3g-cgu.0.rcgu.o" "main.main.7rcbfp3g-cgu.1.rcgu.o" "main.main.7rcbfp3g-cgu.2.rcgu.o" "main.main.7rcbfp3g-cgu.3.rcgu.o" "main.main.7rcbfp3g-cgu.4.rcgu.o" "main.main.7rcbfp3g-cgu.5.rcgu.o" "-o" "main" "main.4s37gsrti678ik8u.rcgu.o" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/Users/abhay/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/abhay/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-69468557cf2e6e61.rlib" "/Users/abhay/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-9c46cbe4b20f76c9.rlib" "/Users/abhay/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libbacktrace_sys-1bab212c0168b306.rlib" "/Users/abhay/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-ccbdb02fb3eef923.rlib" "/Users/abhay/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-e705bf8976fe8243.rlib" "/Users/abhay/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-85176bbe7f63adc0.rlib" "/Users/abhay/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-80e2cac000a11404.rlib" "/Users/abhay/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-1c0ce4c4b6e07a27.rlib" "/Users/abhay/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-f81ce6e54e0bbe9c.rlib" "/Users/abhay/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-d2154badfa119bbc.rlib" "-lSystem" "-lresolv" "-lc" "-lm"
  = note: ld: malformed file
          /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libm.tbd:4:18: error: unknown enumerated scalar
          platform:        zippered
                           ^~~~~~~~
           file '/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libm.tbd'
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

Reference: Solution taken from 参考: 解决方案取自

FYI, If you want to stay on xcode 9.4.1, you can do the following: 仅供参考,如果您希望使用xcode 9.4.1,则可以执行以下操作:

If you are running on Mojave, you will need to install the MacOS headers in the base system: 如果您在Mojave上运行,则需要在基本系统中安装MacOS标头:

sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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