Skip to content

[SR-14126] Regression: Cross-compile host to iPhoneOS stopped working #56507

@swift-ci

Description

@swift-ci
Previous ID SR-14126
Radar rdar://problem/73770091
Original Reporter yoni (JIRA User)
Type Bug
Status Closed
Resolution Done

Attachment: Download

Environment

macOS 11.1

Swift cloned from https://github.com/apple/swift

Main branch.

Built with Ninja.

Clang version 12.0.0 (clang-1200.0.32.28)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, BuildScript, CMake
Assignee @CodaFi
Priority Medium

md5: 57805d3b9702704ea008460f92552183

Issue Description:

Cross-compiling Swift for iOS (using cross-compile-hosts=iphoneos-arm64) has recently stopped working.

I suspect the issue comes from deprecating min-version in this recent commit.

Seems min-version parameter might still be required by clang (using latest version 12.0.0 (clang-1200.0.32.28)).

On the first target (cmark-iphoneos-arm64), clang emits:
clang: warning: argument unused during compilation: '-arch arm64' [-Wunused-command-line-argument]
ld: warning: ignoring file CMakeFiles/cmTC_00702.dir/testCCompiler.c.o, building for iOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 )
{{ ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/usr/lib/libSystem.tbd, missing required architecture x86_64 in file /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/usr/lib/libSystem.tbd (4 slices)}}
{{ Undefined symbols for architecture x86_64:}}
{{ "_main", referenced from:}}
{{ implicit entry/start for main executable}}
{{ ld: symbol(s) not found for architecture x86_64}}

For reference, the build flags for CMakeCCompilerId.o in latest code is:
;;-Wno-unknown-warning-option;-Werror=unguarded-availability-new;-arch;arm64;-target;arm64-apple-iphoneos14.0;-fno-stack-protector

which produce a wrong file type of:
ELF 64-bit LSB relocatable, ARM aarch64, version 1 (SYSV), not stripped

And the build flags from before the commit, which works:
;;-Wno-unknown-warning-option;-Werror=unguarded-availability-new;-arch;arm64;;-miphoneos-version-min=14.0;-fno-stack-protector

And correctly produce a Mach-O 64-bit object arm64.

{{ }}

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.build-scriptArea → utils: The build scriptcmakecompilerThe Swift compiler itselfutilsArea: the build system and other accessory scripts under the "utils" directory

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions