Collect2.exe: error: ld returned 1 exit status *** [.pio\build\teensy40\firmware.elf] Error 1

Due to the complexity, I suspect that one of the libraries used is not compatible.

A similar situation also occurred in this thread: Error compiling for Teensy 3.1