Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation warnings and errors when using Xcode 15 Beta #3122

Closed
DenTelezhkin opened this issue Jun 26, 2023 · 24 comments · Fixed by #3188
Closed

Compilation warnings and errors when using Xcode 15 Beta #3122

DenTelezhkin opened this issue Jun 26, 2023 · 24 comments · Fixed by #3188

Comments

@DenTelezhkin
Copy link

DenTelezhkin commented Jun 26, 2023

Platform

iOS

Installed

Swift Package Manager

Version

8.8.0

Steps to Reproduce

When compiling on device (compilation on simulator works fine), there are a bunch of new warnings, and with specific project configuration, compilation error when using Sentry.

Update: Compilation error is fixed in Xcode 15 Beta 3.

Warnings can be reproduced by doing the following:

  1. Create new project
  2. Add Sentry via SPM
  3. Build for device

Observe following warnings:

Ignoring duplicate library '-lc++'

Duplicate -rpath '/Users/denystelezhkin/Library/Developer/Xcode/DerivedData/Sentry-Xcode15-acagjnxhvucyzkbtgzttahdkqjvl/Build/Products/Debug-iphoneos/PackageFrameworks' ignored

Could not associate debug note to atom l_OBJC_LABEL_PROTOCOL_$__TtP13SentryPrivate23SentryMXManagerDelegate_
Could not associate debug note to atom l_OBJC_LABEL_PROTOCOL_$_MXMetricManagerSubscriber
Could not associate debug note to atom l_OBJC_LABEL_PROTOCOL_$_NSObject
Could not associate debug note to atom l_OBJC_PROTOCOL_REFERENCE_$__TtP13SentryPrivate23SentryMXManagerDelegate_
Could not associate debug note to atom l_OBJC_PROTOCOL_REFERENCE_$_MXMetricManagerSubscriber
Could not associate debug note to atom l_OBJC_PROTOCOL_REFERENCE_$_NSObject

However, if project setup is as follows: App -> Framework -> Sentry, warnings are the same, but there is now a compile error:

Assertion failed: ((targetAddr % extras.instrArm64.scale) == 0), function applyFixup, file Fixup.cpp, line 850.

This is probably an Xcode beta issue, and may be mitigated in future betas of Xcode 15, however as this is reproducible in two beta releases already, I wanted to file this issue for visibility, as there might be something i'm missing here.

Expected Result

Compilation succeeds

Actual Result

Compliation failed.

Are you willing to submit a PR?

Currently no, as I'm not certain how this issue can be fixed (and if this is a Sentry issue at all)

@brustolin
Copy link
Contributor

Thanks @DenTelezhkin for pointing this out. We're going to investigate.

@hubertdeng123
Copy link
Member

Removing the Waiting for: Product Owner label since this item looks like it is backlogged

@danmonaghan
Copy link

Interesting, I get a warning like this on another Swift package, Pusher Web Socket issue, however mine doesn't fail compliation.

@kahest kahest moved this from Needs Discussion to Needs Investigation in Mobile & Cross Platform SDK Jul 5, 2023
@DenTelezhkin
Copy link
Author

Update: Compilation error is fixed in Xcode 15 Beta 3. There are a ton of new warnings though, a lot of them about Sentry, now present not only on iOS, but on macOS as well.

@DenTelezhkin DenTelezhkin changed the title Compilation fails when using Xcode 15 Beta 1-2 Compilation warnings when using Xcode 15 Beta Jul 6, 2023
@philipphofmann
Copy link
Member

philipphofmann commented Jul 6, 2023

I can reproduce the issue by compiling an empty sample project that includes Sentry via SPM and compiling it for a plugged-in device. As you stated @DenTelezhkin, they are now compiler warnings with Xcode 15 Beta 3. We still have to investigate how we can fix these.

Build Warnings

