FastLED_NeoMatrix_SmartMatrix_LEDMatrix_GFX_Demos icon indicating copy to clipboard operation
FastLED_NeoMatrix_SmartMatrix_LEDMatrix_GFX_Demos copied to clipboard

Failure to compile sample

Open netmindz opened this issue 4 years ago • 9 comments

Having issues trying to compile your example - clash between esp tools 1.0.5 and your code?

In file included from /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/tuple:39:0, from /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/functional:55, from /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/memory:79, from /home/will/.arduino15/packages/esp32/hardware/esp32/1.0.5/libraries/FS/src/FS.h:24, from /home/will/.arduino15/packages/esp32/hardware/esp32/1.0.5/libraries/FFat/src/FFat.h:18, from sketch/neomatrix_config.h:179, from /home/will/Arduino/3rdParty/FastLED_NeoMatrix_SmartMatrix_LEDMatrix_GFX_Demos/FastLED/Vortex/Vortex.ino:1: /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/array:115:26: error: macro "swap" requires 2 arguments, but only 1 given swap(array& __other) ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/array:274:56: error: macro "swap" passed 4 arguments, but takes just 2 swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two) ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/array:275:39: error: macro "swap" requires 2 arguments, but only 1 given noexcept(noexcept(__one.swap(__two))) ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/array:276:23: error: macro "swap" requires 2 arguments, but only 1 given { __one.swap(__two); } ^ In file included from /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/functional:55:0, from /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/memory:79, from /home/will/.arduino15/packages/esp32/hardware/esp32/1.0.5/libraries/FS/src/FS.h:24, from /home/will/.arduino15/packages/esp32/hardware/esp32/1.0.5/libraries/FFat/src/FFat.h:18, from sketch/neomatrix_config.h:179, from /home/will/Arduino/3rdParty/FastLED_NeoMatrix_SmartMatrix_LEDMatrix_GFX_Demos/FastLED/Vortex/Vortex.ino:1: /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/tuple:580:23: error: macro "swap" requires 2 arguments, but only 1 given swap(tuple& __in) ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/tuple:590:23: error: macro "swap" requires 2 arguments, but only 1 given void swap(tuple&) noexcept { /* no-op */ } ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/tuple:740:23: error: macro "swap" requires 2 arguments, but only 1 given swap(tuple& __in) ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/tuple:1133:35: error: macro "swap" requires 2 arguments, but only 1 given noexcept(noexcept(__x.swap(__y))) ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/tuple:1134:19: error: macro "swap" requires 2 arguments, but only 1 given { __x.swap(__y); } ^ In file included from /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/memory:79:0, from /home/will/.arduino15/packages/esp32/hardware/esp32/1.0.5/libraries/FS/src/FS.h:24, from /home/will/.arduino15/packages/esp32/hardware/esp32/1.0.5/libraries/FFat/src/FFat.h:18, from sketch/neomatrix_config.h:179, from /home/will/Arduino/3rdParty/FastLED_NeoMatrix_SmartMatrix_LEDMatrix_GFX_Demos/FastLED/Vortex/Vortex.ino:1: /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/functional:2035:16: error: macro "swap" requires 2 arguments, but only 1 given __x.swap(*this); ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/functional:2075:26: error: macro "swap" requires 2 arguments, but only 1 given function(__x).swap(*this); ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/functional:2093:37: error: macro "swap" requires 2 arguments, but only 1 given function(std::move(__x)).swap(*this); ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/functional:2136:52: error: macro "swap" requires 2 arguments, but only 1 given function(std::forward<_Functor>(__f)).swap(*this); ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/functional:2145:28: error: macro "swap" requires 2 arguments, but only 1 given function(__f).swap(*this); ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/functional:2158:30: error: macro "swap" requires 2 arguments, but only 1 given void swap(function& __x) ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/functional:2374:19: error: macro "swap" requires 2 arguments, but only 1 given { __x.swap(__y); } ^ In file included from /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/memory:81:0, from /home/will/.arduino15/packages/esp32/hardware/esp32/1.0.5/libraries/FS/src/FS.h:24, from /home/will/.arduino15/packages/esp32/hardware/esp32/1.0.5/libraries/FFat/src/FFat.h:18, from sketch/neomatrix_config.h:179, from /home/will/Arduino/3rdParty/FastLED_NeoMatrix_SmartMatrix_LEDMatrix_GFX_Demos/FastLED/Vortex/Vortex.ino:1: /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/unique_ptr.h:349:27: error: macro "swap" requires 2 arguments, but only 1 given swap(unique_ptr& __u) noexcept ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/unique_ptr.h:591:27: error: macro "swap" requires 2 arguments, but only 1 given swap(unique_ptr& __u) noexcept ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/unique_ptr.h:618:28: error: macro "swap" passed 4 arguments, but takes just 2 unique_ptr<_Tp, _Dp>& __y) noexcept ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/unique_ptr.h:619:19: error: macro "swap" requires 2 arguments, but only 1 given { __x.swap(__y); } ^ In file included from /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/shared_ptr.h:52:0, from /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/memory:82, from /home/will/.arduino15/packages/esp32/hardware/esp32/1.0.5/libraries/FS/src/FS.h:24, from /home/will/.arduino15/packages/esp32/hardware/esp32/1.0.5/libraries/FFat/src/FFat.h:18, from sketch/neomatrix_config.h:179, from /home/will/Arduino/3rdParty/FastLED_NeoMatrix_SmartMatrix_LEDMatrix_GFX_Demos/FastLED/Vortex/Vortex.ino:1: /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/shared_ptr_base.h:992:43: error: macro "swap" requires 2 arguments, but only 1 given __shared_ptr(std::move(__r)).swap(*this); ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/shared_ptr_base.h:1000:41: error: macro "swap" requires 2 arguments, but only 1 given __shared_ptr(std::move(__r)).swap(*this); ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/shared_ptr_base.h:1008:43: error: macro "swap" requires 2 arguments, but only 1 given __shared_ptr(std::move(__r)).swap(*this); ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/shared_ptr_base.h:1016:43: error: macro "swap" requires 2 arguments, but only 1 given __shared_ptr(std::move(__r)).swap(*this); ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/shared_ptr_base.h:1022:34: error: macro "swap" requires 2 arguments, but only 1 given { __shared_ptr().swap(*this); } ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/shared_ptr_base.h:1030:32: error: macro "swap" requires 2 arguments, but only 1 given __shared_ptr(__p).swap(*this); ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/shared_ptr_base.h:1036:37: error: macro "swap" requires 2 arguments, but only 1 given { __shared_ptr(__p, __d).swap(*this); } ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/shared_ptr_base.h:1041:60: error: macro "swap" requires 2 arguments, but only 1 given { __shared_ptr(__p, __d, std::move(__a)).swap(*this); } ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/shared_ptr_base.h:1299:66: error: macro "swap" passed 4 arguments, but takes just 2 swap(__shared_ptr<_Tp, _Lp>& __a, __shared_ptr<_Tp, _Lp>& __b) noexcept ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/shared_ptr_base.h:1300:19: error: macro "swap" requires 2 arguments, but only 1 given { __a.swap(__b); } ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/shared_ptr_base.h:1454:32: error: macro "swap" requires 2 arguments, but only 1 given { __weak_ptr().swap(*this); } ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/shared_ptr_base.h:1457:27: error: macro "swap" requires 2 arguments, but only 1 given swap(__weak_ptr& __s) noexcept ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/shared_ptr_base.h:1484:62: error: macro "swap" passed 4 arguments, but takes just 2 swap(__weak_ptr<_Tp, _Lp>& __a, __weak_ptr<_Tp, _Lp>& __b) noexcept ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/shared_ptr_base.h:1485:19: error: macro "swap" requires 2 arguments, but only 1 given { __a.swap(__b); } ^ In file included from /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/memory:82:0, from /home/will/.arduino15/packages/esp32/hardware/esp32/1.0.5/libraries/FS/src/FS.h:24, from /home/will/.arduino15/packages/esp32/hardware/esp32/1.0.5/libraries/FFat/src/FFat.h:18, from sketch/neomatrix_config.h:179, from /home/will/Arduino/3rdParty/FastLED_NeoMatrix_SmartMatrix_LEDMatrix_GFX_Demos/FastLED/Vortex/Vortex.ino:1: /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/shared_ptr.h:441:19: error: macro "swap" requires 2 arguments, but only 1 given { __a.swap(__b); } ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/shared_ptr.h:534:19: error: macro "swap" requires 2 arguments, but only 1 given { __a.swap(__b); } ^ In file included from /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/memory:83:0, from /home/will/.arduino15/packages/esp32/hardware/esp32/1.0.5/libraries/FS/src/FS.h:24, from /home/will/.arduino15/packages/esp32/hardware/esp32/1.0.5/libraries/FFat/src/FFat.h:18, from sketch/neomatrix_config.h:179, from /home/will/Arduino/3rdParty/FastLED_NeoMatrix_SmartMatrix_LEDMatrix_GFX_Demos/FastLED/Vortex/Vortex.ino:1: /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/shared_ptr_atomic.h:138:20: error: macro "swap" requires 2 arguments, but only 1 given __p->swap(__r); // use swap so that **__p not destroyed while lock held ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/shared_ptr_atomic.h:153:20: error: macro "swap" requires 2 arguments, but only 1 given __p->swap(__r); // use swap so that **__p not destroyed while lock held ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/shared_ptr_atomic.h:175:20: error: macro "swap" requires 2 arguments, but only 1 given __p->swap(__r); ^ /home/will/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/shared_ptr_atomic.h:194:20: error: macro "swap" requires 2 arguments, but only 1 given __p->swap(__r); ^ exit status 1 Error compiling for board LOLIN D32.

