Lỗi 1 duplicate symbol for architecture x86_64 năm 2024

Yeah, we're late to the party and still using the old build system. Although when trying to use the new one, the same error still happens and it doesn't build. ld: 90 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

❌ Manually removing conflics in

ld: 90 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

2:

We've tried to manually remove conflicting links on a ld: 90 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

3 in our ld: 90 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

2. The script looks as below.

The links were removed but that solution does not work. Same error happens (duplicate symbols for architecture x86_64). post_install do |installer| installer.pods_project.targets.each do |target| if %w(RNScreens RNCMaskedView react-native-safe-area-context).include?(target.name) target.remove_from_project end end end

❌ Disabling

ld: 90 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

5 for conflicting dependencies on ld: 90 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

6:

By disabling React Native's autolink for the conflicting dependencies in ld: 90 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

6 file, the project still does not build, and a new error appears. module.exports = { dependencies: { ..., '@react-native-community/masked-view': { platforms: { ios: null, }, }, 'react-native-safe-area-context': { platforms: { ios: null, }, }, 'react-native-screens': { platforms: { ios: null, }, }, }, };

A new error happens when trying to build: ld: library not found for -lRNCMaskedView clang: error: linker command failed with exit code 1 (use -v to see invocation)

❌ Removing conflicting dependencies from

ld: 90 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

8:

By removing the conflicting dependencies below from ld: 90 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

8 and re-installing our modules and pods (by running the commands below). yarn remove @react-native-community/masked-view react-native-screens react-native-safe-area-context rm -rf node_modules yarn.lock yarn install cd ios rm -rf Podfile.lock Pods pod install

build on XCode

On this repository, the project builds and works correctly! But I guess this happens since we don't really use these dependencies here (they were just installed via post_install do |installer| installer.pods_project.targets.each do |target| if %w(RNScreens RNCMaskedView react-native-safe-area-context).include?(target.name) target.remove_from_project end end end

0). On our project another error happens during build, since we actually import and use these dependencies: ld: library not found for -lRNCMaskedView clang: error: linker command failed with exit code 1 (use -v to see invocation)

❌ Tinkering with XCode build settings:

We've tried to change a few XCode build settings as mentioned in a few Stack Overflow posts, but none of them worked.

  • ❗ Removing

    post_install do |installer| installer.pods_project.targets.each do |target| if %w(RNScreens RNCMaskedView react-native-safe-area-context).include?(target.name) target.remove_from_project end end end

    1 flag

    post_install do |installer| installer.pods_project.targets.each do |target| if %w(RNScreens RNCMaskedView react-native-safe-area-context).include?(target.name) target.remove_from_project end end end

    2 in XCode

    post_install do |installer| installer.pods_project.targets.each do |target| if %w(RNScreens RNCMaskedView react-native-safe-area-context).include?(target.name) target.remove_from_project end end end

    3: It builds! But doesn't work as stated in its topic below.
  • 😵 Setting

    post_install do |installer| installer.pods_project.targets.each do |target| if %w(RNScreens RNCMaskedView react-native-safe-area-context).include?(target.name) target.remove_from_project end end end

    4 to

    post_install do |installer| installer.pods_project.targets.each do |target| if %w(RNScreens RNCMaskedView react-native-safe-area-context).include?(target.name) target.remove_from_project end end end

    5 under

    post_install do |installer| installer.pods_project.targets.each do |target| if %w(RNScreens RNCMaskedView react-native-safe-area-context).include?(target.name) target.remove_from_project end end end

    3.
  • 😵 Setting

    post_install do |installer| installer.pods_project.targets.each do |target| if %w(RNScreens RNCMaskedView react-native-safe-area-context).include?(target.name) target.remove_from_project end end end

    7 to

    post_install do |installer| installer.pods_project.targets.each do |target| if %w(RNScreens RNCMaskedView react-native-safe-area-context).include?(target.name) target.remove_from_project end end end

    5 under

    post_install do |installer| installer.pods_project.targets.each do |target| if %w(RNScreens RNCMaskedView react-native-safe-area-context).include?(target.name) target.remove_from_project end end end

    3.
  • 😵 Running in production and debug modes.
  • 😵 Removing

    module.exports = { dependencies: { ..., '@react-native-community/masked-view': { platforms: { ios: null, }, }, 'react-native-safe-area-context': { platforms: { ios: null, }, }, 'react-native-screens': { platforms: { ios: null, }, }, }, };

    0 under

    module.exports = { dependencies: { ..., '@react-native-community/masked-view': { platforms: { ios: null, }, }, 'react-native-safe-area-context': { platforms: { ios: null, }, }, 'react-native-screens': { platforms: { ios: null, }, }, }, };

    1.
  • 😵 Removing duplicated (there were none) items in

    module.exports = { dependencies: { ..., '@react-native-community/masked-view': { platforms: { ios: null, }, }, 'react-native-safe-area-context': { platforms: { ios: null, }, }, 'react-native-screens': { platforms: { ios: null, }, }, }, };

    2 under

    module.exports = { dependencies: { ..., '@react-native-community/masked-view': { platforms: { ios: null, }, }, 'react-native-safe-area-context': { platforms: { ios: null, }, }, 'react-native-screens': { platforms: { ios: null, }, }, }, };

    1.
  • 😵 Removing duplicated (there were none) libraries in

    module.exports = { dependencies: { ..., '@react-native-community/masked-view': { platforms: { ios: null, }, }, 'react-native-safe-area-context': { platforms: { ios: null, }, }, 'react-native-screens': { platforms: { ios: null, }, }, }, };

    4 folder in XCode.

