react-native-compressor
react-native-compressor copied to clipboard
Remove duplicate codegen spec for video compression
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
This PR solves issue #293
@jpancotti can you confirm if it has backward compatibility or not ?
I apply this change using yarn patch to our [email protected]-based app and I can confirm that the iOS build is working again.
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"
}
]
}
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!
Confirming I have the same issue after upgrading to Expo 52 (project is building after I apply the patch)
I am also facing the same issue when i upgraded to react native 0.76.3. It would be nice to merge this change
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.
@jpancotti thanks a lot
released in 1.10.0