Skip to content

SwiftBuild configuration does not fail when building sample package in release configuration #8984

@bkhouri

Description

@bkhouri

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

  • Confirmed reproduction steps with SwiftPM CLI. The description text must include reproduction steps with either of command-line SwiftPM commands, swift build, swift test, swift package etc.

Description

When building Fixtures/DependencyResolution/Internal/InternalExecutableAsDependency in release configuration using SwiftBuild, the action is successful but it fails when run in debug

Expected behavior

Building in either debug and release configuration either both pass or both fail.

Actual behavior

Building in debug mode fails while building in release configuration passed. both configuration fail using the native build system.

Steps to reproduce

  1. clone the swift-package-manager repository
  2. Run the following
    swift run swift-build --package-path Fixtures/DependencyResolution/Internal/InternalExecutableAsDependency --build-system native --configuration debug
    swift run swift-build --package-path Fixtures/DependencyResolution/Internal/InternalExecutableAsDependency --build-system native --configuration release
    swift run swift-build --package-path Fixtures/DependencyResolution/Internal/InternalExecutableAsDependency --build-system swiftbuild --configuration debug
    swift run swift-build --package-path Fixtures/DependencyResolution/Internal/InternalExecutableAsDependency --build-system swiftbuild --configuration release
    
  3. All fail except when using swiftbuild and release

Applying the following diff caused the release configuration build to fail, but it may not be the desirable outcome.

diff --git a/Sources/SwiftBuildSupport/PackagePIFBuilder.swift b/Sources/SwiftBuildSupport/PackagePIFBuilder.swift
index 510be26ce..dbf9c18ce 100644
--- a/Sources/SwiftBuildSupport/PackagePIFBuilder.swift
+++ b/Sources/SwiftBuildSupport/PackagePIFBuilder.swift
@@ -612,7 +612,7 @@ public final class PackagePIFBuilder {
         releaseSettings[.COPY_PHASE_STRIP] = "YES"
         releaseSettings[.DEBUG_INFORMATION_FORMAT] = "dwarf-with-dsym"
         releaseSettings[.GCC_OPTIMIZATION_LEVEL] = "s"
-        releaseSettings[.SWIFT_OPTIMIZATION_LEVEL] = "-Owholemodule"
+        // releaseSettings[.SWIFT_OPTIMIZATION_LEVEL] = "-Owholemodule"
         builder.project.addBuildConfig { id in BuildConfig(id: id, name: "Release", settings: releaseSettings) }
     }

Swift Package Manager version/commit hash

3fbec0b4de27c08071e158f51eb1a9d1d75ffe88

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

❯ uname -a
Darwin BKs-Work-M1Pro-MacBook-Pro-5.local 25.0.0 Darwin Kernel Version 25.0.0: Sat Jul 12 00:30:16 PDT 2025; root:xnu_development-12377.0.154.0.2~25/DEVELOPMENT_ARM64_T6000 arm64

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions