Skip to content

Can't compile with dependency with unsafe flags for different platform. #244

@nekrich

Description

@nekrich

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

Right now, swiftlang/swift-markdown has introduced an unsafe flag for the Windows platform.

I'm trying to build my package that depends on swift-format (which depends on swift-markdown) on macOS/Linux platforms, but neither swift build nor swift test succeeds.

I'm getting an error: 'swift-format': the target 'Markdown' in product 'Markdown' contains unsafe build flags on the macOS platform.

But unsafe flag is only for windows platform.

Linking a corresponding issue in swift-markdown: #239 .

I see three options for fixing this issue:

  1. At least allow linking with dependencies that don't have unsafe flags for the current platform.
  2. Have a flag to turn off the unsafe flags check. For folks who know what they are doing.
  3. Ideally, Remove the unsafe flags check swift-package-manager#8876 completely.

Expected behavior

The swift test, swift build commands do the job and don't fail.

Actual behavior

  1. An error: 'swift-format': the target 'Markdown' in product 'Markdown' contains unsafe build flags is thrown.
  2. Package doesn't compile.

Steps to reproduce

  1. Create a package that depends on the swift-markdown 0.7.0.
  2. Build it on macOS/Linux platform.
  3. You've got an error.

Swift Package Manager version/commit hash

No response

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

swift-driver version: 1.127.14.1 Apple Swift version 6.2 (swiftlang-6.2.0.19.9 clang-1700.3.19.1)
Target: arm64-apple-macosx26.0
Darwin hapuku-QM17NWPXNV-DS 25.0.0 Darwin Kernel Version 25.0.0: Mon Aug 25 21:17:51 PDT 2025; root:xnu-12377.1.9~3/RELEASE_ARM64_T6020 arm64

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions