adafruit / Adafruit_TFLite_Micro_Speech

This is a 'Arduino-ified' version of the TensorFlow Lite (experimental) micro speech example.
Other
89 stars 16 forks source link

Compilation error #3

Closed seandoyle closed 5 years ago

seandoyle commented 5 years ago

Hi -

After checking out the code last night I've run into this error - I didn't have this on the earlier version. I can compile/run other programs for the pygamer.

micro_speech_trondemo:53:9: error: conflicting declaration 'uint8_t kCategoryCount' uint8_t kCategoryCount = 0; ^ In file included from /Users/SWD0/MachineLearning/github/Adafruit_TFLite_Micro_Speech/examples/micro_speech_trondemo/micro_speech_trondemo.ino:27:0: /Users/SWD0/Documents/Arduino/libraries/Adafruit_TFLite_Micro_Speech/src/tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/micro_model_settings.h:36:15: error: 'kCategoryCount' has a previous declaration as 'constexpr const int kCategoryCount' constexpr int kCategoryCount = 4; ^ micro_speech_trondemo:54:8: error: conflicting declaration 'char kCategoryLabels' char kCategoryLabels; ^ In file included from /Users/SWD0/MachineLearning/github/Adafruit_TFLite_Micro_Speech/examples/micro_speech_trondemo/micro_speech_trondemo.ino:27:0:

ladyada commented 5 years ago

we completely re-factored the library last nite. please check you have all the latest code!

seandoyle commented 5 years ago

I just deleted this directory and re-cloned it from github. I still get the same error. I'm using Arduino 1.8.9. All of my libraries are updated except for the SPIFlash one - it's at version 2.02 because it wouldn't compile with 3.0.0. The only other changes I've made were setting the config flags ENABLE_EXTENDED_TRANSFER_CLASS and FAT12_SUPPORT to 1 because of the error (I see you have the same error in Travis).

/home/travis/build/adafruit/Adafruit_TFLite_Micro_Speech/examples/micro_speech_trondemo/micro_speech_trondemo.ino:28: /home/travis/Arduino/libraries/Adafruit_SPIFlash/src/Adafruit_SPIFlash.h:38:2: error: #error ENABLE_EXTENDED_TRANSFER_CLASS must be set to 1 in SdFat's SdFatConfig.h

error ENABLE_EXTENDED_TRANSFER_CLASS must be set to 1 in SdFat's SdFatConfig.h

^ /home/travis/Arduino/libraries/Adafruit_SPIFlash/src/Adafruit_SPIFlash.h:42:2: error: #error FAT12_SUPPORT must be set to 1 in SdFat'sSdFatConfig.h

error FAT12_SUPPORT must be set to 1 in SdFat'sSdFatConfig.h

If there are other build items cached somewhere outside the Adafruit_TFLite_Micro_Speech directory I'd be happy to delete them and retry.

I also just tried compiling the micro_speech_json example and get the same error.

I'll look around a bit more but I'm stumped. But I am very honored that ladyada herself responded!

ladyada commented 5 years ago

try deleting whatever version of sdfat you have installed and install this version https://github.com/adafruit/SdFat

seandoyle commented 5 years ago

Thanks. No more SdFat errors - but the original error with kCategoryCount remains:

Arduino: 1.8.9 (Mac OS X), Board: "Adafruit PyGamer M4 Express (SAMD51), Enabled, 200 MHz (overclock), Small (-Os) (standard), 50 MHz (standard), TinyUSB"

In file included from /Users/SWD0/Documents/Arduino/libraries/Adafruit_Arcada_Library/Adafruit_Arcada.h:9:0, from /Users/SWD0/MachineLearning/github/Adafruit_TFLite_Micro_Speech/examples/micro_speech_trondemo/micro_speech_trondemo.ino:28: /Users/SWD0/Documents/Arduino/libraries/Adafruit_GFX_Library/Adafruit_SPITFT.h:90:61: note: #pragma message: GFX DMA IS ENABLED. HIGHLY EXPERIMENTAL.

pragma message ("GFX DMA IS ENABLED. HIGHLY EXPERIMENTAL.")

                                                         ^

micro_speech_trondemo:53:9: error: conflicting declaration 'uint8_t kCategoryCount' uint8_t kCategoryCount = 0; ^ In file included from /Users/SWD0/MachineLearning/github/Adafruit_TFLite_Micro_Speech/examples/micro_speech_trondemo/micro_speech_trondemo.ino:27:0: /Users/SWD0/Documents/Arduino/libraries/Adafruit_TFLite_Micro_Speech/src/tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/micro_model_settings.h:36:15: error: 'kCategoryCount' has a previous declaration as 'constexpr const int kCategoryCount' constexpr int kCategoryCount = 4; ^ micro_speech_trondemo:54:8: error: conflicting declaration 'char kCategoryLabels' char kCategoryLabels; ^ In file included from /Users/SWD0/MachineLearning/github/Adafruit_TFLite_Micro_Speech/examples/micro_speech_trondemo/micro_speech_trondemo.ino:27:0: /Users/SWD0/Documents/Arduino/libraries/Adafruit_TFLite_Micro_Speech/src/tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/micro_model_settings.h:39:20: error: 'kCategoryLabels' has a previous declaration as 'const char kCategoryLabels [4]' extern const char kCategoryLabels[kCategoryCount]; ^ /Users/SWD0/MachineLearning/github/Adafruit_TFLite_Micro_Speech/examples/micro_speech_trondemo/micro_speech_trondemo.ino: In function 'void setup()': micro_speech_trondemo:177:18: error: assignment of read-only variable 'kCategoryCount' kCategoryCount = labelArray.size(); ^ micro_speech_trondemo:178:19: error: incompatible types in assignment of 'char*' to 'const char [4]' kCategoryLabels = (char *)malloc(kCategoryCount sizeof(char )); ^ micro_speech_trondemo:188:29: error: invalid conversion from 'const void' to 'void' [-fpermissive] memcpy(kCategoryLabels[s], label, strlen(label)+1); ^ In file included from /Users/SWD0/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/arm-none-eabi/include/stdlib.h:11:0, from /Users/SWD0/Library/Arduino15/packages/adafruit/hardware/samd/1.5.0/cores/arduino/Arduino.h:25, from sketch/micro_speech_trondemo.ino.cpp:1: /Users/SWD0/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/arm-none-eabi/include/string.h:23:8: error: initializing argument 1 of 'void memcpy(void, const void, size_t)' [-fpermissive] _PTR _EXFUN(memcpy,(_PTR __restrict, const _PTR __restrict, size_t)); ^ exit status 1 conflicting declaration 'uint8_t kCategoryCount'

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

seandoyle commented 5 years ago

I found the two or three errors...

  1. I downloaded this git repository and loaded the *.ino files directly from the directory that I had downloaded them from. Not sure if this is accepted practice or not.
  2. I had previously downloaded the Adafruit_TFLite_Micro_Speech using the Arduino's library manager. This was at a different version than the one in this repo - which was a cause of compilation errors.
  3. I thought I had followed the instructions from installing pygamer libraries - but when I installed the TinyUSB I must have just unzipped the file into my Arduino/libraries directory without removing the '_master' part of the name.

So - all user errors. Sorry about that - it's been a while since I've been working on arduinos.

ladyada commented 5 years ago

all good, this code is under a lot of work :)