Skip to content

FHIRModels does not build on Linux — unconditional import os in FHIRDecodingDepthTracker.swift #43

Closed

Description

@shinrenpan

Summary

FHIRModels 0.9.2 fails to compile on Linux because FHIRDecodingDepthTracker.swift unconditionally imports Apple's os framework:

// Sources/FMCore/FHIRDecodingDepthTracker.swift
import os

The os framework (OSLog, os_signpost, etc.) is a Darwin-only framework and is not available on Linux or Windows.

Steps to reproduce

  1. Create a Swift package on Linux (or use a swift:6.2-jammy Docker image) that depends on FHIRModels >= 0.9.0
  2. Run swift build

Error:

FHIRModels/Sources/FMCore/FHIRDecodingDepthTracker.swift:20:8: error: no such module 'os'

Impact

Any server-side Swift project using FHIRModels on Linux (Docker, cloud VMs, CI on Linux runners) is blocked from building. This affects FHIR server implementations that want to run in containerised environments.

Suggested fix

Wrap the import os and any os-dependent code with a platform check:

#if canImport(os)
import os
#endif

And guard usage sites accordingly:

#if canImport(os)
// os_log / OSLog usage
#endif

Related

Environment

  • FHIRModels: 0.9.2
  • Swift: 6.2
  • Platform: Linux (Ubuntu 22.04 / swift:6.2-jammy)

Activity

  1. self-assigned this
    on Jun 9, 2026
  2. added
    bug
    on Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions