apple / apple/swift-log

Build fails when BUILD_LIBRARY_FOR_DISTRIBUTION is set to YES

Open
#314 5 comments 2 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
4k
Forks
344
Avg merge
1d 11h
Merged PRs (30d)
5

Description

### Expected behavior
The build should succeed when BUILD_LIBRARY_FOR_DISTRIBUTION is set to YES

### Actual behavior
The build failes with following error:

```
/Users/.../Library/Developer/Xcode/DerivedData/...-bpquduvhbvfnlzdecjxlvelyutun/SourcePackages/checkouts/swift-log/Sources/Logging/Logging.swift:56:9: error: initializer for class 'Logger.Storage' is '@inlinable' and must delegate to another initializer
init(label: String, handler: any LogHandler) {
^
** ARCHIVE FAILED **
```

If BUILD_LIBRARY_FOR_DISTRIBUTION is set to NO, it compiles without problems.

### Steps to reproduce

1. Create a new framework and add SwiftLog dependency
2. Build with xcodebuild: `xcodebuild archive -quiet -scheme framework -configuration Release SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES -archivePath "./framework-iphoneos" -destination "generic/platform=iOS"`

### SwiftLog version/commit hash

1.6.1

### Swift & OS version (output of `swift --version && uname -a`)
swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-macosx14.0
Darwin MBP-MMayer.local 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000 arm64

Contributor guide

Open the contributing guide

Research direction

Start with Sources/Logging/Logging.swift at the reported initializer around line 56 and reproduce the failure using the provided xcodebuild archive command with BUILD_LIBRARY_FOR_DISTRIBUTION=YES. Compare the failing archive with the successful BUILD_LIBRARY_FOR_DISTRIBUTION=NO build; done means the framework archive succeeds under the reported SwiftLog, Swift, and macOS versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.