❓ Removing

post_install do |installer| installer.pods_project.targets.each do |target| if %w(RNScreens RNCMaskedView react-native-safe-area-context).include?(target.name) target.remove_from_project end end end

1 flag in post_install do |installer| installer.pods_project.targets.each do |target| if %w(RNScreens RNCMaskedView react-native-safe-area-context).include?(target.name) target.remove_from_project end end end

2 under XCode's post_install do |installer| installer.pods_project.targets.each do |target| if %w(RNScreens RNCMaskedView react-native-safe-area-context).include?(target.name) target.remove_from_project end end end

3:

By removing post_install do |installer| installer.pods_project.targets.each do |target| if %w(RNScreens RNCMaskedView react-native-safe-area-context).include?(target.name) target.remove_from_project end end end

1 flag from post_install do |installer| installer.pods_project.targets.each do |target| if %w(RNScreens RNCMaskedView react-native-safe-area-context).include?(target.name) target.remove_from_project end end end

2 (located in post_install do |installer| installer.pods_project.targets.each do |target| if %w(RNScreens RNCMaskedView react-native-safe-area-context).include?(target.name) target.remove_from_project end end end

  1. on XCode, the project builds!

...but it immediately force-closes after opening 😞. The error below pops up. *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[RCTRootView setReactTag:]: unrecognized selector sent to instance 0x7f84f6e10f40' terminating with uncaught exception of type NSException abort() called CoreSimulator 681.17.2 - Device: iPhone 11 (0974E59B-9AA8-4E0B-915D-A083AB917955) - Runtime: iOS 13.3 (17C45) - DeviceType: iPhone 11

When looking at the exception that caused the app to crash with Mac OS ld: library not found for -lRNCMaskedView clang: error: linker command failed with exit code 1 (use -v to see invocation)

1: 2020-01-17 14:35:13.414 [info][tid:main][RCTBridge.m:145] Class EXDisabledRedBox was not exported. Did you forget to use RCT_EXPORT_MODULE()?

Apparently, post_install do |installer| installer.pods_project.targets.each do |target| if %w(RNScreens RNCMaskedView react-native-safe-area-context).include?(target.name) target.remove_from_project end end end

1 is necessary to correctly build all the dependencies.

❌ Add React dependencies to

ld: 90 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

2:

When seeing the error above, while still without post_install do |installer| installer.pods_project.targets.each do |target| if %w(RNScreens RNCMaskedView react-native-safe-area-context).include?(target.name) target.remove_from_project end end end

1 flag in post_install do |installer| installer.pods_project.targets.each do |target| if %w(RNScreens RNCMaskedView react-native-safe-area-context).include?(target.name) target.remove_from_project end end end

2 under XCode's post_install do |installer| installer.pods_project.targets.each do |target| if %w(RNScreens RNCMaskedView react-native-safe-area-context).include?(target.name) target.remove_from_project end end end

3, we've tried adding the missing pods as described above ( ld: library not found for -lRNCMaskedView clang: error: linker command failed with exit code 1 (use -v to see invocation)

  1. in our

ld: 90 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

2:

Chủ đề