arduino / arduino-cli

Arduino command line tool
https://arduino.github.io/arduino-cli/latest/
GNU General Public License v3.0
4.23k stars 370 forks source link

v1.0.0-rc.2 - Invalid Characters in M5Atom Library #2621

Closed JulienRichoz closed 1 month ago

JulienRichoz commented 1 month ago

Describe the problem

The M5Atom library contains extended characters that cause compilation errors when using the Arduino CLI on a gitlab pipeline with debian. The error occurs due to the use of non-standard quotation marks in the M5Atom.h file. A suggested fix can be found in the section 'Additional context'.

Environment:

To reproduce

  1. Install 'M5Atom' library using the Arduino CLI.
  2. Attempt to compile any sketch that includes the 'M5Atom.h' file

Expected behavior

  1. Compilation fails with the following error
    /root/Arduino/libraries/M5Atom/src/M5Atom.h:82:8: error: extended character “ is not valid in an identifier
    82 | #error “This library only supports boards with ESP32 processor.”
    |        ^
    /root/Arduino/libraries/M5Atom/src/M5Atom.h:82:64: error: extended character ” is not valid in an identifier
    82 | #error “This library only supports boards with ESP32 processor.”
    |                                                                ^

Arduino CLI version

arduino-cli version 0.19.3

Operating system

Linux

Operating system version

Debian on pipeline

Additional context

Current suggested fix:

Run the following commands to replace the invalid characters before compiling:

sed -i 's/“/"/g' /root/Arduino/libraries/M5Atom/src/M5Atom.h
sed -i 's/”/"/g' /root/Arduino/libraries/M5Atom/src/M5Atom.h

Here is my fully fixed gitlab pipeline:

image: debian:latest

stages:
  - compile

compile-job:
  stage: compile
  before_script:
    # Update and install necessary packages
    - apt-get update && apt-get install -y wget tar python3 python3-pip python3-venv
    # Install Python packages required for ESP32 tools
    - python3 -m venv venv
    - source venv/bin/activate
    - pip install pyserial
    # Download and install Arduino CLI
    - wget https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Linux_64bit.tar.gz
    - tar -xf arduino-cli_latest_Linux_64bit.tar.gz
    - mv arduino-cli* /usr/local/bin/arduino-cli
    - arduino-cli config init
    - arduino-cli core update-index
    # Install ESP32 core; this is necessary for M5 Atom
    - arduino-cli core install esp32:esp32
    # Install Libraries for Arduino
    - arduino-cli lib install "M5Atom"
    - arduino-cli lib install "Adafruit_VL53L0X"
    - arduino-cli lib install "TCA9548"
    - arduino-cli lib install "WebSockets"
    # Fix extended characters in M5Atom.h
    - sed -i 's/“/"/g' /root/Arduino/libraries/M5Atom/src/M5Atom.h
    - sed -i 's/”/"/g' /root/Arduino/libraries/M5Atom/src/M5Atom.h
  script:
    # List all available boards to verify the correct FQBN
    - arduino-cli board listall
    # Compile your Arduino sketch for the M5 Atom
    - ls -l esp32-server/
    - source venv/bin/activate
    - arduino-cli compile --fqbn esp32:esp32:m5stack_core esp32-server/
  artifacts:
    paths:
      - kaptori3n/esp32-server/build/esp32.esp32.m5stack-core-esp32/*.bin
    expire_in: 3 days

Issue checklist

per1234 commented 1 month ago

Hi @JulienRichoz . Thanks for your interest in this open source project. This issue tracker is only used to report bugs and make feature requests for the codebase hosted in this repository.

The bug you are reporting is a bug in the "M5Atom" library's code, so the report is off topic here.

Please submit a bug report (or even better, a pull request) to the repository where the bugged code is hosted:

https://github.com/m5stack/M5Atom