I get a compilation error "error: ‘time_t’ declared as function returning a function "is given when compiling Edge Impulse firmware for Raspberry Pi RP2040.
Followed the instruction from the git repository below.
Compiler version
arm-none-eabi-gcc (15:13.2.rel1-2) 13.2.1 20231009 Ubuntu 24.10
Make output :
[ 0%] Built target bs2_default
[ 0%] Built target bs2_default_library
[ 1%] Built target ei_rp2040_firmware_pdm_pio_h
[ 1%] Building CXX object CMakeFiles/ei_rp2040_firmware.dir/src/main.cpp.o
In file included from /home/doodle/firmware-pi-rp2040/firmware-sdk/ei_fusion.h:41,
from /home/doodle/firmware-pi-rp2040/firmware-sdk/ei_device_info_lib.h:25,
from /home/doodle/firmware-pi-rp2040/edge-impulse/ingestion-sdk-platform/raspberry-rp2040/ei_device_raspberry_rp2040.h:28,
from /home/doodle/firmware-pi-rp2040/src/main.cpp:30:
/home/doodle/firmware-pi-rp2040/firmware-sdk/sensor_aq.h:140:13: error: expected identifier before ‘*’ token
140 | time_t (time())(time_t);
| ^
/home/doodle/firmware-pi-rp2040/firmware-sdk/sensor_aq.h:140:22: error: ‘time_t’ has not been declared
140 | time_t (time())(time_t);
| ^~~~~~
/home/doodle/firmware-pi-rp2040/firmware-sdk/sensor_aq.h:140:5: error: ISO C++ forbids declaration of ‘time_t’ with no type [-fpermissive]
140 | time_t (time())(time_t);
| ^~~~~~
/home/doodle/firmware-pi-rp2040/firmware-sdk/sensor_aq.h:140:29: error: ‘time_t’ declared as function returning a function
140 | time_t (time())(time_t);
| ^
make[2]: *** [CMakeFiles/ei_rp2040_firmware.dir/build.make:76: CMakeFiles/ei_rp2040_firmware.dir/src/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1801: CMakeFiles/ei_rp2040_firmware.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
Yes. I installed the compiler and Pico-SDK using the commands in the repository. See apt-get output below.
doodle@doodle:~$ sudo apt install gcc-arm-none-eabi libnewlib-arm-none-eabi
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
gcc-arm-none-eabi is already the newest version (15:13.2.rel1-2).
libnewlib-arm-none-eabi is already the newest version (4.4.0.20231231-2).
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.
doodle@doodle:~$
I switched over to GCC 10.3.1 and the previous error is now resolved. I now get several linker errors of the following type :
/home/doodle/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux/bin/…/lib/gcc/arm-none-eabi/10.3.1/…/…/…/…/arm-none-eabi/bin/ld: CMakeFiles/ei_rp2040_firmware.dir/edge-impulse/ingestion-sdk-platform/raspberry-rp2040/ei_at_handlers.cpp.o: in function std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': /home/doodle/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux/arm-none-eabi/include/c++/10.3.1/bits/basic_string.h:1379: undefined reference to std::__cxx11::basic_string<char, std::char_traits, std::allocator >::_M_assign(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)’
/home/doodle/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux/bin/…/lib/gcc/arm-none-eabi/10.3.1/…/…/…/…/arm-none-eabi/bin/ld: /home/doodle/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux/arm-none-eabi/include/c++/10.3.1/bits/basic_string.h:1379: undefined reference to `std::__cxx11::basic_string<char, std::char_traits, std::allocator >::_M_assign(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)’
Compiler settings below:
Defaulting PICO_GCC_TRIPLE to ‘arm-none-eabi’
– The C compiler identification is GNU 10.3.1
– The CXX compiler identification is GNU 10.3.1
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: /home/doodle/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux/bin/arm-none-eabi-gcc - 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: /home/doodle/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux/bin/arm-none-eabi-gcc - skipped
– Detecting CXX compile features
– Detecting CXX compile features - done
– The ASM compiler identification is GNU
– Found assembler: /usr/bin/arm-none-eabi-gcc
Build type is Release