Sentry-react-native: iOS fails to build after setup with cocoa pods

Created on 11 Sep 2019  路  8Comments  路  Source: getsentry/sentry-react-native

OS:

  • [ ] Windows
  • [x] MacOS
  • [ ] Linux

_Platform:_

  • [x] iOS
  • [ ] Android

SDK:

  • [x] @sentry/react-native
  • [ ] react-native-sentry

react-native version: 0.59.10
xcode version 10.3

Init Code:

Sentry.init({
  dsn: '[email protected]/1234'
});

I have following issue:

I have installed react-native-sentry using cocoa pods I can run the app locally using the react-native cli, but if I try to build through xcode I the build fails due to:

ld: 294 duplicate symbols for architecture x86_64

Steps to reproduce:

Actual result:

  • Build fails with following output:
duplicate symbol _OBJC_IVAR_$_SentryUser._userId in:
    /Users/user/Library/Developer/Xcode/DerivedData/app-gsrsnnhwyiekueaappkouvpynhfx/Build/Products/Debug-iphonesimulator/libRNSentry.a(SentryUser.o)
    /Users/user/Library/Developer/Xcode/DerivedData/app-gsrsnnhwyiekueaappkouvpynhfx/Build/Products/Debug-iphonesimulator/Sentry/libSentry.a(SentryUser.o)
duplicate symbol _OBJC_IVAR_$_SentryUser._extra in:
    /Users/user/Library/Developer/Xcode/DerivedData/app-gsrsnnhwyiekueaappkouvpynhfx/Build/Products/Debug-iphonesimulator/libRNSentry.a(SentryUser.o)
    /Users/user/Library/Developer/Xcode/DerivedData/app-gsrsnnhwyiekueaappkouvpynhfx/Build/Products/Debug-iphonesimulator/Sentry/libSentry.a(SentryUser.o)
ld: 294 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Expected result:

  • It should build successfully

Most helpful comment

I had the same problem, but manged to figure out from the error messages that the duplicate symbols are related to some kind of caching that the iPhone simulator does.

so I opened ios/DerivedData/MYPROJECTNAME/Build/Products/Debug-iphonesimulator/ and deleted all files and folders that were related to Sentry. I ran the build again from XCode, and the error went away.

All 8 comments

+1

You can remove the reference from the Podfile, you should only do this if you intergrate it in a single view app.
The new SDK support autolinking which means you don't have to manually add it to the Podfile if you have a full react-native project.

@HazAT I have this same issue, but my Podfile has no reference to sentry. My Podfile.lock contains

...
  - RNSentry (1.0.4):
    - React
    - Sentry (~> 4.4.0)
  - Sentry (4.4.0):
    - Sentry/Core (= 4.4.0)
  - Sentry/Core (4.4.0)
...
DEPENDENCIES:
  - "RNSentry (from `../node_modules/@sentry/react-native`)"
...
SPEC REPOS:
  https://github.com/cocoapods/specs.git:
    - boost-for-react-native
    - Sentry
...
EXTERNAL SOURCES:
  RNSentry:
    :path: "../node_modules/@sentry/react-native"
...

Do you have by any change Sentry linked in your project in addition to having it in the Pods?
You need to fix your Xcode project to only include it once.

I had the same problem, but manged to figure out from the error messages that the duplicate symbols are related to some kind of caching that the iPhone simulator does.

so I opened ios/DerivedData/MYPROJECTNAME/Build/Products/Debug-iphonesimulator/ and deleted all files and folders that were related to Sentry. I ran the build again from XCode, and the error went away.

to add to my comment:

I was doing an update from React Native 0.59.10 to 0.60.5 and at the same time changed from react-native-sentry to @sentry/react-native.

It seems that it caused some old files to be cached by the iPhone simulator.

Agree @kristerkari - Clearing my IDEDerivedDataPathOverride directory did the trick.

Thanks for clarifying 馃憤
Closing.

Was this page helpful?
0 / 5 - 0 ratings