swiftlang / swift-package-manager

The Package Manager for the Swift Programming Language
Apache License 2.0
9.75k stars 1.35k forks source link

Host build are "sandboxed" by target triple #7899

Closed rauhul closed 3 months ago

rauhul commented 3 months ago

Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?

Description

When switching target triples from say arm64-apple-macosx15-macho to armv7em-apple-none-macho, SwiftPM rebuilds all host content. I think is because "tools/host" content is not shared between target triples. You can see this by looking in the .build directory and seeing that each target directory contains their own -tools directory built for the host.

See output of ➜ swift-mmio git:(main) ✗ fd '.*-tool' .build/aarch64-unknown-linux-gnu/debug .build/arm64-apple-macosx/debug | sort | pbcopy

files.txt

dschaefer2 commented 3 months ago

Deleted earlier poorly thought out reply.

Why do you have output for linux?

rauhul commented 3 months ago

Why do you have output for linux?

was cross compiling for linux, but could've easily been an embedded triple instead

dschaefer2 commented 3 months ago

Why do you have output for linux?

was cross compiling for linux, but could've easily been an embedded triple instead

Ah, it looked like another host build with docker or something. Makes sense.

Question is, why do target output directories have tools at all. They should only be on the host.

dschaefer2 commented 3 months ago

Does your armv7em directory have -tools things? I wonder if it considers linux a host...

At any rate, definitely something not right.

rauhul commented 3 months ago

Hmm I can't reproduce this in a clean area. I'm gonna close it and reopen with a concrete repro if it does.

Screenshot 2024-08-20 at 7 59 05 PM
dschaefer2 commented 3 months ago

Thanks!