clang: error: linker command failed with exit code 1 (use -v to see invocation)
See original GitHub issueGoals
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:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
@kneth I solved by adding a podspec file and install realm with cocoapods for realm version
2.1.1
and2.0.13
. But i don’t work on version2.2.x
, I will try and give a PR.Closing as outdated.