netmindz avatar Mar 06 '21 13:03 netmindz

Commenting out the include to FFat.h seams to at least let me compile now

netmindz avatar Mar 06 '21 13:03 netmindz

Yeah, the ESP8266 and ESP32 toolchains are a bit wonky sometimes, they are known to break max/min, and nwo it seems to be swap, sigh. I've just compiled this on ESP32 right now, and it works fine for me.

Looks like mine is more recent than yours:

sauron:~$ /home/merlin/Arduino/hardware/espressif/esp32/tools/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc --version
xtensa-esp32-elf-gcc (crosstool-NG crosstool-ng-1.22.0-80-g6c4433a) 5.2.0

That's also weird is that Ffat actually comes from the ESP32 toolchain, so it's disappointing that yours seems not to work within your own toolchain. Try upgrading it.

That said, as you also figured out, you don't need FFat for that example, so commenting it out would be all you need for now, correct?

marcmerlin avatar Mar 06 '21 16:03 marcmerlin

I can compile with 1.0.5 but it breaks the Aurora samples. I rolled back to 1.0.4 and all is good now. Twinklefox runs in 1.0.5 tho.

VonHirsch avatar Mar 14 '21 00:03 VonHirsch

Looks like the fix would be to replace swap with SWAP in the code so that it didn't conflict with the incompatible version in esp32 Arduino toolchain

