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

[v2] fix: set NDEBUG=1 preprocessor flag in release mode #2270

Merged
merged 1 commit into from
Dec 11, 2023

Conversation

tomekzaw
Copy link
Contributor

@tomekzaw tomekzaw commented Dec 8, 2023

What

This PR fixes the following error reported in #2265 that occurs when trying to build a RN app with Reanimated 3.6.x and RNVisionCamera 2.16.5 with Frame Processors enabled in release mode on iOS on Paper:

Undefined symbols for architecture x86_64:
  "reanimated::getCallGuard(facebook::jsi::Runtime&)", referenced from:
      void reanimated::WorkletRuntime::runGuarded<facebook::jsi::Object&>(std::__1::shared_ptr<reanimated::ShareableWorklet> const&, facebook::jsi::Object&) const in libVisionCamera.a(FrameProcessorRuntimeManager.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The root cause of this issue is that Reanimated 3.6.0 uses a well-known NDEBUG flag but unfortunately React Native does not set it on iOS on Paper (it is set correctly on Fabric, though). The workaround is to set environmental variable PRODUCTION=1 when running pod install (so that RNReanimated.podspec knows that it should inject NDEBUG flag) but this flag is not well-documented so many people don't know about it.

Changes

  • Added NDEBUG=1 flag to GCC_PREPROCESSOR_DEFINITIONS for Release variant in VisionCamera.podspec

Tested on

I reproduced the error on a fresh RN 0.72.7 app with Reanimated 3.6.0 and RNVisionCamera 2.16.5 on iOS in release mode. Then I made the change in VisionCamera's podspec and the error was gone.

Related issues

Fixes #2265.

See software-mansion/react-native-reanimated#5366 for full explanation.

Copy link

vercel bot commented Dec 8, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-native-vision-camera ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 8, 2023 9:08pm

@tomekzaw tomekzaw changed the title Set NDEBUG=1 preprocessor flag in release mode [v2] Set NDEBUG=1 preprocessor flag in release mode Dec 8, 2023
@tomekzaw tomekzaw changed the title [v2] Set NDEBUG=1 preprocessor flag in release mode [v2] fix: set NDEBUG=1 preprocessor flag in release mode Dec 8, 2023
@mrousavy
Copy link
Owner

You're the 🐐! LGTM thanks Tomasz! ❤️

@mrousavy mrousavy merged commit 83abb08 into mrousavy:v2 Dec 11, 2023
4 checks passed
@tomekzaw tomekzaw deleted the patch-1 branch December 12, 2023 07:16
@tomekzaw
Copy link
Contributor Author

@mrousavy Thanks for merging this PR! Would it be possible to publish a new v2 release with this fix?

@mrousavy
Copy link
Owner

Sorry, went for lunch & forgot haha - just released 2.16.5! :)

thanks again!

@tomekzaw
Copy link
Contributor Author

Thank you on behalf of the entire community!

j-piasecki pushed a commit to j-piasecki/react-native-vision-camera that referenced this pull request Feb 12, 2024
…2270)

Set `NDEBUG=1` preprocessor flag in release mode
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.

2 participants