apple / swift-distributed-tracing

Instrumentation library for Swift server applications
https://swiftpackageindex.com/apple/swift-distributed-tracing/main/documentation/tracing
Apache License 2.0
222 stars 30 forks source link

Support compiling against Musl #145

Closed simonjbeaumont closed 6 months ago

simonjbeaumont commented 6 months ago

Motivation

When building for Linux, we would like to be able to build this package on top of Musl, as well as the usual Glibc.

Modifications

Replace imports of Glibc with conditional imports using the following pattern:

- import Glibc
+ #if canImport(Glibc)
+ import Glibc
+ #elseif canImport(Musl)
+ import Musl
+ #else
+ #error("Unsupported runtime")
+ #endif

Result

Can compile against Musl.

ktoso commented 6 months ago

@swift-server-bot test this please

ktoso commented 6 months ago

Thank you!