ld: warning: ignoring duplicate library '-lc++'
ld: warning: duplicate -rpath '/Users/philipp.hofmann/Library/Developer/Xcode/DerivedData/SPM-gumhhehtvbtwtsapzzzrytpiduwa/Build/Products/Debug-iphoneos/PackageFrameworks' ignored
ld: warning: could not associate debug note to atom l_OBJC_LABEL_PROTOCOL_$__TtP13SentryPrivate23SentryMXManagerDelegate_
ld: warning: could not associate debug note to atom l_OBJC_LABEL_PROTOCOL_$_MXMetricManagerSubscriber
ld: warning: could not associate debug note to atom l_OBJC_LABEL_PROTOCOL_$_NSObject
ld: warning: could not associate debug note to atom l_OBJC_PROTOCOL_REFERENCE_$__TtP13SentryPrivate23SentryMXManagerDelegate_
ld: warning: could not associate debug note to atom l_OBJC_PROTOCOL_REFERENCE_$_MXMetricManagerSubscriber
ld: warning: could not associate debug note to atom l_OBJC_PROTOCOL_REFERENCE_$_NSObject
ld: warning: could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_NSObject
ld: warning: could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryIntegrationProtocol
ld: warning: could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryANRTrackerDelegate
ld: warning: could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentrySerializable
ld: warning: could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentrySystemEventBreadcrumbsDelegate
ld: warning: could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryCoreDataMiddleware
ld: warning: could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryCrashBinaryImageProvider
ld: warning: could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryCrashMachineContextWrapper
ld: warning: could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryCrashReportFilter
ld: warning: could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryScopeObserver
ld: warning: could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryCurrentDateProvider
ld: warning: could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryObjCRuntimeWrapper
ld: warning: could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryRateLimits
ld: warning: could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_NSCopying
ld: warning: could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryTransport
ld: warning: could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryEnvelopeRateLimitDelegate
ld: warning: could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryFileManagerDelegate
ld: warning: could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$__TtP13SentryPrivate23SentryMXManagerDelegate_
ld: warning: could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_NSURLSessionDelegate
ld: warning: could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryTracerDelegate
ld: warning: could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryRequestManager
ld: warning: could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryRandom
ld: warning: could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryClientAttachmentProcessor
ld: warning: could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentrySpan
ld: warning: could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryFramesTrackerListener

Ignoring duplicate library '-lc++'

Duplicate -rpath '/Users/philipp.hofmann/Library/Developer/Xcode/DerivedData/SPM-gumhhehtvbtwtsapzzzrytpiduwa/Build/Products/Debug-iphoneos/PackageFrameworks' ignored

Could not associate debug note to atom l_OBJC_LABEL_PROTOCOL_$__TtP13SentryPrivate23SentryMXManagerDelegate_
Could not associate debug note to atom l_OBJC_LABEL_PROTOCOL_$_MXMetricManagerSubscriber
Could not associate debug note to atom l_OBJC_LABEL_PROTOCOL_$_NSObject
Could not associate debug note to atom l_OBJC_PROTOCOL_REFERENCE_$__TtP13SentryPrivate23SentryMXManagerDelegate_
Could not associate debug note to atom l_OBJC_PROTOCOL_REFERENCE_$_MXMetricManagerSubscriber
Could not associate debug note to atom l_OBJC_PROTOCOL_REFERENCE_$_NSObject
Could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_NSObject
Could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryIntegrationProtocol
Could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryANRTrackerDelegate
Could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentrySerializable
Could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentrySystemEventBreadcrumbsDelegate
Could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryCoreDataMiddleware
Could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryCrashBinaryImageProvider
Could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryCrashMachineContextWrapper
Could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryCrashReportFilter
Could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryScopeObserver
Could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryCurrentDateProvider
Could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryObjCRuntimeWrapper
Could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryRateLimits
Could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_NSCopying
Could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryTransport
Could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryEnvelopeRateLimitDelegate
Could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryFileManagerDelegate
Could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$__TtP13SentryPrivate23SentryMXManagerDelegate_
Could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_NSURLSessionDelegate
Could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryTracerDelegate
Could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryRequestManager
Could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryRandom
Could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryClientAttachmentProcessor
Could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentrySpan
Could not associate debug note to atom __OBJC_LABEL_PROTOCOL_$_SentryFramesTrackerListener

@philipphofmann
Copy link
Member

From my understanding, the warning message "Ignoring duplicate library '-lc++'" in Xcode indicates that the linker is encountering multiple occurrences of the same library during the build process, which doesn't make sense to me. This warning typically occurs when the same library is included or linked multiple times in your Xcode project. My best guess is that with Xcode 15, they changed something about how they link SPM packages. As the error changed to a warning, we will watch this over the subsequent Xcode releases. At the moment, I don't think there is much we can do. Do you have any ideas, @armcknight or @brustolin?

@brustolin
Copy link
Contributor

brustolin commented Jul 6, 2023

