react-native-compressor icon indicating copy to clipboard operation
react-native-compressor copied to clipboard

Remove duplicate codegen spec for video compression

Open jpancotti opened this issue 1 year ago • 2 comments

Summary

This PR addresses an issue where iOS builds were failing due to duplicate symbols. The root cause was traced to the presence of two separate codegen specs in the package.json file: RNCompressorSpec and RNVideoCompressorSpec.

It appears that the RNCompressorSpec is sufficient to generate the necessary native code for both image and video compression. The separate RNVideoCompressorSpec was causing duplication in the generated code, leading to build failures.

This change simplifies the package configuration without compromising functionality. It's recommended to thoroughly test this change across different React Native versions and build configurations to ensure there are no unintended side effects.

Changelog

  • Removed the RNVideoCompressorSpec entry from the codegenConfig in package.json

Test Plan

  • Tested iOS builds before and after the change using React Native 74.0
  • Verified that image and video compression still work as expected

jpancotti avatar Aug 21 '24 05:08 jpancotti

This PR solves issue #293

jpancotti avatar Aug 21 '24 05:08 jpancotti

@jpancotti can you confirm if it has backward compatibility or not ?

numandev1 avatar Sep 11 '24 08:09 numandev1

I apply this change using yarn patch to our [email protected]-based app and I can confirm that the iOS build is working again.

swissmanu avatar Oct 30 '24 10:10 swissmanu

For those who can't wait, here's a patch-package:

react-native-compressor+1.9.0.patch

diff --git a/node_modules/react-native-compressor/package.json b/node_modules/react-native-compressor/package.json
index 8adf7dc..8dd43a6 100644
--- a/node_modules/react-native-compressor/package.json
+++ b/node_modules/react-native-compressor/package.json
@@ -197,11 +197,6 @@
         "name": "RNCompressorSpec",
         "type": "modules",
         "jsSrcsDir": "src"
-      },
-      {
-        "name": "RNVideoCompressorSpec",
-        "type": "modules",
-        "jsSrcsDir": "src"
       }
     ]
   }

efstathiosntonas avatar Nov 01 '24 13:11 efstathiosntonas

any plan on merging it soon? that would be amazing. thank you for the patch on the other hand!

On the other hand, I almost having 6 duplicate symbols, and when I export the logs I see:

duplicate symbol '__ZN8facebook5react23NativeCompressorSpecJSIC2ERKNS0_15ObjCTurboModule10InitParamsE' in: /Users/pierre/Library/Developer/Xcode/DerivedData/lovli-falxmayvtfaklldkcrqutzuluupp/Build/Products/Debug-iphonesimulator/ReactCodegen/ReactCodegen.framework/ReactCodegen61 /Users/pierre/Library/Developer/Xcode/DerivedData/lovli-falxmayvtfaklldkcrqutzuluupp/Build/Products/Debug-iphonesimulator/ReactCodegen/ReactCodegen.framework/ReactCodegen39 duplicate symbol 'OBJC_METACLASS$_NativeCompressorSpecBase' in: /Users/pierre/Library/Developer/Xcode/DerivedData/lovli-falxmayvtfaklldkcrqutzuluupp/Build/Products/Debug-iphonesimulator/ReactCodegen/ReactCodegen.framework/ReactCodegen61 /Users/pierre/Library/Developer/Xcode/DerivedData/lovli-falxmayvtfaklldkcrqutzuluupp/Build/Products/Debug-iphonesimulator/ReactCodegen/ReactCodegen.framework/ReactCodegen39 duplicate symbol 'OBJC_CLASS$_NativeCompressorSpecBase' in: /Users/pierre/Library/Developer/Xcode/DerivedData/lovli-falxmayvtfaklldkcrqutzuluupp/Build/Products/Debug-iphonesimulator/ReactCodegen/ReactCodegen.framework/ReactCodegen61 /Users/pierre/Library/Developer/Xcode/DerivedData/lovli-falxmayvtfaklldkcrqutzuluupp/Build/Products/Debug-iphonesimulator/ReactCodegen/ReactCodegen.framework/ReactCodegen39 duplicate symbol '__ZN8facebook5react23NativeCompressorSpecJSIC1ERKNS0_15ObjCTurboModule10InitParamsE' in: /Users/pierre/Library/Developer/Xcode/DerivedData/lovli-falxmayvtfaklldkcrqutzuluupp/Build/Products/Debug-iphonesimulator/ReactCodegen/ReactCodegen.framework/ReactCodegen61 /Users/pierre/Library/Developer/Xcode/DerivedData/lovli-falxmayvtfaklldkcrqutzuluupp/Build/Products/Debug-iphonesimulator/ReactCodegen/ReactCodegen.framework/ReactCodegen39 duplicate symbol '__ZN8facebook5react25RNCViewPagerComponentNameE' in: /Users/pierre/Library/Developer/Xcode/DerivedData/lovli-falxmayvtfaklldkcrqutzuluupp/Build/Products/Debug-iphonesimulator/ReactCodegen/ReactCodegen.framework/ReactCodegen68 /Users/pierre/Library/Developer/Xcode/DerivedData/lovli-falxmayvtfaklldkcrqutzuluupp/Build/Products/Debug-iphonesimulator/react-native-pager-view/react_native_pager_view.framework/react_native_pager_view15 duplicate symbol 'OBJC_IVAR$_NativeCompressorSpecBase._eventEmitterCallback' in: /Users/pierre/Library/Developer/Xcode/DerivedData/lovli-falxmayvtfaklldkcrqutzuluupp/Build/Products/Debug-iphonesimulator/ReactCodegen/ReactCodegen.framework/ReactCodegen61 /Users/pierre/Library/Developer/Xcode/DerivedData/lovli-falxmayvtfaklldkcrqutzuluupp/Build/Products/Debug-iphonesimulator/ReactCodegen/ReactCodegen.framework/ReactCodegen39 ld: 6 duplicate symbols

should I further edit the package.json? Your help would be very appreciated :)

EDIT: actually the patch wasn't taken into account for some reason; had to rimraf my node module, reinstall and all good, thanks guys!

pierroo avatar Nov 27 '24 15:11 pierroo

Confirming I have the same issue after upgrading to Expo 52 (project is building after I apply the patch)

ogtfaber avatar Nov 27 '24 16:11 ogtfaber

I am also facing the same issue when i upgraded to react native 0.76.3. It would be nice to merge this change

NamithaRavy avatar Dec 02 '24 13:12 NamithaRavy

Had the same issue with react 0.76.1. This PR should be merged as soon as possible so that we can avoid build errors.

shikhinee avatar Dec 02 '24 14:12 shikhinee

@jpancotti thanks a lot

numandev1 avatar Dec 04 '24 05:12 numandev1

released in 1.10.0

numandev1 avatar Dec 04 '24 06:12 numandev1