Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove duplicate codegen spec for video compression #305

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jpancotti
Copy link

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

- Removes RNVideoCompressorSpec from codegenConfig in package.json
- Resolves duplicate symbol issues during iOS builds (numandev1#293)
- Maintains full functionality including video compression on ios
@jpancotti
Copy link
Author

This PR solves issue #293

@numandev1
Copy link
Owner

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

@swissmanu
Copy link

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

@efstathiosntonas
Copy link

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"
       }
     ]
   }

@pierroo
Copy link

pierroo commented Nov 27, 2024

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!

@ogtfaber
Copy link

ogtfaber commented Nov 27, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants