rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
97.35k stars 12.59k forks source link

CI: Update Xcode version #121058

Open ehuss opened 7 months ago

ehuss commented 7 months ago

In #120914 we downgraded Xcode from 15 to 14 due to two issues:

We will need to upgrade eventually since GitHub removes older xcode versions over time. My rough estimate is that we probably have about a year before that happens. I think it would be good to be prepared. There is also the possibility that GitHub will drop the x86_64 macos runners, in which case this will be moot.

I tested Xcode 15, but that still had the same problems.

Cmake error

The cmake error looks like this:

-- Check for working C compiler: /Users/runner/work/rust/rust/clang+llvm-14.0.5-x86_64-apple-darwin/bin/clang - broken
  The C compiler

    "/Users/runner/work/rust/rust/clang+llvm-14.0.5-x86_64-apple-darwin/bin/clang"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: '/Users/runner/work/rust/rust/build/x86_64-apple-ios/native/sanitizers/build/CMakeFiles/CMakeScratch/TryCompile-DlTLuP'

    Run Build Command(s): /usr/local/bin/ninja -v cmTC_4a181
    [1/2] /Users/runner/work/rust/rust/clang+llvm-14.0.5-x86_64-apple-darwin/bin/clang --target=x86_64-apple-ios   -fPIC --target=x86_64-apple-ios -m64 -mios-simulator-version-min=7.0 -isysroot /Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.0.sdk -fembed-bitcode -fdebug-prefix-map=/Users/runner/work/rust/rust=/rustc/llvm -fembed-bitcode=off -MD -MT CMakeFiles/cmTC_4a181.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_4a181.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_4a181.dir/testCCompiler.c.o -c /Users/runner/work/rust/rust/build/x86_64-apple-ios/native/sanitizers/build/CMakeFiles/CMakeScratch/TryCompile-DlTLuP/testCCompiler.c
    [2/2] : && /Users/runner/work/rust/rust/clang+llvm-14.0.5-x86_64-apple-darwin/bin/clang --target=x86_64-apple-ios -fPIC --target=x86_64-apple-ios -m64 -mios-simulator-version-min=7.0 -isysroot /Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.0.sdk -fembed-bitcode -fdebug-prefix-map=/Users/runner/work/rust/rust=/rustc/llvm -fembed-bitcode=off -Wl,-search_paths_first  -static-libstdc++ CMakeFiles/cmTC_4a181.dir/testCCompiler.c.o -o cmTC_4a181   && :
    FAILED: cmTC_4a181 
    : && /Users/runner/work/rust/rust/clang+llvm-14.0.5-x86_64-apple-darwin/bin/clang --target=x86_64-apple-ios -fPIC --target=x86_64-apple-ios -m64 -mios-simulator-version-min=7.0 -isysroot /Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.0.sdk -fembed-bitcode -fdebug-prefix-map=/Users/runner/work/rust/rust=/rustc/llvm -fembed-bitcode=off -Wl,-search_paths_first  -static-libstdc++ CMakeFiles/cmTC_4a181.dir/testCCompiler.c.o -o cmTC_4a181   && :
    clang-14: warning: argument unused during compilation: '-static-libstdc++' [-Wunused-command-line-argument]
    ld: unknown options: -ios_simulator_version_min 
    clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
    ninja: build stopped: subcommand failed.

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:14 (project)

One workaround is to set USE_XCODE_CLANG: 1 in ci.yml. I'm not sure if there is a strong reason to use USE_XCODE_CLANG or not. Another possibility is to update the pre-built clang to match the version in Xcode and see if that helps. My guess is that having clang and ld out of sync might contribute to the problem.

bjorn3 commented 3 months ago

https://github.com/rust-lang/rustc_codegen_cranelift/issues/1456 when testing cranelift

https://github.com/rust-lang/rust/pull/127162 will fix this.