Hi All,
Today after I've refreshed idf (git pull origin master &
git submodule update) I've tried to compile my application and I've got the following error:
esp-idf/components/newlib/locks.c:240:23: error: invalid application of 'sizeof' to incomplete type 'struct __lock'
_Static_assert(sizeof(struct __lock) >= sizeof(StaticSemaphore_t),
I use debian Linux unstable.
How can I fix this error?
thx,
Zamek
after refresh git invalid application of 'sizeof' to incomplete type 'struct __lock'
-
- Posts: 34
- Joined: Sat Dec 02, 2017 7:27 pm
-
- Posts: 9709
- Joined: Thu Nov 26, 2015 4:08 am
Re: after refresh git invalid application of 'sizeof' to incomplete type 'struct __lock'
Are you sure your toolchain is also up-to-date? It should give you a warning if that's not the case.
-
- Posts: 34
- Joined: Sat Dec 02, 2017 7:27 pm
Re: after refresh git invalid application of 'sizeof' to incomplete type 'struct __lock'
Hello,
There is no problem with tool, but I've reinstalled both esp32 and tools. Unfortunately the problem is exists:
idf.py build
Executing action: all (aliases: build)
Running ninja in directory /home/zamek/current/xxxxx/build
Executing "ninja all"...
[11/1278] Generating ../../partition_table/partition-table.bin
Partition table binary generated. Contents:
*******************************************************************************
# ESP-IDF Partition Table
# Name, Type, SubType, Offset, Size, Flags
nvs,data,nvs,0x9000,16K,
otadata,data,ota,0xd000,8K,
phy_init,data,phy,0xf000,4K,
factory,app,factory,0x10000,2M,
ota_0,app,ota_0,0x210000,2M,
ota_1,app,ota_1,0x410000,2M,
nvs_key,data,nvs_keys,0x610000,4K,
*******************************************************************************
...
Generating binary image from built executable
esptool.py v3.2-dev
Merged 1 ELF section
Generated /home/zamek/current/xxxxx/build/bootloader/bootloader.bin
[91/91] cd /home/zamek/current/xxxxx/build/bootloader/esp-idf/esptool_py && /home/zamek/.espressif/python_env/idf4.3_py3.9_env/bin/python /home/zamek/esp/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x1000 /home/zamek/current/xxxxx/build/bootloader/bootloader.bin
...
FAILED: esp-idf/newlib/CMakeFiles/__idf_newlib.dir/locks.c.obj
/home/zamek/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc -Iconfig -I/home/zamek/esp/esp-idf/components/newlib/platform_include -I/home/zamek/esp/esp-idf/components/newlib/priv_include -I/home/zamek/esp/esp-idf/components/freertos/include -I/home/zamek/esp/esp-idf/components/freertos/port/xtensa/include -I/home/zamek/esp/esp-idf/components/esp_hw_support/include -I/home/zamek/esp/esp-idf/components/esp_hw_support/include/soc -I/home/zamek/esp/esp-idf/components/esp_hw_support/port/esp32/. -I/home/zamek/esp/esp-idf/components/heap/include -I/home/zamek/esp/esp-idf/components/log/include -I/home/zamek/esp/esp-idf/components/lwip/include/apps -I/home/zamek/esp/esp-idf/components/lwip/include/apps/sntp -I/home/zamek/esp/esp-idf/components/lwip/lwip/src/include -I/home/zamek/esp/esp-idf/components/lwip/port/esp32/include -I/home/zamek/esp/esp-idf/components/lwip/port/esp32/include/arch -I/home/zamek/esp/esp-idf/components/soc/include -I/home/zamek/esp/esp-idf/components/soc/esp32/. -I/home/zamek/esp/esp-idf/components/soc/esp32/include -I/home/zamek/esp/esp-idf/components/hal/esp32/include -I/home/zamek/esp/esp-idf/components/hal/include -I/home/zamek/esp/esp-idf/components/hal/platform_port/include -I/home/zamek/esp/esp-idf/components/esp_rom/include -I/home/zamek/esp/esp-idf/components/esp_rom/esp32 -I/home/zamek/esp/esp-idf/components/esp_rom/include/esp32 -I/home/zamek/esp/esp-idf/components/esp_common/include -I/home/zamek/esp/esp-idf/components/esp_system/include -I/home/zamek/esp/esp-idf/components/esp_system/port/soc -I/home/zamek/esp/esp-idf/components/esp_system/port/public_compat -I/home/zamek/esp/esp-idf/components/esp32/include -I/home/zamek/esp/esp-idf/components/driver/include -I/home/zamek/esp/esp-idf/components/driver/esp32/include -I/home/zamek/esp/esp-idf/components/esp_pm/include -I/home/zamek/esp/esp-idf/components/esp_ringbuf/include -I/home/zamek/esp/esp-idf/components/efuse/include -I/home/zamek/esp/esp-idf/components/efuse/esp32/include -I/home/zamek/esp/esp-idf/components/xtensa/include -I/home/zamek/esp/esp-idf/components/xtensa/esp32/include -I/home/zamek/esp/esp-idf/components/vfs/include -I/home/zamek/esp/esp-idf/components/esp_wifi/include -I/home/zamek/esp/esp-idf/components/esp_event/include -I/home/zamek/esp/esp-idf/components/esp_netif/include -I/home/zamek/esp/esp-idf/components/esp_eth/include -I/home/zamek/esp/esp-idf/components/tcpip_adapter/include -I/home/zamek/esp/esp-idf/components/esp_phy/include -I/home/zamek/esp/esp-idf/components/esp_phy/esp32/include -I/home/zamek/esp/esp-idf/components/app_trace/include -I/home/zamek/esp/esp-idf/components/esp_timer/include -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=/home/zamek/current/xxxxx=. -fmacro-prefix-map=/home/zamek/esp/esp-idf=IDF -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -std=gnu99 -Wno-old-style-declaration -D_GNU_SOURCE -DIDF_VER=\"v4.4-dev-1849-g8e3e65a47\" -DESP_PLATFORM -MD -MT esp-idf/newlib/CMakeFiles/__idf_newlib.dir/locks.c.obj -MF esp-idf/newlib/CMakeFiles/__idf_newlib.dir/locks.c.obj.d -o esp-idf/newlib/CMakeFiles/__idf_newlib.dir/locks.c.obj -c /home/zamek/esp/esp-idf/components/newlib/locks.c
/home/zamek/esp/esp-idf/components/newlib/locks.c:240:23: error: invalid application of 'sizeof' to incomplete type 'struct __lock'
_Static_assert(sizeof(struct __lock) >= sizeof(StaticSemaphore_t),
^~~~~~
/home/zamek/esp/esp-idf/components/newlib/locks.c:240:16: error: expression in static assertion is not an integer
_Static_assert(sizeof(struct __lock) >= sizeof(StaticSemaphore_t),
^~~~~~
/home/zamek/esp/esp-idf/components/newlib/locks.c: In function '__retarget_lock_init':
/home/zamek/esp/esp-idf/components/newlib/locks.c:286:11: warning: assignment to '_LOCK_T' {aka 'int'} from 'void *' makes integer from pointer without a cast [-Wint-conversion]
*lock = NULL; /* In case lock's memory is uninitialized */
^
/home/zamek/esp/esp-idf/components/newlib/locks.c: In function '__retarget_lock_init_recursive':
/home/zamek/esp/esp-idf/components/newlib/locks.c:292:11: warning: assignment to '_LOCK_T' {aka 'int'} from 'void *' makes integer from pointer without a cast [-Wint-conversion]
*lock = NULL; /* In case lock's memory is uninitialized */
^
In file included from /home/zamek/esp/esp-idf/components/esp_common/include/esp_err.h:18,
from /home/zamek/esp/esp-idf/components/hal/include/hal/cpu_hal.h:20,
from /home/zamek/esp/esp-idf/components/esp_hw_support/include/esp_cpu.h:22,
from /home/zamek/esp/esp-idf/components/esp_hw_support/include/soc/cpu.h:22,
from /home/zamek/esp/esp-idf/components/newlib/locks.c:19:
/home/zamek/esp/esp-idf/components/newlib/locks.c: In function 'check_lock_nonzero':
/home/zamek/esp/esp-idf/components/newlib/locks.c:309:17: warning: comparison between pointer and integer
assert(lock != NULL && "Uninitialized lock used");
^~
/home/zamek/esp/esp-idf/components/newlib/platform_include/assert.h:44:42: note: in definition of macro 'assert'
#define assert(__e) (__builtin_expect(!!(__e), 1) ? (void)0 : __assert_func (__FILE__, __LINE__, \
^~~
[567/1278] Building C object esp-idf/freertos/CMakeFiles/__idf_freertos.dir/tasks.c.obj
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
There is no problem with tool, but I've reinstalled both esp32 and tools. Unfortunately the problem is exists:
idf.py build
Executing action: all (aliases: build)
Running ninja in directory /home/zamek/current/xxxxx/build
Executing "ninja all"...
[11/1278] Generating ../../partition_table/partition-table.bin
Partition table binary generated. Contents:
*******************************************************************************
# ESP-IDF Partition Table
# Name, Type, SubType, Offset, Size, Flags
nvs,data,nvs,0x9000,16K,
otadata,data,ota,0xd000,8K,
phy_init,data,phy,0xf000,4K,
factory,app,factory,0x10000,2M,
ota_0,app,ota_0,0x210000,2M,
ota_1,app,ota_1,0x410000,2M,
nvs_key,data,nvs_keys,0x610000,4K,
*******************************************************************************
...
Generating binary image from built executable
esptool.py v3.2-dev
Merged 1 ELF section
Generated /home/zamek/current/xxxxx/build/bootloader/bootloader.bin
[91/91] cd /home/zamek/current/xxxxx/build/bootloader/esp-idf/esptool_py && /home/zamek/.espressif/python_env/idf4.3_py3.9_env/bin/python /home/zamek/esp/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x1000 /home/zamek/current/xxxxx/build/bootloader/bootloader.bin
...
FAILED: esp-idf/newlib/CMakeFiles/__idf_newlib.dir/locks.c.obj
/home/zamek/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc -Iconfig -I/home/zamek/esp/esp-idf/components/newlib/platform_include -I/home/zamek/esp/esp-idf/components/newlib/priv_include -I/home/zamek/esp/esp-idf/components/freertos/include -I/home/zamek/esp/esp-idf/components/freertos/port/xtensa/include -I/home/zamek/esp/esp-idf/components/esp_hw_support/include -I/home/zamek/esp/esp-idf/components/esp_hw_support/include/soc -I/home/zamek/esp/esp-idf/components/esp_hw_support/port/esp32/. -I/home/zamek/esp/esp-idf/components/heap/include -I/home/zamek/esp/esp-idf/components/log/include -I/home/zamek/esp/esp-idf/components/lwip/include/apps -I/home/zamek/esp/esp-idf/components/lwip/include/apps/sntp -I/home/zamek/esp/esp-idf/components/lwip/lwip/src/include -I/home/zamek/esp/esp-idf/components/lwip/port/esp32/include -I/home/zamek/esp/esp-idf/components/lwip/port/esp32/include/arch -I/home/zamek/esp/esp-idf/components/soc/include -I/home/zamek/esp/esp-idf/components/soc/esp32/. -I/home/zamek/esp/esp-idf/components/soc/esp32/include -I/home/zamek/esp/esp-idf/components/hal/esp32/include -I/home/zamek/esp/esp-idf/components/hal/include -I/home/zamek/esp/esp-idf/components/hal/platform_port/include -I/home/zamek/esp/esp-idf/components/esp_rom/include -I/home/zamek/esp/esp-idf/components/esp_rom/esp32 -I/home/zamek/esp/esp-idf/components/esp_rom/include/esp32 -I/home/zamek/esp/esp-idf/components/esp_common/include -I/home/zamek/esp/esp-idf/components/esp_system/include -I/home/zamek/esp/esp-idf/components/esp_system/port/soc -I/home/zamek/esp/esp-idf/components/esp_system/port/public_compat -I/home/zamek/esp/esp-idf/components/esp32/include -I/home/zamek/esp/esp-idf/components/driver/include -I/home/zamek/esp/esp-idf/components/driver/esp32/include -I/home/zamek/esp/esp-idf/components/esp_pm/include -I/home/zamek/esp/esp-idf/components/esp_ringbuf/include -I/home/zamek/esp/esp-idf/components/efuse/include -I/home/zamek/esp/esp-idf/components/efuse/esp32/include -I/home/zamek/esp/esp-idf/components/xtensa/include -I/home/zamek/esp/esp-idf/components/xtensa/esp32/include -I/home/zamek/esp/esp-idf/components/vfs/include -I/home/zamek/esp/esp-idf/components/esp_wifi/include -I/home/zamek/esp/esp-idf/components/esp_event/include -I/home/zamek/esp/esp-idf/components/esp_netif/include -I/home/zamek/esp/esp-idf/components/esp_eth/include -I/home/zamek/esp/esp-idf/components/tcpip_adapter/include -I/home/zamek/esp/esp-idf/components/esp_phy/include -I/home/zamek/esp/esp-idf/components/esp_phy/esp32/include -I/home/zamek/esp/esp-idf/components/app_trace/include -I/home/zamek/esp/esp-idf/components/esp_timer/include -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=/home/zamek/current/xxxxx=. -fmacro-prefix-map=/home/zamek/esp/esp-idf=IDF -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -std=gnu99 -Wno-old-style-declaration -D_GNU_SOURCE -DIDF_VER=\"v4.4-dev-1849-g8e3e65a47\" -DESP_PLATFORM -MD -MT esp-idf/newlib/CMakeFiles/__idf_newlib.dir/locks.c.obj -MF esp-idf/newlib/CMakeFiles/__idf_newlib.dir/locks.c.obj.d -o esp-idf/newlib/CMakeFiles/__idf_newlib.dir/locks.c.obj -c /home/zamek/esp/esp-idf/components/newlib/locks.c
/home/zamek/esp/esp-idf/components/newlib/locks.c:240:23: error: invalid application of 'sizeof' to incomplete type 'struct __lock'
_Static_assert(sizeof(struct __lock) >= sizeof(StaticSemaphore_t),
^~~~~~
/home/zamek/esp/esp-idf/components/newlib/locks.c:240:16: error: expression in static assertion is not an integer
_Static_assert(sizeof(struct __lock) >= sizeof(StaticSemaphore_t),
^~~~~~
/home/zamek/esp/esp-idf/components/newlib/locks.c: In function '__retarget_lock_init':
/home/zamek/esp/esp-idf/components/newlib/locks.c:286:11: warning: assignment to '_LOCK_T' {aka 'int'} from 'void *' makes integer from pointer without a cast [-Wint-conversion]
*lock = NULL; /* In case lock's memory is uninitialized */
^
/home/zamek/esp/esp-idf/components/newlib/locks.c: In function '__retarget_lock_init_recursive':
/home/zamek/esp/esp-idf/components/newlib/locks.c:292:11: warning: assignment to '_LOCK_T' {aka 'int'} from 'void *' makes integer from pointer without a cast [-Wint-conversion]
*lock = NULL; /* In case lock's memory is uninitialized */
^
In file included from /home/zamek/esp/esp-idf/components/esp_common/include/esp_err.h:18,
from /home/zamek/esp/esp-idf/components/hal/include/hal/cpu_hal.h:20,
from /home/zamek/esp/esp-idf/components/esp_hw_support/include/esp_cpu.h:22,
from /home/zamek/esp/esp-idf/components/esp_hw_support/include/soc/cpu.h:22,
from /home/zamek/esp/esp-idf/components/newlib/locks.c:19:
/home/zamek/esp/esp-idf/components/newlib/locks.c: In function 'check_lock_nonzero':
/home/zamek/esp/esp-idf/components/newlib/locks.c:309:17: warning: comparison between pointer and integer
assert(lock != NULL && "Uninitialized lock used");
^~
/home/zamek/esp/esp-idf/components/newlib/platform_include/assert.h:44:42: note: in definition of macro 'assert'
#define assert(__e) (__builtin_expect(!!(__e), 1) ? (void)0 : __assert_func (__FILE__, __LINE__, \
^~~
[567/1278] Building C object esp-idf/freertos/CMakeFiles/__idf_freertos.dir/tasks.c.obj
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
-
- Posts: 34
- Joined: Sat Dec 02, 2017 7:27 pm
Re: after refresh git invalid application of 'sizeof' to incomplete type 'struct __lock'
hi,
It solved like this: I had to remove whole build directory and idf.py build.
thx,
Zamek
It solved like this: I had to remove whole build directory and idf.py build.
thx,
Zamek
Re: after refresh git invalid application of 'sizeof' to incomplete type 'struct __lock'
Same issue here.
Even after removing the whole build directory, idf.py build will continue to generate the same error:
Even after removing the whole build directory, idf.py build will continue to generate the same error:
Code: Select all
/home/bruno/dev/esp/esp-idf/components/newlib/locks.c:240:23: error: invalid application of 'sizeof' to incomplete type 'struct __lock'
_Static_assert(sizeof(struct __lock) >= sizeof(StaticSemaphore_t),
^~~~~~
/home/bruno/dev/esp/esp-idf/components/newlib/locks.c:240:16: error: expression in static assertion is not an integer
_Static_assert(sizeof(struct __lock) >= sizeof(StaticSemaphore_t),
^~~~~~
/home/bruno/dev/esp/esp-idf/components/newlib/locks.c: In function '__retarget_lock_init':
/home/bruno/dev/esp/esp-idf/components/newlib/locks.c:286:11: warning: assignment to '_LOCK_T' {aka 'int'} from 'void *' makes integer from pointer without a cast [-Wint-conversion]
*lock = NULL; /* In case lock's memory is uninitialized */
^
/home/bruno/dev/esp/esp-idf/components/newlib/locks.c: In function '__retarget_lock_init_recursive':
/home/bruno/dev/esp/esp-idf/components/newlib/locks.c:292:11: warning: assignment to '_LOCK_T' {aka 'int'} from 'void *' makes integer from pointer without a cast [-Wint-conversion]
*lock = NULL; /* In case lock's memory is uninitialized */
^
In file included from /home/bruno/dev/esp/esp-idf/components/esp_common/include/esp_err.h:18,
from /home/bruno/dev/esp/esp-idf/components/hal/include/hal/cpu_hal.h:20,
from /home/bruno/dev/esp/esp-idf/components/esp_hw_support/include/esp_cpu.h:22,
from /home/bruno/dev/esp/esp-idf/components/esp_hw_support/include/soc/cpu.h:22,
from /home/bruno/dev/esp/esp-idf/components/newlib/locks.c:19:
/home/bruno/dev/esp/esp-idf/components/newlib/locks.c: In function 'check_lock_nonzero':
/home/bruno/dev/esp/esp-idf/components/newlib/locks.c:309:17: warning: comparison between pointer and integer
assert(lock != NULL && "Uninitialized lock used");
^~
/home/bruno/dev/esp/esp-idf/components/newlib/platform_include/assert.h:44:42: note: in definition of macro 'assert'
#define assert(__e) (__builtin_expect(!!(__e), 1) ? (void)0 : __assert_func (__FILE__, __LINE__, \
^~~
[568/1150] Building C object esp-idf/freertos/CMakeFiles/__idf_freertos.dir/tasks.c.obj
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
Re: after refresh git invalid application of 'sizeof' to incomplete type 'struct __lock'
This issue is related to using the older version of the toolchain (esp2020-r3) with newer version of ESP-IDF that requires esp2021-r1 toolchain.
If you see the following in the error log:
Please follow the steps below to resolve this (assuming you are using Linux):
1. go to esp-idf directory and run install.sh script (./install.sh). It should say that esp2021-r1 toolchain is either being downloaded, or is already downloaded.
2. source the export script (. ./export.sh).
3. run "xtensa-esp32-elf-gcc --version" to confirm that esp2021-r1 toolchain is now being used
4. go to your project directory and run "idf.py fullclean". This will clear the CMake cache file, that records the toolchain being used
5. build the project again
If you see the following in the error log:
Then esp-2020r3 toolchain is being used./home/zamek/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
Please follow the steps below to resolve this (assuming you are using Linux):
1. go to esp-idf directory and run install.sh script (./install.sh). It should say that esp2021-r1 toolchain is either being downloaded, or is already downloaded.
2. source the export script (. ./export.sh).
3. run "xtensa-esp32-elf-gcc --version" to confirm that esp2021-r1 toolchain is now being used
4. go to your project directory and run "idf.py fullclean". This will clear the CMake cache file, that records the toolchain being used
5. build the project again
Who is online
Users browsing this forum: Baidu [Spider] and 178 guests