Fix for rom/miniz.h Compilation Error in M5Stack Arduino Sketch

The Issue:
A sketch that previously compiled now fails with this error:

fatal error: rom/miniz.h: No such file or directory

Cause:
This happened after updating the ESP32 board package (used for M5Stack devices) to version 3.2.0. It only seems to affect sketches that use the M5Core2 library (not M5Unified).

Solution (as of now):

Downgrade the M5Stack board package from v3.2.0 to v2.1.4 using the Boards Manager in the Arduino IDE.

  1. Go to Tools \ Board: “xxxxx” \ Boards Manager…
  2. Search for M5Stack
  3. Remove version 3.2.0
  4. Install version 2.1.4
  5. Recompile the sketch

Note:
This is a temporary workaround. M5Stack may address this issue in a future release. If you encounter this error again, first check for an updated board package before downgrading.

2 thoughts on “Fix for rom/miniz.h Compilation Error in M5Stack Arduino Sketch”

  1. Found a work around:
    change `#include <M5Core2.h>` to `#include <M5Unified.h>`.
    It then compiles. Make sure you have M5Unified library installed

    [Edited by admin: Content in angle brackets was stripped, leaving only “change #include to #include”. Restored based on assumed intent.]

Leave a Reply

Your email address will not be published. Required fields are marked *