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

时间:2018-07-11 13:21:17

标签: ios xcode rust rustup

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

从那时起,即使使用rustup更新Rust,在尝试构建任何Rust项目时也会遇到编译错误。也有警告提到iOS Simulator。我对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问题,听起来相似,但是它非常古老并且也已解决:

1 个答案:

答案 0 :(得分:1)

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

$ export SDKROOT=
$ cargo build