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

Build Error: Use of undeclared identifier 'SentryLog' #4339

Open
sof9816 opened this issue Sep 17, 2024 · 16 comments
Open

Build Error: Use of undeclared identifier 'SentryLog' #4339

sof9816 opened this issue Sep 17, 2024 · 16 comments

Comments

@sof9816
Copy link

sof9816 commented Sep 17, 2024

Platform

iOS

Environment

Develop

Installed

CocoaPods

Version

8.36.0

Xcode Version

16.0

Did it work on previous versions?

Yes

Steps to Reproduce

  1. Put Sentry Pods
  2. Pod Install
  3. Run Project
    Boom, not working

Expected Result

  1. Put Sentry Pods
  2. Pod Install
  3. Run Project
    Boom, working

Actual Result

Image
Image
Image

Are you willing to submit a PR?

No,

@brustolin
Copy link
Contributor

Hello @sof9816, thanks for reaching out.
I couldn't reproduce this issue.

Does this also happen to you when you start a new project and add Sentry?
If so, can you send us the test project?

@leandrofavarin
Copy link

I manage to reproduce this twice:

1- New Xcode 16 project, adding https://github.com/getsentry/sentry-cocoa.git as dependency and all its 3 modules: (regular, dynamic, and swiftui).

2- With your Kotlin Multiplatform dependency (https://github.com/getsentry/sentry-kotlin-multiplatform). Again, with Xcode 16, and importing it as the docs say through Cocoapods Gradle plugin.

@brustolin
Copy link
Contributor

brustolin commented Sep 17, 2024

Thank you very much for your response, I believe the problem is because you added all the targets.

If I got it right you're using SPM for method number 1.
Sentry and Sentry-Dynamic cannot be used together.
They are the same SDK with different linking.

Can you try adding just one of this two.

@leandrofavarin
Copy link

That works surely. However, that's not what's blocking me from using Xcode 16, as I mentioned merely as an example. My main issue is the example #2, with Kotlin Multiplatform. I am not sure if that would mean two different fixes -- if so, I'm happy to create a new issue on its repo.

@brustolin
Copy link
Contributor

I'm happy to create a new issue on its repo.

No need to, we can keep track of it in here.

@buenaflor Had you tried Xcode 16 already? Can you help us with this issue?

@buenaflor
Copy link
Contributor

I haven't tried xcode 16 yet, I'll have a look

@buenaflor
Copy link
Contributor

I'll try to get to this issue asap, I'm out for droidcon new york and the hotel internet is painfully slow for updating my mac and xcode..

@kahest
Copy link
Member

kahest commented Sep 18, 2024

This seems related: getsentry/sentry-react-native#4095 (comment)

@sof9816 @leandrofavarin can you verify if adding this fixes the issue for you?

    target.build_configurations.each do |config|
      if target.name != "Sentry"
        config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
      end
    end

@carloscuba
Copy link

@kahest, after applying the changes in the Podfile, still getting the Use of undeclared identifier 'SentryLog' error

@kahest
Copy link
Member

kahest commented Sep 18, 2024

@carloscuba thanks for testing and reporting back 🙏

@buenaflor
Copy link
Contributor

buenaflor commented Sep 18, 2024

which Kotlin version are you using for KMP?

https://youtrack.jetbrains.com/issue/KT-71287 this may be related

especially Most usually the issues are related to Kotlin/Native vendored and user-specified cinterops

and We support for Xcode 16 in 2.1.0 just quickly going through different threads, this issue might not necessarily be tied to Kotlin 2.1.0 (which is not out yet btw)

@leandrofavarin
Copy link

leandrofavarin commented Sep 18, 2024

@sof9816 @leandrofavarin can you verify if adding this fixes the issue for you?

Sadly it didn't change the result, and it seems like I got another error from this change:

Cannot find protocol declaration for 'SentryMXManagerDelegate'
• In file included from /~/MyPro/Pods/Sentry/Sources/Sentry/SentryMetricKitIntegration.m:1:

which Kotlin version are you using for KMP?

The latest 2.0.20, haven't tried the upcoming 2.0.21-RC with the fix yet.

@buenaflor
Copy link
Contributor

buenaflor commented Sep 18, 2024

@leandrofavarin could you try 2.1.0-Beta1

@leandrofavarin
Copy link

leandrofavarin commented Sep 18, 2024

@leandrofavarin could you try 2.1.0-Beta1

EDIT: I still get the same error (Use of undeclared identifier 'SentryLog')

@buenaflor
Copy link
Contributor

For testing, in Kotlin 2.0.20 can you compile your app with only using

cocopoads {
  // add sentry-cocoa
}

without the KMP dependency implementation("io.sentry...")

I want to find out if it is the KMP dependency that's breaking things or the cinterop through the cocoapods plugin

@leandrofavarin
Copy link

It still fails without the KMP dependency. To try that, I basically reverted to not using KMP and split the configuration from being on commonMain, to only on iosMain.

Kotlin v2.1.0-Beta1, Sentry 8.36.0 with extraOpts = listOf("-compiler-option", "-fmodules")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Waiting for: Product Owner
Status: Needs Investigation
Development

No branches or pull requests

6 participants