如何在不破坏我的 Rust 工具链的情况下测试 XCode 中的 iOS 应用程序?

How can I test iOS apps in XCode without it breaking my Rust toolchain?

我最近测试了一个 IPhone 应用程序,用 Swift 编写,使用 XCode 使用内置 iPhone 模拟器。

从那时起,当我尝试构建任何 Rust 项目时,即使在使用 rustup 更新 Rust 之后,我也会遇到编译错误。也有提到 iOS 模拟器的警告。我不熟悉 C 或 XCode 工具链,所以我不确定修复它的最佳方法是什么或如何防止将来再次发生这种情况。

注意:我的 Rust 项目没有针对 iOS。

新项目的情况如下:

$ cargo new test1
$ cd test1
$ cargo build
   Compiling test1 v0.1.0 (file:///Users/peter/dev/test1)
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-m64" "-L" "/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/peter/dev/test1/target/debug/deps/test1-7fe1ce40b6cf488e.1y16o1qfye96o7m0.rcgu.o" "/Users/peter/dev/test1/target/debug/deps/test1-7fe1ce40b6cf488e.3k2zkvohnahk04y3.rcgu.o" "/Users/peter/dev/test1/target/debug/deps/test1-7fe1ce40b6cf488e.3rngp6bm2u2q5z0y.rcgu.o" "/Users/peter/dev/test1/target/debug/deps/test1-7fe1ce40b6cf488e.4oc10dk278mpk1vy.rcgu.o" "/Users/peter/dev/test1/target/debug/deps/test1-7fe1ce40b6cf488e.4xq48u46a1pwiqn7.rcgu.o" "/Users/peter/dev/test1/target/debug/deps/test1-7fe1ce40b6cf488e.oa3rad818d8sgn4.rcgu.o" "-o" "/Users/peter/dev/test1/target/debug/deps/test1-7fe1ce40b6cf488e" "/Users/peter/dev/test1/target/debug/deps/test1-7fe1ce40b6cf488e.crate.allocator.rcgu.o" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/Users/peter/dev/test1/target/debug/deps" "-L" "/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-73671a9242f94467.rlib" "/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-5a05d0933700ddb1.rlib" "/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib" "/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-64fd20ce4af6fbad.rlib" "/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_system-2c5b1969da7ded68.rlib" "/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-c80953af6722fea1.rlib" "/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-2ed0d380199e717d.rlib" "/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-8c87fbf7e0bce62b.rlib" "/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-9b97130153f6d410.rlib" "-l" "System" "-l" "resolv" "-l" "pthread" "-l" "c" "-l" "m"
  = note: ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(jemalloc.pic.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(jemalloc.pic.o)) was built for newer OSX version (10.7) than being linked (8.0)
          ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-73671a9242f94467.rlib(state.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-73671a9242f94467.rlib(state.o)) was built for newer OSX version (10.7) than being linked (8.0)
          ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-73671a9242f94467.rlib(fileline.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-73671a9242f94467.rlib(fileline.o)) was built for newer OSX version (10.7) than being linked (8.0)
          ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(arena.pic.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(arena.pic.o)) was built for newer OSX version (10.7) than being linked (8.0)
          ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(base.pic.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(base.pic.o)) was built for newer OSX version (10.7) than being linked (8.0)
          ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(chunk.pic.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(chunk.pic.o)) was built for newer OSX version (10.7) than being linked (8.0)
          ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(chunk_dss.pic.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(chunk_dss.pic.o)) was built for newer OSX version (10.7) than being linked (8.0)
          ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(ctl.pic.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(ctl.pic.o)) was built for newer OSX version (10.7) than being linked (8.0)
          ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(huge.pic.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(huge.pic.o)) was built for newer OSX version (10.7) than being linked (8.0)
          ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(mutex.pic.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(mutex.pic.o)) was built for newer OSX version (10.7) than being linked (8.0)
          ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(util.pic.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(util.pic.o)) was built for newer OSX version (10.7) than being linked (8.0)
          ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(tsd.pic.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(tsd.pic.o)) was built for newer OSX version (10.7) than being linked (8.0)
          ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(tcache.pic.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(tcache.pic.o)) was built for newer OSX version (10.7) than being linked (8.0)
          ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(stats.pic.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(stats.pic.o)) was built for newer OSX version (10.7) than being linked (8.0)
          ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(pages.pic.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(pages.pic.o)) was built for newer OSX version (10.7) than being linked (8.0)
          ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(prof.pic.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(prof.pic.o)) was built for newer OSX version (10.7) than being linked (8.0)
          ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(quarantine.pic.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(quarantine.pic.o)) was built for newer OSX version (10.7) than being linked (8.0)
          ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(witness.pic.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(witness.pic.o)) was built for newer OSX version (10.7) than being linked (8.0)
          ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-73671a9242f94467.rlib(alloc.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-73671a9242f94467.rlib(alloc.o)) was built for newer OSX version (10.7) than being linked (8.0)
          ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-73671a9242f94467.rlib(macho.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-73671a9242f94467.rlib(macho.o)) was built for newer OSX version (10.7) than being linked (8.0)
          ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-73671a9242f94467.rlib(posix.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-73671a9242f94467.rlib(posix.o)) was built for newer OSX version (10.7) than being linked (8.0)
          ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(bitmap.pic.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(bitmap.pic.o)) was built for newer OSX version (10.7) than being linked (8.0)
          ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(chunk_mmap.pic.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(chunk_mmap.pic.o)) was built for newer OSX version (10.7) than being linked (8.0)
          ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(ckh.pic.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(ckh.pic.o)) was built for newer OSX version (10.7) than being linked (8.0)
          ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(extent.pic.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(extent.pic.o)) was built for newer OSX version (10.7) than being linked (8.0)
          ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(nstime.pic.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(nstime.pic.o)) was built for newer OSX version (10.7) than being linked (8.0)
          ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(rtree.pic.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-3913d194bc6184af.rlib(rtree.pic.o)) was built for newer OSX version (10.7) than being linked (8.0)
          ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-73671a9242f94467.rlib(dwarf.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-73671a9242f94467.rlib(dwarf.o)) was built for newer OSX version (10.7) than being linked (8.0)
          ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-73671a9242f94467.rlib(read.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-73671a9242f94467.rlib(read.o)) was built for newer OSX version (10.7) than being linked (8.0)
          ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-73671a9242f94467.rlib(sort.o)) built for OSX. Note: This will be an error in the future.
          ld: warning: object file (/Users/peter/.rustup/toolchains/1.27.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-73671a9242f94467.rlib(sort.o)) was built for newer OSX version (10.7) than being linked (8.0)
          Undefined symbols for architecture x86_64:
            "_opendir$INODE64", referenced from:
                _macho_try_dsym in libstd-73671a9242f94467.rlib(macho.o)
                _macho_add in libstd-73671a9242f94467.rlib(macho.o)
            "_readdir$INODE64", referenced from:
                _macho_try_dsym in libstd-73671a9242f94467.rlib(macho.o)
                _macho_add in libstd-73671a9242f94467.rlib(macho.o)
          ld: symbol(s) not found for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)


error: aborting due to previous error

error: Could not compile `test1`.

抄送:

$ cc --version
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin17.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

海湾合作委员会:

$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/c++/4.2.1
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin17.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

生锈:

$ rustup show active-toolchain
1.27.1-x86_64-apple-darwin

其他信息:

$ echo $SDKROOT
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk

$ echo $DEVELOPER_DIR
/Applications/Xcode.app/Contents/Developer

$ xcrun --show-sdk-path
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk

$ xcode-select -p
/Applications/Xcode.app/Contents/Developer

我发现了这个 Rust 问题,听起来 很相似,但它已经很老了并且也已解决:

您已覆盖 $SDKROOT 以使用 iPhone 模拟器 SDK。一种简单的修复方法是在调用 C 编译器之前取消定义它,这应该会使其改用 macOS SDK。

$ export SDKROOT=
$ cargo build