guruthree/pico-superkey-board

Failed to build on MacOS 11.4

Closed this issue · 5 comments

'cmake ..' is successful but 'make' gives the following output. Any suggestion?

~/dev/projects/pi-pico/pico-superkey-board/build (master)$ make
[ 1%] Creating directories for 'ELF2UF2Build'
[ 2%] No download step for 'ELF2UF2Build'
[ 3%] No update step for 'ELF2UF2Build'
[ 4%] No patch step for 'ELF2UF2Build'
[ 6%] Performing configure step for 'ELF2UF2Build'
-- The C compiler identification is AppleClang 12.0.5.12050022
-- The CXX compiler identification is AppleClang 12.0.5.12050022
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/sean/dev/projects/pi-pico/pico-superkey-board/build/elf2uf2
[ 7%] Performing build step for 'ELF2UF2Build'
[ 50%] Building CXX object CMakeFiles/elf2uf2.dir/main.cpp.o
[100%] Linking CXX executable elf2uf2
[100%] Built target elf2uf2
[ 8%] No install step for 'ELF2UF2Build'
[ 9%] Completed 'ELF2UF2Build'
[ 9%] Built target ELF2UF2Build
Scanning dependencies of target bs2_default
[ 10%] Building ASM object pico-sdk/src/rp2_common/boot_stage2/CMakeFiles/bs2_default.dir/compile_time_choice.S.obj
[ 12%] Linking ASM executable bs2_default.elf
[ 12%] Built target bs2_default
[ 13%] Generating bs2_default.bin
[ 14%] Generating bs2_default_padded_checksummed.S
[ 14%] Built target bs2_default_padded_checksummed_asm
Scanning dependencies of target pico-superkey-board
[ 15%] Building CXX object CMakeFiles/pico-superkey-board.dir/pico-superkey-board.cpp.obj
[ 16%] Building CXX object CMakeFiles/pico-superkey-board.dir/TinyUSB_Mouse_and_Keyboard/TinyUSB_Mouse_and_Keyboard.cpp.obj
[ 18%] Building CXX object CMakeFiles/pico-superkey-board.dir/Adafruit_TinyUSB_Arduino/src/Adafruit_USBD_HID.cpp.obj
/Users/sean/dev/projects/pi-pico/pico-superkey-board/Adafruit_TinyUSB_Arduino/src/Adafruit_USBD_HID.cpp: In constructor 'Adafruit_USBD_HID::Adafruit_USBD_HID()':
/Users/sean/dev/projects/pi-pico/pico-superkey-board/Adafruit_TinyUSB_Arduino/src/Adafruit_USBD_HID.cpp:37:15: error: 'HID_PROTOCOL_NONE' was not declared in this scope; did you mean 'HID_PROTOCOL_BOOT'?
37 | _protocol = HID_PROTOCOL_NONE;
| ^~~~~~~~~~~~~~~~~
| HID_PROTOCOL_BOOT
/Users/sean/dev/projects/pi-pico/pico-superkey-board/Adafruit_TinyUSB_Arduino/src/Adafruit_USBD_HID.cpp: At global scope:
/Users/sean/dev/projects/pi-pico/pico-superkey-board/Adafruit_TinyUSB_Arduino/src/Adafruit_USBD_HID.cpp:138:16: error: conflicting declaration of 'const uint8_t* tud_hid_descriptor_report_cb()' with 'C' linkage
138 | uint8_t const tud_hid_descriptor_report_cb(void) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Users/sean/dev/projects/pi-pico/pico-superkey-board/Adafruit_TinyUSB_Arduino/src/Adafruit_USBD_HID.cpp:25:
/Users/sean/dev/projects/pi-pico/pico-superkey-board/Adafruit_TinyUSB_Arduino/src/Adafruit_USBD_HID.h:94:25: note: previous declaration with 'C++' linkage
94 | friend uint8_t const tud_hid_descriptor_report_cb(void);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/sean/dev/projects/pi-pico/pico-superkey-board/Adafruit_TinyUSB_Arduino/src/Adafruit_USBD_HID.cpp:148:10: error: conflicting declaration of 'uint16_t tud_hid_get_report_cb(uint8_t, hid_report_type_t, uint8_t
, uint16_t)' with 'C' linkage
148 | uint16_t tud_hid_get_report_cb(uint8_t report_id, hid_report_type_t report_type,
| ^~~~~~~~~~~~~~~~~~~~~
In file included from /Users/sean/dev/projects/pi-pico/pico-superkey-board/Adafruit_TinyUSB_Arduino/src/Adafruit_USBD_HID.cpp:25:
/Users/sean/dev/projects/pi-pico/pico-superkey-board/Adafruit_TinyUSB_Arduino/src/Adafruit_USBD_HID.h:88:19: note: previous declaration with 'C++' linkage
88 | friend uint16_t tud_hid_get_report_cb(uint8_t report_id,
| ^~~~~~~~~~~~~~~~~~~~~
/Users/sean/dev/projects/pi-pico/pico-superkey-board/Adafruit_TinyUSB_Arduino/src/Adafruit_USBD_HID.cpp:158:6: error: conflicting declaration of 'void tud_hid_set_report_cb(uint8_t, hid_report_type_t, const uint8_t
, uint16_t)' with 'C' linkage
158 | void tud_hid_set_report_cb(uint8_t report_id, hid_report_type_t report_type,
| ^~~~~~~~~~~~~~~~~~~~~
In file included from /Users/sean/dev/projects/pi-pico/pico-superkey-board/Adafruit_TinyUSB_Arduino/src/Adafruit_USBD_HID.cpp:25:
/Users/sean/dev/projects/pi-pico/pico-superkey-board/Adafruit_TinyUSB_Arduino/src/Adafruit_USBD_HID.h:91:15: note: previous declaration with 'C++' linkage
91 | friend void tud_hid_set_report_cb(uint8_t report_id,
| ^~~~~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/pico-superkey-board.dir/Adafruit_TinyUSB_Arduino/src/Adafruit_USBD_HID.cpp.obj] Error 1
make[1]: *** [CMakeFiles/pico-superkey-board.dir/all] Error 2
make: *** [all] Error 2

Tested on Mac, Windows and Pi, all failed with the same error message @guruthree

Can you confirm the file Adafruit_TinyUSB_ArduinoCore/tinyusb/src/class/hid/hid.h exists? My copy has

/// HID Protocol
typedef enum
{
  HID_PROTOCOL_NONE     = 0, ///< None
  HID_PROTOCOL_KEYBOARD = 1, ///< Keyboard
  HID_PROTOCOL_MOUSE    = 2  ///< Mouse
}hid_protocol_type_t;

which is what make is complaining about it missing.

It's possible something has gone wrong or changed since I setup my pico SDK with regards to how cmake is doing includes. If hid.h exists and contains that enum, then it might help to edit CMakeLists.txt to add Adafruit_TinyUSB_ArduinoCore/tinyusb/src/class/hid/ to the include_directories so it looks like:

include_directories(includes
    TinyUSB_Mouse_and_Keyboard
    Adafruit_TinyUSB_Arduino/src
    Adafruit_TinyUSB_ArduinoCore
)

Investigating further, it looks like since I wrote this code Adafruit have retired the Adafruit_TinyUSB_ArduinoCore/ repository and that may be causing problems. Did you run/try running git submodule update --init to check out the submodules? This would ensure the exact same version of the code I used to develop. If they were downloaded manually that could be causing problems. I'll have to look and see about updating things for the new TinyUSB_Arduino library.

Yes, I did run git submodule update --init and Adafruit_TinyUSB_ArduinoCore/tinyusb/src/class/hid/hid.h is there.

I'm not sure what's going wrong, so I've updated everything to work with the changes to Adafruit_TinyUSB_Arduino . Could you try updating to 28654e6 and see if that works then?

It is working perfectly now. Thanks