Closed jingp-ofload closed 2 weeks ago
Guten Tag, Hans here! 🍻
It looks like you are facing a build issue with react-native-mmkv and RN 0.75, but I need more information to help you out. Could you please provide build logs from either Xcode (for iOS) or adb logcat (for Android)? This information is crucial for mrousavy to diagnose the problem.
Also, some details about your environment, like your OS version and any other relevant info, would be very helpful.
Let’s work together to resolve this!
Note: If you think I made a mistake, please ping
@mrousavy
to take a look.
I was built on MacOS Sonoma 14 with new architect of react native enabled. Here is the error log from Xcode
CompileC /Users/jpiao/Library/Developer/Xcode/DerivedData/OfloadTest-exegiqjrntpaexfsngstmdcdzwxa/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/react-native-mmkv.build/Objects-normal/arm64/NativeMmkvModule.o /Users/jpiao/Workspace/MOBILE-APP-2.0/node_modules/react-native-mmkv/cpp/NativeMmkvModule.cpp normal arm64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'react-native-mmkv' from project 'Pods')
cd /Users/jpiao/Workspace/MOBILE-APP-2.0/ios/Pods
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c++ -ivfsstatcache /Users/jpiao/Library/Developer/Xcode/DerivedData/SDKStatCaches.noindex/iphonesimulator17.5-21F77-c098706a9f71eba4e76ae92ab367209a.sdkstatcache -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -fno-color-diagnostics -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/Users/jpiao/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror\=non-modular-include-in-framework-module -Wno-trigraphs -Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wdocumentation -Wunreachable-code -Wno-implicit-atomic-properties -Werror\=deprecated-objc-isa-usage -Wno-objc-interface-ivars -Werror\=objc-root-class -Wno-arc-repeated-use-of-weak -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wdeprecated-implementations -Wno-c++11-extensions -Wno-implicit-fallthrough -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -Winvalid-offsetof -Wno-sign-conversion -Winfinite-recursion -Wmove -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wrange-loop-analysis -Wno-semicolon-before-method-body -Wunguarded-availability -index-store-path /Users/jpiao/Library/Developer/Xcode/DerivedData/OfloadTest-exegiqjrntpaexfsngstmdcdzwxa/Index.noindex/DataStore -Wno-comma -Wno-shorten-64-to-32 @/Users/jpiao/Library/Developer/Xcode/DerivedData/OfloadTest-exegiqjrntpaexfsngstmdcdzwxa/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/react-native-mmkv.build/Objects-normal/arm64/af3fcb34312c57c0f52879cdce924b91-common-args.resp -x objective-c++ -DRCT_NEW_ARCH_ENABLED\=1 -DFOLLY_NO_CONFIG -DFOLLY_MOBILE\=1 -DFOLLY_USE_LIBCPP\=1 -DFOLLY_CFG_NO_COROUTINES\=1 -DFOLLY_HAVE_CLOCK_GETTIME\=1 -Wno-comma -Wno-shorten-64-to-32 -include /Users/jpiao/Workspace/MOBILE-APP-2.0/ios/Pods/Target\ Support\ Files/react-native-mmkv/react-native-mmkv-prefix.pch -MMD -MT dependencies -MF /Users/jpiao/Library/Developer/Xcode/DerivedData/OfloadTest-exegiqjrntpaexfsngstmdcdzwxa/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/react-native-mmkv.build/Objects-normal/arm64/NativeMmkvModule.d --serialize-diagnostics /Users/jpiao/Library/Developer/Xcode/DerivedData/OfloadTest-exegiqjrntpaexfsngstmdcdzwxa/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/react-native-mmkv.build/Objects-normal/arm64/NativeMmkvModule.dia -c /Users/jpiao/Workspace/MOBILE-APP-2.0/node_modules/react-native-mmkv/cpp/NativeMmkvModule.cpp -o /Users/jpiao/Library/Developer/Xcode/DerivedData/OfloadTest-exegiqjrntpaexfsngstmdcdzwxa/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/react-native-mmkv.build/Objects-normal/arm64/NativeMmkvModule.o -index-unit-output-path /Pods.build/Debug-iphonesimulator/react-native-mmkv.build/Objects-normal/arm64/NativeMmkvModule.o
In file included from /Users/jpiao/Workspace/MOBILE-APP-2.0/node_modules/react-native-mmkv/cpp/NativeMmkvModule.cpp:8:
/Users/jpiao/Workspace/MOBILE-APP-2.0/node_modules/react-native-mmkv/cpp/NativeMmkvModule.h:24:83: error: use of undeclared identifier 'MmkvCxxMode'
std::optional<std::string>, std::optional<MmkvCxxMode>>;
^
/Users/jpiao/Workspace/MOBILE-APP-2.0/node_modules/react-native-mmkv/cpp/NativeMmkvModule.h:25:29: error: use of undeclared identifier 'MMKVConfig'
template <> struct Bridging<MMKVConfig> : MmkvCxxConfigurationBridging<MMKVConfig> {};
^
/Users/jpiao/Workspace/MOBILE-APP-2.0/node_modules/react-native-mmkv/cpp/NativeMmkvModule.h:25:72: error: use of undeclared identifier 'MMKVConfig'
template <> struct Bridging<MMKVConfig> : MmkvCxxConfigurationBridging<MMKVConfig> {};
^
/Users/jpiao/Workspace/MOBILE-APP-2.0/node_modules/react-native-mmkv/cpp/NativeMmkvModule.h:34:49: error: unknown type name 'MMKVConfig'
jsi::Object createMMKV(jsi::Runtime& runtime, MMKVConfig config);
^
In file included from /Users/jpiao/Workspace/MOBILE-APP-2.0/node_modules/react-native-mmkv/cpp/NativeMmkvModule.cpp:10:
/Users/jpiao/Workspace/MOBILE-APP-2.0/node_modules/react-native-mmkv/cpp/MmkvHostObject.h:20:41: error: no type named 'MMKVConfig' in namespace 'facebook::react'
MmkvHostObject(const facebook::react::MMKVConfig& config);
~~~~~~~~~~~~~~~~~^
/Users/jpiao/Workspace/MOBILE-APP-2.0/node_modules/react-native-mmkv/cpp/MmkvHostObject.h:28:54: error: no type named 'MMKVConfig' in namespace 'facebook::react'
static MMKVMode getMMKVMode(const facebook::react::MMKVConfig& config);
~~~~~~~~~~~~~~~~~^
/Users/jpiao/Workspace/MOBILE-APP-2.0/node_modules/react-native-mmkv/cpp/NativeMmkvModule.cpp:38:65: error: unknown type name 'MMKVConfig'
jsi::Object NativeMmkvModule::createMMKV(jsi::Runtime& runtime, MMKVConfig config) {
^
7 errors generated.
I have the same problem. Enable new architecture.
"react-native": "0.75.1"
"react-native-mmkv": "3.0.0-beta.7"
Same here, also with Android
"react-native": "0.75.1" "react-native-mmkv": "3.0.0-beta.7"
@mrousavy is there a possibility to check this one?
I recently upgraded my RN Android application to 75.1 with the new architecture enabled and I am also experiencing this issue. After looking into it a little bit it looks like it is a naming problem with the new CodeGen. For example, the MmkvCxxMode enum is now named NativeMmkvMode in the new CodeGen. After correcting the naming differences my app does build successfully. I spent maybe 15 minutes on this and have not fully re-tested my application, but I have included the patch in case someone else wants to use it or if it might help point @mrousavy in the right direction.
@davebray131 your solution works for me. Do you consider to make a PR?
@mrousavy is there a possibility to check this one?
At the moment I don't have free time. I think I'll create a $400 moneypool for this one, then I'll take a look.
Or if you create a PR then this is fixed @davebray131 - I can check that out, try it & do a release once I have free time though.
I will see if I can find time to generate a PR today. I have been using the patch since I made it and have not encountered any issues.
released in react-native-mmkv 3.0.2 :rocket:
If you appreciate me dedicating time to fix things and improve things here, please consider sponsoring me on GitHub 🙏
I've tried building a new Expo project with new architecture (npx create-expo-app@latest -e with-new-arch
) then following the installation instructions but keep getting build errors.
Here is the package.json
:
{
"scripts": {
"start": "expo start --dev-client",
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web"
},
"dependencies": {
"expo": "~51.0.24",
"expo-build-properties": "~0.12.4",
"expo-image": "~1.12.13",
"expo-linear-gradient": "~13.0.2",
"expo-splash-screen": "~0.27.5",
"expo-status-bar": "~1.12.1",
"react": "18.2.0",
"react-native": "0.74.3",
"react-native-mmkv": "^3.0.2"
},
"devDependencies": {
"@babel/core": "^7.20.0"
},
"name": "test",
"version": "1.0.0",
"private": true
}
Here's the build log: xcodebuild.log. Any ideas on why it's failing? I am on macOS 15, so that may be causing problems?