question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

Goals

Integrate react native to an exist iOS native App . run npm i realm to add realm. run react-native link realm.

Expected Results

Integrate realm successfully.

Actual Results

From issues before, I can build RealmReact.xcodeproj now. But When build the total *.xcworkspace with Xcode, meet some errors.

Case 1:

Link realm by running react-native link realm, and build *.xcworkspace, met:

...
    /Users/OceanHorn/Library/Developer/Xcode/DerivedData/nmms-dqvajmmgqrijlhdzccxlxuxkvhkf/Build/Products/Debug-iphoneos/libRealmReact.a(sync_file-E8DF62E574C07A57.o)
duplicate symbol __ZN5realm15SyncFileManager20c_recovery_directoryE in:
    /Users/OceanHorn/Library/Developer/Xcode/DerivedData/nmms-dqvajmmgqrijlhdzccxlxuxkvhkf/Build/Products/Debug-iphoneos/libRealmReact.a(sync_file-E8DF62E574C07A57.o)
duplicate symbol __ZN5realm15SyncFileManager16c_sync_directoryE in:
    /Users/OceanHorn/Library/Developer/Xcode/DerivedData/nmms-dqvajmmgqrijlhdzccxlxuxkvhkf/Build/Products/Debug-iphoneos/libRealmReact.a(sync_file-E8DF62E574C07A57.o)
duplicate symbol __ZN5realm15SyncFileManager20c_metadata_directoryE in:
    /Users/OceanHorn/Library/Developer/Xcode/DerivedData/nmms-dqvajmmgqrijlhdzccxlxuxkvhkf/Build/Products/Debug-iphoneos/libRealmReact.a(sync_file-E8DF62E574C07A57.o)
...
duplicate symbol __ZN5realm19SyncMetadataManagerC2ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS_4util8OptionalINS1_6vectorIcS6_EEEE in:
    /Users/OceanHorn/Library/Developer/Xcode/DerivedData/nmms-dqvajmmgqrijlhdzccxlxuxkvhkf/Build/Products/Debug-iphoneos/libRealmReact.a(sync_metadata-231DCB0F6F3B43.o)
duplicate symbol __ZN5realm19SyncMetadataManagerC1ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS_4util8OptionalINS1_6vectorIcS6_EEEE in:
    /Users/OceanHorn/Library/Developer/Xcode/DerivedData/nmms-dqvajmmgqrijlhdzccxlxuxkvhkf/Build/Products/Debug-iphoneos/libRealmReact.a(sync_metadata-231DCB0F6F3B43.o)
duplicate symbol __ZN5realm16SyncUserMetadata14set_user_tokenENS_4util8OptionalINSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEEE in:
    /Users/OceanHorn/Library/Developer/Xcode/DerivedData/nmms-dqvajmmgqrijlhdzccxlxuxkvhkf/Build/Products/Debug-iphoneos/libRealmReact.a(sync_metadata-231DCB0F6F3B43.o)
ld: 53 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Case 2:

Link realm mannully, and build *.xcworkspace, met same error as case 1.

Case 3:

Do as case 1, then remove libRealmReact.a from Target -> General -> Linked Frameworks and Libraries and build. I can build normally, but when click to js module, met red screen:

Missing Realm constructor. Did you run "react-native link realm"? Please see https://realm.io/docs/javascript/latest/#missing-realm-constructor for troubleshooting

So, removing libRealmReact.a is not corrent.

Case 4:

Do as case 2, then remove as case 3. Same error occurs.

Is there any suggestions or solutions for this error?

Steps to Reproduce

As described before.

Code Sample

None.

Version of Realm and Tooling

2.1.1

  • Realm JS SDK Version: ?
  • Node or React Native: ? v9.3.0
  • Client OS & Version: ? latest
  • Which debugger for React Native: ? WebStorm

And, react native is supporting importing a dependency from pod with a Podfile file for iOS, is there any plan for realm?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
OceanHorncommented, Jan 18, 2018

@kneth I solved by adding a podspec file and install realm with cocoapods for realm version 2.1.1 and 2.0.13. But i don’t work on version 2.2.x, I will try and give a PR.

0reactions
bmunkholmcommented, Aug 19, 2019

Closing as outdated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Linker Command failed with exit code 1 (use - Stack Overflow
Just go project-> Build Phase->Link Binary with libraries Remove the old FrameWorks by click on minus button(-) And clean and Run again. It's ......
Read more >
clang: error: linker command faile… | Apple Developer Forums
The error I get is: clang: error: linker command failed with exit code 1 (use -v to see invocation). How should I go...
Read more >
clang: error: linker command failed with exit code 1 (use -v to ...
clang: error: linker command failed with exit code 1 (use -v to see invocation) · This means that you linked to something that...
Read more >
clang: error: linker command failed with exit code 1 (use -v to ...
CompilerResultsLog: clang: error: linker command failed with exit code 1 (use -v to see invocation) · When using BlueprintReadWrite , property ...
Read more >
clang: error: linker command failed with exit code 1 (use -v to ...
Check whether you have an outdated version of gettext and libintl*.dylib installed somewhere, perhaps in /usr/local/, possibly via a third-party ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found