- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Open
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.Category: This is a bug.O-appleOperating system: Apple (macOS, iOS, tvOS, visionOS, watchOS)Operating system: Apple (macOS, iOS, tvOS, visionOS, watchOS)
Description
Running:
./x.py build --set=build.sanitizers=true --target=aarch64-apple-ios-macabiCurrently 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.
... snipThis is preventing us from distributing a sanitizer runtime with rustup on Mac Catalyst, see #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
Metadata
Metadata
Assignees
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.Category: This is a bug.O-appleOperating system: Apple (macOS, iOS, tvOS, visionOS, watchOS)Operating system: Apple (macOS, iOS, tvOS, visionOS, watchOS)