I have a suspicion that I can't test right now.
Apple added C++ interoperability with Swift, which I think means they are adding C++ lib as default during compilation.
We also add C++ lib in our Package.swift, and maybe this is what's causing the duplication.

You may try to remove this from the package to see if it works. I would call this an Apple bug, they definitely should check for duplicity.

@DenTelezhkin
Copy link
Author

@brustolin I tried removing linker settings in my fork (https://github.com/DenTelezhkin/sentry-cocoa/tree/feature/xcode-15-spm-support), unfortunately, it did not help, warnings remain. I had a thought, that maybe because C++ language standard is included in Package.swift, Sentry and Xcode compiler use different C++ language versions, which causes a conflict. However, i cannot test this theory, as removing cxxLanguageStandard from Package.swift breaks Sentry compilation.

And I'm with you, definitely seems like an Apple bug at this moment.

@mezhevikin
Copy link

mezhevikin commented Jul 8, 2023

Hi guys. I don't use sentry-cocoa but I have the same warning in my project in Xcode 15 beta 3. I think it is a beta problem

@waydabber
Copy link

The issue persists in XCode 15 Beta 3.

@philipphofmann
Copy link
Member

@mezhevikin and @waydabber, do you get warnings or build errors?

We are aware that they are warnings, but as pointed out in #3122 (comment) and #3122 (comment), we assume the warnings could be bugs from Apple, and they might be resolved in future Xcode releases.

@philipphofmann
Copy link
Member

Warnings are still there for Xcode 15 Beta 4.

@AlexHadfield
Copy link

Xcode Beta Build Errors

These are the Sentry build errors I am seeing when trying to build a project in Xcode 15 Beta 4. It builds fine to the simulator, then fails when trying to build and install on a physical device. It might get resolved in a later beta. Just wanted to note it here.

@brustolin brustolin changed the title Compilation warnings when using Xcode 15 Beta Compilation warnings and errors when using Xcode 15 Beta Jul 19, 2023
@philipphofmann philipphofmann removed their assignment Jul 21, 2023
@jmanalang3
Copy link

jmanalang3 commented Jul 24, 2023

This warning showing on Xcode 15 beta 4.

@AlexHadfield
Copy link

This is still happening in Xcode Version 15.0 beta 5 (15A5209g)

@DenTelezhkin
Copy link
Author

Well, actually on Xcode 15 beta 5 much of the warnings have disappeared. There are only two warnings left:

Ignoring duplicate library '-lc++'
Ignoring duplicate library '-lz'

They appear in every binary Sentry is imported into.

@gongzhang
Copy link

Well, actually on Xcode 15 beta 5 much of the warnings have disappeared. There are only two warnings left:

Ignoring duplicate library '-lc++'
Ignoring duplicate library '-lz'

They appear in every binary Sentry is imported into.

+1.

https://developer.apple.com/forums/thread/733317

@brustolin
Copy link
Contributor

brustolin commented Jul 26, 2023

I could not reproduce Ignoring duplicate library '-lz' but I did get rid of Ignoring duplicate library '-lc++' by removing the following lines from Package.swift:

            linkerSettings: [
                .linkedLibrary("z"),
                .linkedLibrary("c++")
            ]

And I believe this will also solve the -lz duplication

@brustolin brustolin moved this from Needs Investigation to Backlog in Mobile & Cross Platform SDK Jul 26, 2023
@brustolin brustolin moved this from Backlog to In Progress in Mobile & Cross Platform SDK Jul 26, 2023
@AlexHadfield
Copy link

You guys aren't seeing this anymore? It's still appearing when I try and run on a physical device:
Screenshot 2023-07-27 at 10 27 48 AM
Screenshot 2023-07-27 at 10 27 34 AM

@brustolin
Copy link
Contributor

brustolin commented Jul 28, 2023

Hello @AlexHadfield, I just noticed your problem is for WatchOS.
I haven't try it yet. I will take a look next.

@soucolline
Copy link

@brustolin is this fix only for SPM ? Using cocoapods i'm still seeing the warning

@brustolin
Copy link
Contributor

@soucolline You're right, this was not changed for cocoapod yet. I will see if it is possible.

@brustolin
Copy link
Contributor

@soucolline this was fixed in #3312 and will be available in our next release.

@soucolline
Copy link

Thanks a lot for keeping me updated @brustolin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Archived in project
Development

Successfully merging a pull request may close this issue.