Compile error on Portenta H7

Hello, Me again :frowning:

I am attempting to compile the example-portenta-lorawan example with my own model for the Portenta H7, I am getting an error when trying to compile with my model, but everything works when attempting to compile the model in a clean pull of the repo. So whatever is going wrong is something that I am doing.

My image size is 64x64,
Single image recognition,
Grayscale
and using MobileNetV2 0.1
with version 0.13.0 of the Arduino-CLI - arduino-cli Version: 0.13.0 Commit: 693a045

The error I receive is:

/home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/mbed.h:4:0,
                     from /tmp/arduino-sketch-45116531070844582DF2F37665C60C4C/sketch/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/../../../../classifier/ei_classifier_config.h:29,
                     from /tmp/arduino-sketch-45116531070844582DF2F37665C60C4C/sketch/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/add.cpp:2:
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h: In function 'tflite::QuantizationParams tflite::ChooseQuantizationParams(double, double, bool)':
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:67:12: note: in expansion of macro 'abs'
           std::abs(qmin_double) + std::abs(rmin / scale);
                ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:67:36: note: in expansion of macro 'abs'
           std::abs(qmin_double) + std::abs(rmin / scale);
                                        ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:69:12: note: in expansion of macro 'abs'
           std::abs(qmax_double) + std::abs(rmax / scale);
                ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:69:36: note: in expansion of macro 'abs'
           std::abs(qmax_double) + std::abs(rmax / scale);
                                        ^
    In file included from /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/mbed.h:4:0,
                     from /tmp/arduino-sketch-45116531070844582DF2F37665C60C4C/sketch/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/../../../../classifier/ei_classifier_config.h:29,
                     from /tmp/arduino-sketch-45116531070844582DF2F37665C60C4C/sketch/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/conv.cpp:2:
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h: In function 'tflite::QuantizationParams tflite::ChooseQuantizationParams(double, double, bool)':
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:67:12: note: in expansion of macro 'abs'
           std::abs(qmin_double) + std::abs(rmin / scale);
                ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:67:36: note: in expansion of macro 'abs'
           std::abs(qmin_double) + std::abs(rmin / scale);
                                        ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:69:12: note: in expansion of macro 'abs'
           std::abs(qmax_double) + std::abs(rmax / scale);
                ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:69:36: note: in expansion of macro 'abs'
           std::abs(qmax_double) + std::abs(rmax / scale);
                                        ^
    In file included from /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/mbed.h:4:0,
                     from /tmp/arduino-sketch-45116531070844582DF2F37665C60C4C/sketch/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/../../../../classifier/ei_classifier_config.h:29,
                     from /tmp/arduino-sketch-45116531070844582DF2F37665C60C4C/sketch/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/depthwise_conv.cpp:2:
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h: In function 'tflite::QuantizationParams tflite::ChooseQuantizationParams(double, double, bool)':
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:67:12: note: in expansion of macro 'abs'
           std::abs(qmin_double) + std::abs(rmin / scale);
                ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:67:36: note: in expansion of macro 'abs'
           std::abs(qmin_double) + std::abs(rmin / scale);
                                        ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:69:12: note: in expansion of macro 'abs'
           std::abs(qmax_double) + std::abs(rmax / scale);
                ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:69:36: note: in expansion of macro 'abs'
           std::abs(qmax_double) + std::abs(rmax / scale);
                                        ^
    In file included from /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/mbed.h:4:0,
                     from /tmp/arduino-sketch-45116531070844582DF2F37665C60C4C/sketch/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/../../../../classifier/ei_classifier_config.h:29,
                     from /tmp/arduino-sketch-45116531070844582DF2F37665C60C4C/sketch/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/fully_connected.cpp:2:
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h: In function 'tflite::QuantizationParams tflite::ChooseQuantizationParams(double, double, bool)':
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:67:12: note: in expansion of macro 'abs'
           std::abs(qmin_double) + std::abs(rmin / scale);
                ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:67:36: note: in expansion of macro 'abs'
           std::abs(qmin_double) + std::abs(rmin / scale);
                                        ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:69:12: note: in expansion of macro 'abs'
           std::abs(qmax_double) + std::abs(rmax / scale);
                ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:69:36: note: in expansion of macro 'abs'
           std::abs(qmax_double) + std::abs(rmax / scale);
                                        ^
    In file included from /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/mbed.h:4:0,
                     from /tmp/arduino-sketch-45116531070844582DF2F37665C60C4C/sketch/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/../../../../classifier/ei_classifier_config.h:29,
                     from /tmp/arduino-sketch-45116531070844582DF2F37665C60C4C/sketch/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/mul.cpp:2:
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h: In function 'tflite::QuantizationParams tflite::ChooseQuantizationParams(double, double, bool)':
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:67:12: note: in expansion of macro 'abs'
           std::abs(qmin_double) + std::abs(rmin / scale);
                ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:67:36: note: in expansion of macro 'abs'
           std::abs(qmin_double) + std::abs(rmin / scale);
                                        ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:69:12: note: in expansion of macro 'abs'
           std::abs(qmax_double) + std::abs(rmax / scale);
                ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:69:36: note: in expansion of macro 'abs'
           std::abs(qmax_double) + std::abs(rmax / scale);
                                        ^
    In file included from /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/mbed.h:4:0,
                     from /tmp/arduino-sketch-45116531070844582DF2F37665C60C4C/sketch/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/../../../../classifier/ei_classifier_config.h:29,
                     from /tmp/arduino-sketch-45116531070844582DF2F37665C60C4C/sketch/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/pooling.cpp:2:
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h: In function 'tflite::QuantizationParams tflite::ChooseQuantizationParams(double, double, bool)':
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:67:12: note: in expansion of macro 'abs'
           std::abs(qmin_double) + std::abs(rmin / scale);
                ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:67:36: note: in expansion of macro 'abs'
           std::abs(qmin_double) + std::abs(rmin / scale);
                                        ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:69:12: note: in expansion of macro 'abs'
           std::abs(qmax_double) + std::abs(rmax / scale);
                ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:69:36: note: in expansion of macro 'abs'
           std::abs(qmax_double) + std::abs(rmax / scale);
                                        ^
    Still building...
    Error during build: exit status 1

Is this an error with the model settings I am producing? Did I forget something???

Thank you so very much!
-Kevin

Hi @kevin192291

Can you try updating your Arduino CLI version? I am using 0.18.2 (despite our message of expecting 0.13.x) and it compiles successfully with the model included in the repo.

If that does not work, can you please share the URL to your Edge Impulse project? And I can try compiling your model with the lorawan repo locally as well.

Thanks!
Jenny

1 Like

Hello @jenny,
Thank you for your response, I appreciate it!
I started a new project with the upgraded version of the Arduino CLI, and get the same error.
Here is the public repo I created from the project I am having issues with: https://studio.edgeimpulse.com/public/32867/latest
If you get a moment, let me know if this works for you :slight_smile: Thank you so much for testing this for me!!!

1 Like

I posted a Feature Request to update the MKRWAN and MBED and minor version here

@kevin192291 The model link you gave only has one object to detect. You will need unknown objects so that the computer can tell the difference.

@kevin192291 Sorry completely missed this thread, but in

    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: 

Comment out this line:

     #define abs(x) ((x)>0?(x):-(x))
1 Like

@Rocksetta we’ll do a proper release of the Portenta H7 as soon as some fixes are landed in the core and then will update both Nano 33 BLE Sense and the Portenta H7 to latest cores.

1 Like