Search code examples
iosxcodereact-nativerealmrealm-js

RealmJS: clang: error: linker command failed with exit code 1 (use -v to see invocation)


I have no idea how to get around to fixing this.

I have a feeling it might be related to RealmJS but i have tried everything from their issues page on github.

I have tried, downgrading Realm, cleaning the project, restart xcode, restart the whole computer, I even removed the pods and lockfile end reinstalled the pods. and yes i am using the .xworkspace file

177 more errors
... 
duplicate symbol _OBJC_IVAR_$_GCDWebServerURLEncodedFormRequest._arguments in:
    /Users/henk/Library/Developer/Xcode/DerivedData/WhosThat_app-axxkmftwrprdsnaxtynfzrtgsvca/Build/Products/Debug-iphonesimulator/libGCDWebServers.a(GCDWebServerURLEncodedFormRequest.o)
    /Users/henk/Library/Developer/Xcode/DerivedData/WhosThat_app-axxkmftwrprdsnaxtynfzrtgsvca/Build/Products/Debug-iphonesimulator/libRealmReact.a(GCDWebServerURLEncodedFormRequest.o)
ld: 177 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

React-native: 0.59.8

Realm: 3.2.0, 3.1.0 , 2.8.0

Xcode: 10.1


Solution

  • This is a linking error with RealmJS. You might find it easier to use RealmJS 3.4.0 or higher as these versions now include CocoaPods which handle all the linking for you. I had the same issue and unfortunately I could not fix it on lower versions of RealmJS but upgrading to RealmJS 3.4.2 and using CocoaPods to link the library fixed it for me.