tmedicci commented on PR #14805:
URL: https://github.com/apache/nuttx/pull/14805#issuecomment-2485819722
> > > **STDC_NO_ATOMICS**
> >
> >
> > Hi @zyfeier ! Thanks fo your quick response!
> > In fact, `__STDC_NO_ATOMICS__` wasn't being set. I was able to make it
work with the following patch:
> > ```
> > diff --git a/arch/xtensa/src/lx6/Toolchain.defs
b/arch/xtensa/src/lx6/Toolchain.defs
> > index a979b9a0de..76fee69376 100644
> > --- a/arch/xtensa/src/lx6/Toolchain.defs
> > +++ b/arch/xtensa/src/lx6/Toolchain.defs
> > @@ -97,7 +97,7 @@ ifeq ($(CONFIG_ARCH_INSTRUMENT_ALL),y)
> > ARCHOPTIMIZATION += -finstrument-functions
> > endif
> >
> > -ARCHCFLAGS += -fno-common
> > +ARCHCFLAGS := -fno-common
> > ARCHCXXFLAGS += -fno-common
> >
> > ARCHCFLAGS += -Wall -Wstrict-prototypes -Wshadow -Wundef
-Wno-attributes -Wno-unknown-pragmas
> > @@ -156,7 +156,7 @@ ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
> > endif
> >
> > ifeq ($(CONFIG_LIBC_ARCH_ATOMIC),y)
> > - CFLAGS += -D__STDC_NO_ATOMICS__
> > + ARCHCFLAGS += -D__STDC_NO_ATOMICS__
> > endif
> >
> > # Default toolchain
> > ```
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > I had to set `__STDC_NO_ATOMICS__` to `ARCHCFLAGS`. However, this flag
was being set twice while compiling `esp32_boot.c` and a redefinition error
occurred. That's why I had to change it to `ARCHCFLAGS := -fno-common` (to let
it be defined instead of redefined to avoid duplication). I couldn't find
`ARCHCFLAGS :=` anywhere else in the firmware (I couldn't understand why it was
being redefined when processing `esp32_boot.c` too), so I'm not sure if this
patch is acceptable. Any ideas?
>
> @tmedicci I found that when compiling esp32/common, scripts/Make.defs is
included twice, which causes the flags in ARCHCFLAGS to be doubled.
That's perfect!
I was able to make it work (and, in fact, it fixes `esp32-devkitc:sotest`,
`esp32-devkitc:elf` and `esp32-devkitc:module`). However, it's failing to build
`esp32-devkitc:wamr_wasi_debug`:
```
make -j distclean && ./tools/configure.sh esp32-devkitc:wamr_wasi_debug &&
make -s -j$(nproc)
.
.
.
CC: dirent/lib_closedir.c In file included from
wamr/core/shared/utils/../platform/include/platform_api_extension.h:128,
from wamr/core/shared/utils/bh_platform.h:11,
from wamr/core/iwasm/aot/aot_runtime.h:9,
from wamr/core/iwasm/aot/aot_intrinsic.h:9,
from wamr/core/iwasm/aot/aot_intrinsic.c:6:
/home/tiago/.espressif/tools/xtensa-esp32-elf/esp-12.2.0_20230208/xtensa-esp32-elf/lib/gcc/xtensa-esp32-elf/12.2.0/include/stdatomic.h:31:5:
error: redeclaration of enumerator 'memory_order_relaxed'
31 | memory_order_relaxed = __ATOMIC_RELAXED,
| ^~~~~~~~~~~~~~~~~~~~
In file included from
/home/tiago/Documents/work/espressif/projects/nuttx/nuttxspace_beta/nuttx/include/nuttx/atomic.h:90,
from
/home/tiago/Documents/work/espressif/projects/nuttx/nuttxspace_beta/nuttx/include/nuttx/fs/fs.h:45,
from
/home/tiago/Documents/work/espressif/projects/nuttx/nuttxspace_beta/nuttx/include/stdio.h:36,
from wamr/core/shared/platform/nuttx/platform_internal.h:20,
from
wamr/core/shared/utils/../platform/include/platform_common.h:13,
from wamr/core/shared/utils/bh_platform.h:9:
/home/tiago/Documents/work/espressif/projects/nuttx/nuttxspace_beta/nuttx/include/nuttx/lib/stdatomic.h:170:5:
note: previous definition of 'memory_order_relaxed' with type 'enum
<anonymous>'
170 | memory_order_relaxed = __ATOMIC_RELAXED,
| ^~~~~~~~~~~~~~~~~~~~
.
.
.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]