Acknowledged

Critical Error for Monkey C Compiler with Mac OS Apple M Series and Java ARM64 JRE

I just set up Monkey C on the new MacBook Pro with the Apple M4 Pro chip (Nov 2024), which requires the ARM64 JRE version of Java.

The Monkey C installation verification was successful, but when I tried to run my app, I received a critical error referring to the Java CodeCache (see below).

When I run Build Current Project for the same device again, the error message is shorter. If I run it for a different device, I get the longer error message again.

It was also strange that I was prompted to select a debugger even though I selected "Run Without Debugging". The same error occurs with "Start Debugging".

The error message says to re-run the Monkey C Compiler with logging enabled, but I do not know how to do that.

This error is preventing me from running any code at all.

How can this be fixed?

Here's my setup:
Model: MacBook Pro 14 inch Nov 2024
Chip: Apple M4 Pro
OS: Sequoia 15.1.1

Here's what I did:

Download and install ConnectIQ SDK Manager
Download and install VS Code
Download and install Java ARM64 JRE (for Mac M series system)
Install Monkey C extension in VS Code
Run: Monkey C: Verify Installation - received message saying installation was verified
Run: Run Without Debugging - prompted to specify debugger (is this supposed to happen?)
Select Monkey C as debugger
Select device (arbitrary, e.g., vivoactive5)
Received error below:

Java HotSpot(TM) 64-Bit Server VM warning: CodeCache is full. Compiler has been disabled.
Java HotSpot(TM) 64-Bit Server VM warning: Try increasing the code cache size using -XX:ReservedCodeCacheSize=
WARNING: vivoactive5: The launcher icon (30x30) isn't compatible with the specified launcher icon size of the device 'vivoactive5' (70x70). Image will be scaled to the target size.
ERROR: vivoactive5: A critical error has occurred. Please re-run the Monkey C Compiler with logging enabled and file a report with the Connect IQ support team.
CodeCache: size=131072Kb used=10901Kb max_used=10901Kb free=120170Kb
bounds [0x000000010a1f8000, 0x000000010acb8000, 0x00000001121f8000]
total_blobs=3357 nmethods=2858 adapters=412
compilation: disabled (not enough contiguous free space left)

* The terminal process terminated with exit code: 100.

Run: Monkey C: Build Current Project
Select vivoactive5 as device (same as before)
Received shorter error below:

WARNING: vivoactive5: The launcher icon (30x30) isn't compatible with the specified launcher icon size of the device 'vivoactive5' (70x70). Image will be scaled to the target size.
ERROR: vivoactive5: A critical error has occurred. Please re-run the Monkey C Compiler with logging enabled and file a report with the Connect IQ support team.

* The terminal process terminated with exit code: 100.

Run: Monkey C: Build Current Project
Select a different device
Received initial error again (except for newly selected device)

  • Culprit has been identified (one of them, anyway). The critical error was due to an apostrophe being in the project path. In my case, I had put my project folder in the main Documents directory, and when I started syncing with iCloud, the name was automatically changed to include an apostrophe to specify which device it was from ("Documents - Lisa's MacBook Pro"). It was straightforward to remove the apostrophe, and the extension worked after that.

    According to the email I got from the ConnectIQ team, a fix should be released soon, but in the meantime, it worked for me to just remove the apostrophe from the project path. I can finally run my code!!

    However, like Sergey said, I am still getting the CodeCache issue as a warning (not an error), but it only appears the first time I build a given device. When I build the project again for the same device, the warning is gone.

  • I have a similar problem on a M3 Pro MacBook (macOS 15.1.1, JRE 1.8.0_431-b10, Java HotSpot 64-Bit Server VM 25.431-b10 mixed mode).
    I use an older ConnectIQ SDK v6.4.2, because I have some watch application issues with v7.

    The CodeCache warning is there, even for a successful export:

    * Executing task: monkeyc: Export
    java -Xms1g -Dfile.encoding=UTF-8 -Dapple.awt.UIElement=true -jar <...>/connectiq-sdk-mac-6.4.2-2024-01-04-a1dd13ee0/bin/monkeybrains.jar -o <...>.iq -f <...>/monkey.jungle -y <...> -e -r -w
    CodeCache: size=2097152Kb used=62683Kb max_used=63258Kb free=2034468Kb
    bounds [0x0000000300000000, 0x0000000303e00000, 0x0000000380000000]
    total_blobs=10707 nmethods=10200 adapters=421
    compilation: disabled (not enough contiguous free space left)
    BUILD SUCCESSFUL

    I published the exported project on the ConnectIQ app gallery multiple times without any client issues.

    Some say on MATLAB forums, that this is a known harmless warning on the Apple silicon machines:
    (www.mathworks.com/.../2032609-codecache-is-full-compiler-has-been-disabled

    This warning is appearing on Macs with the Silicon processor. Nevertheless, despite this warning message, there is no practical concern with MATLAB or the CodeCache. Users should be able to use MATLAB normally. Hopefully, MathWorks will work on removing this warning in future releases.

    I tried increasing ReservedCodeCacheSize to 2048m and switching UseCodeCacheFlushing on/off, but the warning didn't disappear.

    Perhaps, if Garmin can fix that warning, it would only do so for the SDK v7, not v6.

  • I finally found out that --debug-log-output needs to point to a zip file. I generated it and emailed it to ConnectIQ.

  • I was able to uninstall Temurin and install the Java ARM64 back again (jre-8u431-macosx-aarch64.dmg). I was then able to reproduce the error and generate the log file. However, the log is not in plain text; it is gibberish. For the path for --debug-log-output, I pointed it to a text file, e.g., debug.txt. Is it supposed to be a different file format?

  • Thanks! I added -g and --debug-log-level 3, but now there is no error printing at all despite the terminal still exiting. I was thinking of uninstalling Temurin and installing the Java ARM64 back again, but I do not see uninstallation instructions on the Temurin website.