Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't merge user_target_xcconfig for pod targets: ["Reanimated", "hermes-engine"]. Singular build setting CLANG_CXX_LIBRARY has different values

I've been running "pod install" in my project to connect my dependencies but I've been getting this error: Can't merge user_target_xcconfig for pod targets: ["Reanimated", "hermes-engine"] Singular build setting CLANG_CXX_LIBRARY has different values. everytime I run pod. I tried to work around this error, I've deleted and reinstalled all pod files as well but no luck.

Wondering if anyone found a solution for this ?

like image 869
Relie Essom Avatar asked Sep 07 '25 03:09

Relie Essom


2 Answers

Happy update! reanimated 2.10.0 is released now, and it appears to have the required patch according to a timely comment from @Lauri-Harpf - 2.10.0 also contains pre-built libs (as required by reanimated 2.x) for react-native 0.70.x so this answer is largely obsolete, but in a good way. Go grab the new release and give a star to the repo + support Software Mansion if you can, as they do a great job on the module. Cheers

Mostly obsolete answer follows:


react-native 0.69

It appears the answer is to update react-native-reanimated in order for it to be more compatible with react-native 0.69

There is not an official release with it for react-native 0.69 (for react-native 0.70 see below), but patch-package may be used to integrate a fix as described here:

https://github.com/software-mansion/react-native-reanimated/issues/3326#issuecomment-1225057452

(basically, you forcefully alter the C++ language standard reanimated uses by altering it's podspec file to be the one Hermes wants, using patch-package to do the whole thing cleanly.

diff --git a/node_modules/react-native-reanimated/RNReanimated.podspec b/node_modules/react-native-reanimated/RNReanimated.podspec
index d53cb12..719f813 100644
--- a/node_modules/react-native-reanimated/RNReanimated.podspec
+++ b/node_modules/react-native-reanimated/RNReanimated.podspec
@@ -94,7 +94,7 @@ Pod::Spec.new do |s|
   }
   s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
   s.xcconfig               = {
-    "CLANG_CXX_LANGUAGE_STANDARD" => "c++14",
+    "CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
     "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/glog\" \"$(PODS_ROOT)/#{folly_prefix}Folly\" \"${PODS_ROOT}/Headers/Public/React-hermes\" \"${PODS_ROOT}/Headers/Public/hermes-engine\"",
                                "OTHER_CFLAGS" => "$(inherited)" + " " + folly_flags  }

react-native 0.70

For react-native 0.70, you need to use the 3.x versions of react-native-reanimated, which do not have an official release as of this writing.

You do that by installing the react-native-reanimated@next version, for example as yarn add react-native-reanimated@next, then pod install and the error should be gone.

like image 182
Mike Hardy Avatar answered Sep 09 '25 16:09

Mike Hardy


Simple Answer is Just set the CXX n the podspec.

node_modules/react-native-reanimated/RNReanimated.podspec

Change to:

"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",

Credits => https://github.com/Shopify/react-native-skia/issues/405#issuecomment-1244302303

like image 30
Rehan Shakir Avatar answered Sep 09 '25 16:09

Rehan Shakir