Unfortunately the newest XTensa compiler does not work for me. The repo has Xtensa32-GCC 8.2.0 as the newest, which is xtensa-esp32-elf-g++ (crosstool-NG esp-2019r2) 8.2.0
(also referenced in esp-idf), but building with it fails fatally with internal G++ errors.
For reference my platformio.ini
[platformio]
default_envs = planter
[esp32]
; upgrade XTensa32 GCC/G++ compiler to 8.2.0
; use bleeding edge arduino-esp32
platform_packages =
toolchain-xtensa32 @ 2.80200.200226
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git
[common]
build_flags =
; do not redefine arduino
; -DARDUINO=10800
-DESP32=1
-DARDUINO_ARCH_ESP32=1
-DBOARD_HAS_PSRAM
-std=c++17
-std=gnu++17
build_unflags =
-std=gnu++11
[env:planter]
board = esp32doit-devkit-v1
framework = arduino
platform = espressif32
platform_packages =
${esp32.platform_packages}
; not given in examples
;lib_deps =
; ${common.lib_deps}
build_flags =
${common.build_flags}
build_unflags =
${common.build_unflags}
and sample code
#include <Arduino.h>
void setup() {
}
void loop() {
}
fails to compile .
Compiling .pio\build\planter\FrameworkArduino\FunctionalInterrupt.cpp.o
In file included from c:\users\maxi\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.2.0\xtensa-esp32-elf\no-rtti\bits\gthr.h:151,
from c:\users\maxi\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.2.0\ext\atomicity.h:35,
from c:\users\maxi\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.2.0\bits\basic_string.h:39,
from c:\users\maxi\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.2.0\string:52,
from c:\users\maxi\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.2.0\stdexcept:39,
from c:\users\maxi\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.2.0\array:39,
from c:\users\maxi\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.2.0\tuple:39,
from c:\users\maxi\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.2.0\functional:54,
from C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32@src-537c58760dafe7fcc8a1d9bbcf00b6f6\cores\esp32\FunctionalInterrupt.h:11,
from C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32@src-537c58760dafe7fcc8a1d9bbcf00b6f6\cores\esp32\FunctionalInterrupt.cpp:8:
c:\users\maxi\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.2.0\xtensa-esp32-elf\no-rtti\bits\gthr-default.h: In function 'int __gthread_mutex_timedlock(__gthread_mutex_t*, const __gthread_time_t*)':
c:\users\maxi\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.2.0\xtensa-esp32-elf\no-rtti\bits\gthr-default.h:783:12: error: 'pthread_mutex_timedlock' was not declared in this scope
return __gthrw_(pthread_mutex_timedlock) (__mutex, __abs_timeout);
^~~~~~~~
c:\users\maxi\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.2.0\xtensa-esp32-elf\no-rtti\bits\gthr-default.h:783:12: note: suggested alternative: 'pthread_mutex_trylock'
In file included from c:\users\maxi\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.2.0\cstdlib:75,
from c:\users\maxi\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.2.0\ext\string_conversions.h:41,
from c:\users\maxi\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.2.0\bits\basic_string.h:6391,
from c:\users\maxi\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.2.0\string:52,
from c:\users\maxi\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.2.0\stdexcept:39,
from c:\users\maxi\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.2.0\array:39,
from c:\users\maxi\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.2.0\tuple:39,
from c:\users\maxi\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.2.0\functional:54,
from C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32@src-537c58760dafe7fcc8a1d9bbcf00b6f6\cores\esp32\FunctionalInterrupt.h:11,
from C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32@src-537c58760dafe7fcc8a1d9bbcf00b6f6\cores\esp32\FunctionalInterrupt.cpp:8:
c:\users\maxi\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\sys-include\stdlib.h: At global scope:
c:\users\maxi\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\sys-include\stdlib.h:155:44: error: expected initializer before '__result_use_check'
void *reallocarray(void *, size_t, size_t) __result_use_check __alloc_size(2)
^~~~~~~~~~~~~~~~~~
c:\users\maxi\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\sys-include\stdlib.h:340:52: error: expected initializer before '__alloc_align'
void * aligned_alloc(size_t, size_t) __malloc_like __alloc_align(1)
^~~~~~~~~~~~~
*** [.pio\build\planter\FrameworkArduino\FunctionalInterrupt.cpp.o] Error 1
There seems to be some misconfiguration regarding pthreads / mutexes and internal __result_use_check
and __alloc_align
stuff…
This exact error has already been reported at Build break while building esp32-at using release/v1.2.0.0 branch · Issue #215 · espressif/esp-at · GitHub but no solution was found other than “go back to 5.2.0”, which doesn’t have C++17 support.
I’ll open an issue at ESP-IDF and see what I can do.