Description
I'm trying to build the light example in order to help contributing to #854 now that Matter has achieved v1.0.0 release.
To build with platformio I did the following on the esp-matter light example:
- I created a
platform.ini
with the following content:
[platformio]
src_dir = main
[env]
platform = espressif32
framework = espidf
monitor_speed = 115200
extra_scripts = pre:pre.py
[env:esp32dev]
board = esp32dev
- Created an extra-script that will be executed before building (as declared at platform.ini) to solve some environment variables problems:
import os
os.environ["PATH"] += ":/workspaces/esp-matter/connectedhomeip/connectedhomeip/.environment/cipd/packages/pigweed/"
os.environ["ESP_MATTER_PATH"] = "/workspaces/esp-matter"
But build failed and this showed at the build log:
*** Two environments with different actions were specified for the same target: /workspaces/esp-matter/examples/light/.pio/build/esp32dev/chip.o
(action 1: xtensa-esp32-elf-g++ -o chip.o -c -mlongcalls -Wno-frame-address -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -ggdb -Og -fmacro-prefix-map=/workspaces/esp-matter/examples/light=. -fmacro-prefix-map=/home/codespace/.platformio/packages/framework-espidf=IDF -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -fno-jump-tables -fno-tree-switch-conversion -Wno-error=uninitialized -Wno-error=maybe-uninitialized -Wno-missing-field-initializers -Wno-format-nonliteral -Wno-format-security -Wformat=0 -Wno-old-style-declaration -Os -DPLATFORMIO=60104 -DARDUINO_ESP32_DEV -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" -D_GNU_SOURCE -DIDF_VER=\"4.4.2\" -DESP_PLATFORM -D_POSIX_READER_WRITER_LOCKS chip.cpp)
(action 2: xtensa-esp32-elf-g++ -o chip.o -c -std=gnu++11 -std=gnu++14 -mlongcalls -Wno-frame-address -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -ggdb -Og -fmacro-prefix-map=/workspaces/esp-matter/examples/light=. -fmacro-prefix-map=/home/codespace/.platformio/packages/framework-espidf=IDF -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -fno-jump-tables -fno-tree-switch-conversion -Wno-error=uninitialized -Wno-error=maybe-uninitialized -Wno-missing-field-initializers -Wno-format-nonliteral -Wno-format-security -Wformat=0 -fno-exceptions -fno-rtti -Os -DPLATFORMIO=60104 -DARDUINO_ESP32_DEV -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" -DCHIP_HAVE_CONFIG_H -D_GNU_SOURCE -DIDF_VER=\"4.4.2\" -DESP_PLATFORM -D_POSIX_READER_WRITER_LOCKS chip.cpp)
File "/home/codespace/.platformio/platforms/espressif32/builder/frameworks/espidf.py", line 643, in compile_source_files
I tried to solve it by setting build flags (and unflags) to platformio.ini
:
build_unflags =
-std=gnu++11
-Wno-old-style-declaration
build_flags =
-std=gnu++14
-DCHIP_HAVE_CONFIG_H
-fno-rtti
-fno-exceptions
But then I got this:
warning: Two different environments were specified for target /workspaces/esp-matter/examples/light/.pio/build/esp32dev/chip.o,
but they appear to have the same action: ${TEMPFILE('$CXX -o $TARGET -c $CXXFLAGS $CCFLAGS $_CCCOMCOM $SOURCES','$CXXCOMSTR')}
File "/home/codespace/.platformio/platforms/espressif32/builder/frameworks/espidf.py", line 643, in compile_source_files
*** Multiple ways to build the same target were specified for: /workspaces/esp-matter/examples/light/.pio/build/esp32dev/chip.o (from ['/workspaces/esp-matter/connectedhomeip/connectedhomeip/config/esp32/components/chip/chip.c'] and from ['/workspaces/esp-matter/connectedhomeip/connectedhomeip/config/esp32/components/chip/chip.cpp'])
File "/home/codespace/.platformio/platforms/espressif32/builder/frameworks/espidf.py", line 643, in compile_source_files
To avoid more problems with chip.o
, I deleted chip.c
(for example, maybe chip.cpp
can be deleted instead too) and references to this file because I didn't know how to continue, but build failed again:
Compiling .pio/build/esp32dev/main/app_driver.o
sh: 1: cannot open lib/address_resolve/AddressResolve_DefaultImpl.h: No such file
Compiling .pio/build/esp32dev/main/app_main.o
Generating LD script .pio/build/esp32dev/memory.ld
sh: 1: cannot open lib/address_resolve/AddressResolve_DefaultImpl.h: No such file
Compiling .pio/build/esp32dev/app_ble.o
*** [.pio/build/esp32dev/main/app_driver.o] Error 2
*** [.pio/build/esp32dev/main/app_main.o] Error 2
The file refers to /workspaces/esp-matter/connectedhomeip/connectedhomeip/src/lib/address_resolve/AddressResolve_DefaultImpl.h
which exist...
I would be very grateful if anyone can help me to build the example