Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

CMake components fails to build on Mac Catalyst #129069

Open
madsmtm opened this issue Aug 14, 2024 · 0 comments
Open

CMake components fails to build on Mac Catalyst #129069

madsmtm opened this issue Aug 14, 2024 · 0 comments
Assignees
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug. O-apple Operating system: Apple (macOS, iOS, tvOS, visionOS, watchOS)

Comments

@madsmtm
Copy link
Contributor

madsmtm commented Aug 14, 2024

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 #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

@madsmtm madsmtm added the C-bug Category: This is a bug. label Aug 14, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 14, 2024
@rustbot rustbot added the O-apple Operating system: Apple (macOS, iOS, tvOS, visionOS, watchOS) label Aug 14, 2024
bors added a commit to rust-lang-ci/rust that referenced this issue Aug 18, 2024
…-Simulacrum

Promote Mac Catalyst targets to Tier 2, and ship with rustup

Promote the Mac Catalyst targets `x86_64-apple-ios-macabi` and `aarch64-apple-ios-macabi` to Tier 2, as per [the MCP](rust-lang/compiler-team#761) (see that for motivation and details).

These targets are now also distributed with rustup, although without the sanitizer runtime, as that currently has trouble building, see rust-lang#129069.
@saethlin saethlin added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Aug 19, 2024
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Aug 20, 2024
Promote Mac Catalyst targets to Tier 2, and ship with rustup

Promote the Mac Catalyst targets `x86_64-apple-ios-macabi` and `aarch64-apple-ios-macabi` to Tier 2, as per [the MCP](rust-lang/compiler-team#761) (see that for motivation and details).

These targets are now also distributed with rustup, although without the sanitizer runtime, as that currently has trouble building, see rust-lang/rust#129069.
lnicola pushed a commit to lnicola/rust-analyzer that referenced this issue Aug 29, 2024
Promote Mac Catalyst targets to Tier 2, and ship with rustup

Promote the Mac Catalyst targets `x86_64-apple-ios-macabi` and `aarch64-apple-ios-macabi` to Tier 2, as per [the MCP](rust-lang/compiler-team#761) (see that for motivation and details).

These targets are now also distributed with rustup, although without the sanitizer runtime, as that currently has trouble building, see rust-lang/rust#129069.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug. O-apple Operating system: Apple (macOS, iOS, tvOS, visionOS, watchOS)
Projects
None yet
Development

No branches or pull requests

3 participants