marcmerlin avatar Mar 14 '21 03:03 marcmerlin

where's the collision marc? in a define? I can't grep it

VonHirsch avatar Mar 14 '21 05:03 VonHirsch

I haven't looked at the code so it's just a guess, but the arduino-esp32 has been redefining things like min and max, which breaks a lot of things (and why i had to move all my code to mmin and mmax). My guess is that they broke swap also in a recent version. So, find whatever define is used for swap() in arduino, define it as mswap, and change the code to use mswap instead so that it doesn't use the broken version from esp32. I'm happy to include this change when I get home after you confirm that it fixed things.

marcmerlin avatar Mar 15 '21 15:03 marcmerlin

sorry, I lost track on this, did I need to include a fix?

marcmerlin avatar Jun 19 '21 04:06 marcmerlin

I'm a bit confused because I thought I already fixed Aurora to use mmin mmax, do you have an old version?

neomatrix_config.h:#define mmin(a,b) ((a<b)?(a):(b))
PatternAttract.h:    const int count = mmin(MATRIX_HEIGHT/3, AVAILABLE_BOID_COUNT);
PatternBounce.h:    static const int count = mmin(MATRIX_WIDTH, AVAILABLE_BOID_COUNT);
PatternCube.h:    int cubeWidth = mmin(MATRIX_WIDTH-4,MATRIX_HEIGHT-4); // Cube size
PatternCube.h:        blur2d(effects.leds, mmin(MATRIX_WIDTH, 255), mmin(MATRIX_HEIGHT, 255), 255);
PatternCube.h:        fadeToBlackBy( matrixleds, mmin(NUMMATRIX,65535), 40);
PatternCube.h:      //fadeToBlackBy( matrixleds, mmin(NUMMATRIX,65535), 128);
PatternCube.h:      zCamera = beatsin8(2, mmin(MATRIX_WIDTH*2.5, 120.0), 160);
PatternFlock.h:    static const int boidCount = mmin(MATRIX_WIDTH/3, AVAILABLE_BOID_COUNT);
PatternIncrementalDrift.h:        //uint8_t x = beatcos8((mmin(MATRIX_CENTER_X, MATRIX_CENTER_Y) + 1 - i) * 2, MATRIX_CENTER_X - i, MATRIX_CENTER_X + i);
PatternIncrementalDrift.h:        //uint8_t y = beatsin8((mmin(MATRIX_CENTER_X, MATRIX_CENTER_Y) + 1 - i) * 2, MATRIX_CENTER_Y - i, MATRIX_CENTER_Y + i);
PatternSwirl.h:	  blur2d(effects.leds, mmin(MATRIX_WIDTH, 255), mmin(MATRIX_HEIGHT, 255), blurAmount);
PatternSwirl.h:	  blur2d(effects.leds, mmin(MATRIX_WIDTH, 255), mmin(MATRIX_HEIGHT, 255), 172);

marcmerlin avatar Jun 19 '21 04:06 marcmerlin

sorry I lost track too. I'll try to find what I was doing and compile.

VonHirsch avatar Jun 19 '21 04:06 VonHirsch