What is the cause of this build failure?

I am building the ESP32 T-Watch 2020 V3, the repo notes say to use Linux, as there is a failure with platformio and Windows - to do with the size of the project

GitHub - sharandac/My-TTGO-Watch: A GUI named hedge for smartwatch like devices based on ESP32. Currently support for T-Watch2020 (V1,V2,V3), T-Watch2021, M5Paper, M5Core2 and native Linux support for testing.

I tried this combination of windows and repo, and it does fail, building with verbose mode I get some info on why, but what is the real reason its failing ? Is it project size like the repo readme says ? (I have 64 GB of DDR5 on my PC - so they must be sugesting the binary size for the ESP32 in the watch - but why would the toolchain on windows build a different elf/FW bin to linux ?

The end compilation message merely says

xtensa-esp32-elf-g++: error: CreateProcess: No such file or directory
*** [.pio\build\t-watch2020-v3\firmware.elf] Error 1

The messages before the failure this say - so is the problem the circular dependency (which I could not find), or the incompatible lib ?

Platform incompatible library G:\SDK_FW_3rd\LILYGO_T_WATCH_2020\My-TTGO-Watch.pio\libdeps\t-watch2020-v3\ESPAsyncTCP
More details about “Library Compatibility Mode”: Redirecting...
Found 47 compatible libraries

Scanning dependencies…
Warning: Ignored ESPAsyncTCP dependency for ESP Async WebServer library
Warning: Ignored Hash dependency for ESP Async WebServer library
Warning! Circular dependencies detected between G:\SDK_FW_3rd\LILYGO_T_WATCH_2020\My-TTGO-Watch\.pio\libdeps\t-watch2020-v3\TTGO TWatch Library and G:\SDK_FW_3rd\LILYGO_T_WATCH_2020\My-TTGO-Watch\.pio\libdeps\t-watch2020-v3\lvgl
Warning! Circular dependencies detected between G:\SDK_FW_3rd\LILYGO_T_WATCH_2020\My-TTGO-Watch\.pio\libdeps\t-watch2020-v3\TTGO TWatch Library and G:\SDK_FW_3rd\LILYGO_T_WATCH_2020\My-TTGO-Watch\.pio\libdeps\t-watch2020-v3\lvgl
Warning! Circular dependencies detected between G:\SDK_FW_3rd\LILYGO_T_WATCH_2020\My-TTGO-Watch\.pio\libdeps\t-watch2020-v3\TTGO TWatch Library and G:\SDK_FW_3rd\LILYGO_T_WATCH_2020\My-TTGO-Watch\.pio\libdeps\t-watch2020-v3\lvgl

Interesting that I cloned that project and compiled the t-watch2020-v1 environment with 0 problems. The v3 environment however does fail with the same error.

Looking at the verbose build commands,

Using tempfile C:\Users\Max\temp\My-TTGO-Watch.pio\build\t-watch2020-v3\tmp0_63hecv.tmp for command line:
xtensa-esp32-elf-g++ --o .pio/build/t-watch2020-v3/firmware.elf -T esp32_out.ld -Wl,–gc-sections -nostdlib -Wl,-static -u call_user_start_cpu0 -Wl,–undefined=uxTopUsedPriority -Wl,–gc-sections -Wl,-EL -T esp32.project.ld -T esp32.rom.ld -T esp32.peripherals.ld -T esp32.rom.libgcc.ld -T esp32.rom.spiram_incompatible_fns.ld -u ld_include_panic_highint_hdl -u __cxa_guard_dummy -u __cxx_fatal_exception .pio/build/t-watch2020-v3/timezones.json.txt.o .pio/build/t-watch2020-v3/osmtileserver.json.txt.o .pio/build/t-watch2020-v3/src/app/FindPhone/FindPhone.cpp.o .pio/build/t-watch2020-v3/src/app/FindPhone/FindPhone_main.cpp.[…] HUGE OMMISION […]
-lexpat -lmesh -lm -lprotocomm -lwear_levelling -lnewlib -lpe -lfatfs -lbootloader_support -lmdns -lasio -lmbedtls -lapp_trace -lsdmmc -lhal -ltcp_transport -lface_recognition -lnghttp -lesp32 -lesp_adc_cal -ljsmn -lcore -limage_util -lheap -lcoap -lbt -lcxx -lwps -lnet80211 -lod -lunity -lwpa_supplicant -lspiffs -lmqtt -lwpa -lespnow -lfd -lesp_event -lcoexist -lpp -llwip -lphy -lmicro-ecc -llog -ljson -lesp_http_server -lesp32-camera -lfreertos -lulp -lespcoredump -lwpa2 -lsmartconfig_ack -lnvs_flash -lopenssl -ldl -lprotobuf-c -lesp_http_client -lspi_flash -lethernet -ldriver -lesp_websocket_client -lvfs -lbtdm_app -lstdc++ -Wl,–end-group
xtensa-esp32-elf-g++ @C:\Users\Max\temp\My-TTGO-Watch.pio\build\t-watch2020-v3\tmp0_63hecv.tmp

It is clear that this exceeds the limit 32K for CreateProcess()

xtensa-esp32-elf-g++: error: CreateProcess: No such file or directory

of Windows outlined here, since…

Linux works differently has differnt limits – 32K is apparently not a problem for it.

The majority of the commandline is just the absolute insane amount of source files (748, 259 alone for “GUI images” in .c formatt) and their path lengths in the src/ folder. If they would just restructure that to e.g. be in lib/, then PlatformIO would first compile that library into a single .a library file which contributes only one .a filepath in the final linker command.

Thanks @maxgerhardt for putting the effort in to answer this, if I fork this maybe I’ll make that lot into a lib so the linker command line is acceptable in windows.

As a desperate temporary workaround I just relocated my .platformio directory from my Windows user directory to c:\.platformio by setting the following environment variable:
PLATFORMIO_CORE_DIR=c:\.platformio

Because the path to this directory is used so many times in the build command this relocation seems to have shortened the command just enough to be under the 32k limit mentioned above. If I get more desperate I’ll shorten the directory name to c:\p

Yes this is a terrible sad hack, but hopefully the esp32 environment will be repackaged in the not too distant future.