Skip to content

Commit 2c79ff6

Browse files
authored
Use an explicit path to Swift from Swiftly (apple#594)
Prior to this change, `make vmintid` failed with `which swift` equals to `/usr/bin/swift`: > /Users/Dmitry/Apple/containerization/vminitd/.build/checkouts/swift-protobuf/Sources/SwiftProtobuf/AnyMessageStorage.swift:16:8: error: compiled module was created by an older version of the compiler; rebuild 'Foundation' and try again: /Users/Dmitry/Library/org.swift.swiftpm/swift-sdks/swift-6.3-DEVELOPMENT-SNAPSHOT-2026-02-27-a_static-linux-0.1.0.artifactbundle/swift-6.3-DEVELOPMENT-SNAPSHOT-2026-02-27-a_static-linux-0.1.0/swift-linux-musl/musl-1.2.5.sdk/aarch64/usr/lib/swift_static/linux-static/Foundation.swiftmodule/aarch64-swift-linux-musl.swiftmodule With an explicit path to Swift from Swiftly, `make vminitd` works both with `which swift` equals to `~/.swiftly/bin/swift` or `/usr/bin/swift`.
1 parent d1b5bdb commit 2c79ff6

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

vminitd/Makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ SWIFT_SDK_PATH := /tmp/$(notdir $(SWIFT_SDK_URL))
2424
SWIFTLY_URL := https://download.swift.org/swiftly/darwin/swiftly.pkg
2525
SWIFTLY_FILENAME := $(notdir $(SWIFTLY_URL))
2626
SWIFTLY_BIN_DIR ?= ~/.swiftly/bin
27-
BUILD_BIN_DIR := $(shell swift build -c $(BUILD_CONFIGURATION) $(SWIFT_CONFIGURATION) --show-bin-path)
27+
SWIFT := $(SWIFTLY_BIN_DIR)/swift
28+
BUILD_BIN_DIR := $(shell $(SWIFT) build -c $(BUILD_CONFIGURATION) $(SWIFT_CONFIGURATION) --show-bin-path)
2829

2930
SYSTEM_TYPE := $(shell uname -s)
3031
ifeq ($(SYSTEM_TYPE),Darwin)
@@ -41,8 +42,8 @@ all:
4142
@mkdir -p ./bin/
4243
@rm -f ./bin/vminitd
4344
@rm -f ./bin/vmexec
44-
@swift --version
45-
@swift build -c $(BUILD_CONFIGURATION) $(SWIFT_CONFIGURATION)
45+
@$(SWIFT) --version
46+
@$(SWIFT) build -c $(BUILD_CONFIGURATION) $(SWIFT_CONFIGURATION)
4647
@install "$(BUILD_BIN_DIR)/vminitd" ./bin/
4748
@install "$(BUILD_BIN_DIR)/vmexec" ./bin/
4849

@@ -70,7 +71,7 @@ swift: swiftly
7071
linux-sdk: swift
7172
@echo Installing Static Linux SDK...
7273
@curl -L -o $(SWIFT_SDK_PATH) $(SWIFT_SDK_URL)
73-
-@swift sdk install $(SWIFT_SDK_PATH)
74+
-@$(SWIFT) sdk install $(SWIFT_SDK_PATH)
7475
@rm $(SWIFT_SDK_PATH)
7576

7677
.PHONY: macos-sdk
@@ -96,4 +97,4 @@ clean:
9697
@echo Cleaning the vminitd build files...
9798
@rm -f ./bin/vminitd
9899
@rm -f ./bin/vmexec
99-
@swift package clean $(SWIFT_CONFIGURATION)
100+
@rm -rf .build

0 commit comments

Comments
 (0)