rust-lang / rust-lang/rust

CMake components fails to build on Mac Catalyst

Open
#129,069 0 comments 0 reactions 1 assignee View on GitHub

@madsmtm is already working on this.

Since Aug 14, 2024.

A-LLVM C-bug O-apple
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Running:

./x.py build --set=build.sanitizers=true --target=aarch64-apple-ios-macabi

Currently fails with:

... snip

running: cd "/rust/build/aarch64-apple-ios-macabi/native/sanitizers/build" && DESTDIR="" "cmake" "--build" "." "--target" "clang_rt.asan_osx_dynamic" "--config" "Release" "--" "-j" "12"
[1/14] Building CXX object lib/asan/CMakeFiles/RTAsan_dynamic.osx.dir/asan_win.cpp.o
clang: warning: overriding '-mmacosx-version-min=10.10' option with '--target=arm64-apple-ios-macabi' [-Woverriding-t-option]
clang: warning: overriding '-mmacosx-version-min=10.10' option with '--target=arm64-apple-ios-macabi' [-Woverriding-t-option]
clang: warning: overriding '-mmacosx-version-min=10.10' option with '--target=arm64-apple-ios-macabi' [-Woverriding-t-option]
clang: warning: argument unused during compilation: '-L/usr/lib' [-Wunused-command-line-argument]
[2/14] Building CXX object lib/asan/CMakeFiles/RTAsan_dynamic.osx.dir/asan_premap_shadow.cpp.o
clang: warning: overriding '-mmacosx-version-min=10.10' option with '--target=arm64-apple-ios-macabi' [-Woverriding-t-option]
clang: warning: overriding '-mmacosx-version-min=10.10' option with '--target=arm64-apple-ios-macabi' [-Woverriding-t-option]
clang: warning: overriding '-mmacosx-version-min=10.10' option with '--target=arm64-apple-ios-macabi' [-Woverriding-t-option]
clang: warning: argument unused during compilation: '-L/usr/lib' [-Wunused-command-line-argument]
[3/14] Building CXX object lib/asan/CMakeFiles/RTAsan_dynamic.osx.dir/asan_malloc_mac.cpp.o
FAILED: lib/asan/CMakeFiles/RTAsan_dynamic.osx.dir/asan_malloc_mac.cpp.o 
/usr/bin/clang++ -DASAN_DYNAMIC=1 -I/rust/src/llvm-project/compiler-rt/lib/asan/.. -fPIC --target=arm64-apple-ios-macabi -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -isystem /usr/include -iframework /System/Library/Frameworks -L/usr/lib -F/System/Library/Frameworks -Wall -O3 -DNDEBUG -std=c++17 -arch arm64 -arch x86_64 -arch x86_64h -stdlib=libc++ -mmacosx-version-min=10.10 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -fPIC -fno-builtin -fno-exceptions -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -O3 -g -nostdinc++ -fno-rtti -Wno-format -ftls-model=initial-exec -MD -MT lib/asan/CMakeFiles/RTAsan_dynamic.osx.dir/asan_malloc_mac.cpp.o -MF lib/asan/CMakeFiles/RTAsan_dynamic.osx.dir/asan_malloc_mac.cpp.o.d -o lib/asan/CMakeFiles/RTAsan_dynamic.osx.dir/asan_malloc_mac.cpp.o -c /rust/src/llvm-project/compiler-rt/lib/asan/asan_malloc_mac.cpp
clang: warning: overriding '-mmacosx-version-min=10.10' option with '--target=arm64-apple-ios-macabi' [-Woverriding-t-option]
clang: warning: overriding '-mmacosx-version-min=10.10' option with '--target=arm64-apple-ios-macabi' [-Woverriding-t-option]
clang: warning: overriding '-mmacosx-version-min=10.10' option with '--target=arm64-apple-ios-macabi' [-Woverriding-t-option]
clang: warning: argument unused during compilation: '-L/usr/lib' [-Wunused-command-line-argument]
In file included from /rust/src/llvm-project/compiler-rt/lib/asan/asan_malloc_mac.cpp:66:
/rust/src/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_malloc_mac.inc:20:10: fatal error: 'CoreFoundation/CFBase.h' file not found
#include <CoreFoundation/CFBase.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~
/rust/src/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_malloc_mac.inc:20:10: note: did not find header 'CFBase.h' in framework 'CoreFoundation' (loaded from '/System/Library/Frameworks')
1 error generated.

... snip

This is preventing us from distributing a sanitizer runtime with rustup on Mac Catalyst, see https://github.com/rust-lang/rust/pull/126450.

Still have to do some more digging, but it seems like the issue is that iOSSupport libraries aren't passed to CMake, as is otherwise done in the ecosystem. In general, it seems like CMake has poor support for Mac Catalyst.

I'll try to fix this, both in the cmake crate and perhaps in CMake itself.
@rustbot claim

Linking https://github.com/leetal/ios-cmake and https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/Platform/Apple-Clang.cmake to myself for later (might contain some of the relevant CMake configuration needed for this).

@rustbot label O-apple

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.