open-telemetry / opentelemetry-swift

OpenTelemetry API for Swift
https://opentelemetry.io/docs/instrumentation/swift/
Apache License 2.0
207 stars 124 forks source link

Unsafe build flags prevent build in 1.10.0 #549

Closed macintosh-HD closed 1 month ago

macintosh-HD commented 1 month ago

Hello everyone,

I just added OpenTelemetry to my Vapor project as described in the docs. .package(url: "https://github.com/open-telemetry/opentelemetry-swift", from: "1.0.0"), This installs version 1.10.0 of OpenTelemetry. After that I got 4 error messages in Xcode like this, all referencing the OpenTelemetryApi target:

the target 'OpenTelemetryApi' in product 'OpenTelemetryApi' contains unsafe build flags

When setting the version explicitly to version 1.9.2 the errors disappear. Also version 1.10.0 does not have a release here on GitHub, which caused a bit of confusion on my side.

It looks like that 1.10.0 introduces an unsafe flag in Package@swift-5.9.swift in the OpenTelemetryApi target: https://github.com/open-telemetry/opentelemetry-swift/commit/8d79dc595582ba3c1fe0436327fb31d3ece62872#diff-bf739b34e65503607bda0ba7864c8ee15b460d0002df5a6cb67dcd5fec86c587R47-R49 Is this flag necessary or could it be removed?

nachoBonafonte commented 1 month ago

Yes, it erroneously added an unsafe flag and that is the reason it was removed, I don't know why your project referenced to it if it is not there anymore.

macintosh-HD commented 1 month ago

Ok, thank you. Looks like the release got removed but the underlying tag is still on GitHub, so SPM is picking it up when checking for version updates.

dcacenabes commented 1 month ago

Exactly, we're getting the same problem here because of the tag. https://github.com/open-telemetry/opentelemetry-swift/releases/tag/1.10.0

nachoBonafonte commented 1 month ago

I have removed the tag, can you check again? You may need to reset SPM cache though.

dcacenabes commented 1 month ago

I have removed the tag, can you check again? You may need to reset SPM cache though.

Working! I deleted:

.swiftpm
Package.resolved
rm -rf ~/Library/org.swift.swiftpm
rm -rf ~/Library/Caches/org.swift.swiftpm

and also selected "Reset Package Caches" from Xcode UI (right click on "Package Dependencies" section)

alolita commented 1 month ago

This issue seems to be fixed. Closing ths issue. Please reopen if you see the issue reoccuring.