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

[Bug] iOS build broken due to compiler errors in MMKVCore #372

Open
trcoffman opened this issue Jan 3, 2025 · 5 comments
Open

[Bug] iOS build broken due to compiler errors in MMKVCore #372

trcoffman opened this issue Jan 3, 2025 · 5 comments

Comments

@trcoffman
Copy link

Describe the bug
iOS builds suddenly started failing because of upstream publishing of new MMKV and MMKVCore to cocoapods.

To Reproduce
Steps to reproduce the behavior:

  1. Clone https://github.com/trcoffman/mmkv-build-issue
  2. Try to build it with npm run ios

Expected behavior
The app compiles

Logs


❌  (ios/Pods/MMKVCore/Core/MMKVLog.h:37:8)

  35 | 
  36 | extern MMKVLogLevel g_currentLogLevel;
> 37 | extern mmkv::LogHandler g_logHandler;
     |        ^ no type named 'LogHandler' in namespace 'mmkv::mmkv'; did you mean simply 'LogHandler'?
  38 | 
  39 | // enable logging
  40 | #define ENABLE_MMKV_LOG


❌  (ios/Pods/MMKVCore/Core/aes/AESCrypt.cpp:187:9)

  185 |     for (uint32_t size = 1; size < 6; size++) {
  186 |         auto holder = AESCrypt::randomItemSizeHolder(size);
> 187 |         MMKVInfo("holder 0x%x for size %u", holder, size);
      |         ^ no member named 'MMKVLogInfo' in namespace 'mmkv::mmkv'; did you mean simply 'MMKVLogInfo'?
  188 |     }
  189 | }
  190 | 


❌  (ios/Pods/MMKVCore/Core/aes/AESCrypt.cpp:192:16)

  190 | 
  191 | // check if AESCrypt is encrypt-decrypt full-duplex
> 192 | void AESCrypt::testAESCrypt() {
      |                ^ cannot define or redeclare 'testAESCrypt' here because namespace 'mmkv' does not enclose namespace 'AESCrypt'
  193 |     testRandomPlaceHolder();
  194 | 
  195 |     const uint8_t plainText[] = "Hello, OpenSSL-mmkv::AESCrypt::testAESCrypt() with AES CFB 128.";


❌  (ios/Pods/MMKVCore/Core/aes/AESCrypt.cpp:221:32)

  219 |     */
  220 |     AES_KEY decryptKey;
> 221 |     AES_set_decrypt_key(crypt1.m_key, AES_KEY_BITSET_LEN, &decryptKey);
      |                                ^ 'm_key' is a private member of 'mmkv::AESCrypt'
  222 | 
  223 |     size_t actualSize = 0;
  224 |     bool flip = false;


❌  (ios/Pods/MMKVCore/Core/aes/AESCrypt.cpp:243:33)

  241 | 
  242 |             decrypter = &crypt2;
> 243 |             oldNum = decrypter->m_number;
      |                                 ^ 'm_number' is a private member of 'mmkv::AESCrypt'
  244 |             memcpy(oldVector, decrypter->m_vector, sizeof(oldVector));
  245 |             crypt2.decrypt(encryptText + actualSize, decryptText + actualSize, size);
  246 |         } else {


❌  (ios/Pods/MMKVCore/Core/aes/AESCrypt.cpp:250:33)

  248 | 
  249 |             decrypter = &crypt1;
> 250 |             oldNum = decrypter->m_number;
      |                                 ^ 'm_number' is a private member of 'mmkv::AESCrypt'
  251 |             memcpy(oldVector, decrypter->m_vector, sizeof(oldVector));
  252 |             crypt1.decrypt(encryptText + actualSize, decryptText + actualSize, size);
  253 |         }


❌  (ios/Pods/MMKVCore/Core/aes/AESCrypt.cpp:255:23)

  253 |         }
  254 |         // that's why AESCrypt can be full-duplex
> 255 |         assert(crypt1.m_number == crypt2.m_number);
      |                       ^ 'm_number' is a private member of 'mmkv::AESCrypt'
  256 |         assert(0 == memcmp(crypt1.m_vector, crypt2.m_vector, sizeof(crypt1.m_vector)));
  257 | 
  258 |         // how rollback works


❌  (ios/Pods/MMKVCore/Core/aes/AESCrypt.cpp:255:42)

  253 |         }
  254 |         // that's why AESCrypt can be full-duplex
> 255 |         assert(crypt1.m_number == crypt2.m_number);
      |                                          ^ 'm_number' is a private member of 'mmkv::AESCrypt'
  256 |         assert(0 == memcmp(crypt1.m_vector, crypt2.m_vector, sizeof(crypt1.m_vector)));
  257 | 
  258 |         // how rollback works


❌  (ios/Pods/MMKVCore/Core/aes/AESCrypt.cpp:267:5)

  265 |         ptr += size;
  266 |     }
> 267 |     MMKVInfo("AES CFB decode: %s", decryptText);
      |     ^ no member named 'MMKVLogInfo' in namespace 'mmkv::mmkv'; did you mean simply 'MMKVLogInfo'?
  268 | 
  269 |     delete[] encryptText;
  270 |     delete[] decryptText;


❌  (ios/Pods/MMKVCore/Core/aes/AESCrypt.cpp:276:20)

  274 | #endif     // MMKV_DISABLE_CRYPT
  275 | 
> 276 | } // namespace mmkv
      |                    ^ expected '}'
  277 | 

Platform Information:

  • OS: iOS
  • React Native Version: Confirmed issue on both 0.75 and 0.76
  • Library Version: 0.11.2
@trcoffman
Copy link
Author

If you use expo with CNG, you can work around it like this:

In the plugins section of your app.config.js use expo-build-properties to pin MMKV and MMKVCore pods:

    [
      'expo-build-properties',
      {
        ios: {
          extraPods: [
            {
              name: 'MMKV',
              version: '1.3.9',
            },
            {
              name: 'MMKVCore',
              version: '1.3.9',
            },
          ],
        },
      },
    ],

If you use a bare RN workflow, put this in your Podfile.

pod 'MMKV', '1.3.9'
pod 'MMKVCore', '1.3.9'

@alexkey89
Copy link

If you use expo with CNG, you can work around it like this:

In the plugins section of your app.config.js use expo-build-properties to pin MMKV and MMKVCore pods:

    [
      'expo-build-properties',
      {
        ios: {
          extraPods: [
            {
              name: 'MMKV',
              version: '1.3.9',
            },
            {
              name: 'MMKVCore',
              version: '1.3.9',
            },
          ],
        },
      },
    ],

If you use a bare RN workflow, put this in your Podfile.

pod 'MMKV', '1.3.9'
pod 'MMKVCore', '1.3.9'

same issue. is the only solution downgrading?

@LoyaltyWu
Copy link

Same thing also happen in MMKV_iOS flutter plugin. I think it has something to do with the MMKV pod / MMKVCore pod

@heritvithalani19
Copy link

heritvithalani19 commented Jan 6, 2025

Xcode: 16.2
mmkv: "react-native-mmkv-storage": "0.10.2",
RN version: 0.71.19

The same issue also occurs with the MMKV_iOS React Native plugin. I believe it might be related to the MMKV pod or the MMKVCore pod.

@vokhuyetOz
Copy link

Tencent/MMKV#1468

i related to this one

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

No branches or pull requests

5 participants