swiftlang / swift-package-manager

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

Apparent problem running builds for multiple platforms #6568

Open dabrahams opened 1 year ago

dabrahams commented 1 year ago

Description

I started a build on my mac in a linux devcontainer, and then did a simultaneous mac-only build and got this message on the mac (!):

swift build --build-tests [1/1] Compiling plugin Format Source Code [2/2] Compiling plugin GenerateManualPlugin [3/3] Compiling plugin Lint Source Code Building for debugging... error: couldn't build /workspaces/val/.build/aarch64-unknown-linux-gnu/debug/llvmshims.build/src/shim.cc.o because of missing inputs: /workspaces/val/.build/checkouts/Swifty-LLVM/Sources/llvmshims/src/shim.cc

Expected behavior

No response

Actual behavior

No response

Steps to reproduce

No response

Swift Package Manager version/commit hash

Swift Package Manager - Swift 5.8.0

Swift & OS version (output of swift --version ; uname -a)

swift-driver version: 1.75.2 Apple Swift version 5.8 (swiftlang-5.8.0.124.2 clang-1403.0.22.11.100) Target: arm64-apple-macosx13.0 Darwin DaveA-MBP14.local 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar 6 20:59:28 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6000 arm64

neonichu commented 1 year ago

Right, the build description is not segregated by platform.

It's interesting that we did segregate the build databases, probably to avoid doing stale-file removal for the "wrong" platform, but that allows even starting multiple builds, which otherwise would fail at getting a lock on the build database. That would seem like a more graceful behavior than random failures.

dabrahams commented 1 year ago

I'm not sure what this would mean, but I'll just point out that multiplatform development with a single working copy accessible to multiple VMs is a real use-case, and it would be a shame if it weren't supported. Can SPM do out-of-source builds?

neonichu commented 1 year ago

Yah, you can customize the build directory:

--scratch-path <scratch-path>
                          Specify a custom scratch directory path (default
                          .build)
dabrahams commented 1 year ago

Thanks, that can be used as a workaround, then. I guess I still consider it a defect that one has to use this approach.