Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Regression when building with C++ toolchain enabled #13648

Closed
1 task done
leducp opened this issue Sep 26, 2024 · 5 comments · Fixed by #13663
Closed
1 task done

[BUG] Regression when building with C++ toolchain enabled #13648

leducp opened this issue Sep 26, 2024 · 5 comments · Fixed by #13663
Labels
Arch: arm Issues related to ARM (32-bit) architecture Area: Build system

Comments

@leducp
Copy link
Contributor

leducp commented Sep 26, 2024

Description / Steps to reproduce the issue

Since commit 4cec713 I cannot build the stm32f411e-disco:nsh example with libcxxtoolchain enabled.

To reproduce:

git co 4cec713dbf86c82e1f48abb0815dfd2f98016b68
./tools/configure.sh -E -l stm32f411e-disco:nsh
make menuconfig <- enable libcxxtoolchain (LIBCXXTOOLCHAIN [=y])
make

Got this error:

P:➜  nuttx git:(4cec713dbf) LC_ALL=C make     
CC:  chip/stm32_gpio.c chip/stm32_gpio.c:41:11: note: '#pragma message: CONFIG_STM32_USE_LEGACY_PINMAP will be deprecated migrate board.h see tools/stm32_pinmap_tool.py'
   41 | #  pragma message "CONFIG_STM32_USE_LEGACY_PINMAP will be deprecated migrate board.h see tools/stm32_pinmap_tool.py"
      |           ^~~~~~~
CXX:  libcxxmini/libxx_new.cxx libcxxmini/libxx_new.cxx:72:11: error: redefinition of 'void* operator new(std::size_t, void*)'
   72 | FAR void *operator new(std::size_t nbytes, FAR void *ptr)
      |           ^~~~~~~~
In file included from /usr/include/newlib/c++/13.2.1/bits/atomic_base.h:36,
                 from /usr/include/newlib/c++/13.2.1/atomic:41,
                 from /home/leduc/wdc_workspace/src/autre/nuttx_dev/nuttx/include/nuttx/atomic.h:32,
                 from /home/leduc/wdc_workspace/src/autre/nuttx_dev/nuttx/include/nuttx/fs/fs.h:38,
                 from /home/leduc/wdc_workspace/src/autre/nuttx_dev/nuttx/include/nuttx/lib/lib.h:30,
                 from libcxxmini/libxx_new.cxx:29:
/usr/include/newlib/c++/13.2.1/new:174:33: note: 'void* operator new(std::size_t, void*)' previously defined here
  174 | _GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
      |                                 ^~~~~~~~
make[1]: *** [Makefile:69: libxx_new.o] Error 1
make: *** [tools/LibTargets.mk:216: libs/libxx/libxx.a] Error 2

I'm not really sure to understand why the build system is targeting the libcxxmini in first place.

On which OS does this issue occur?

[OS: Linux]

What is the version of your OS?

Debian testing

NuttX Version

master

Issue Architecture

[Arch: arm]

Issue Area

[Area: Build System]

Verification

  • I have verified before submitting the report.
@github-actions github-actions bot added Arch: arm Issues related to ARM (32-bit) architecture Area: Build system labels Sep 26, 2024
@leducp
Copy link
Contributor Author

leducp commented Sep 26, 2024

The previous commit works fine, but since commit 4cec713 is unrelated to build system, it seems the bug was here before in atomic.h header.

@xiaoxiang781216
Copy link
Contributor

@crafcat7 please take a look. @leducp it's better to enable libcxxtoolchain in one of mainline defconfig to catch the similar issue in the future.

@crafcat7
Copy link
Contributor

crafcat7 commented Sep 27, 2024

Hi, This problem has been found in

ifeq ($(CONFIG_UCLIBCXX),y)
include uClibc++.defs
else ifeq ($(CONFIG_LIBCXX),y)
include libcxx.defs
else
include libcxxmini.defs
ifeq ($(CONFIG_ETL),y)
include etl.defs
endif
endif

When LIBCXXTOOLCHAIN ​​is enabled, LIBCXXMINI should not be included in the compilation because they are mutually exclusive

I submitted a PR to fix this issue:#13663

@leducp
Copy link
Contributor Author

leducp commented Sep 27, 2024

@crafcat7 please take a look. @leducp it's better to enable libcxxtoolchain in one of mainline defconfig to catch the similar issue in the future.

OK but... what is a "mainline" defconfig? 😅

@xiaoxiang781216
Copy link
Contributor

you can add a new one, or reuse one of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arch: arm Issues related to ARM (32-bit) architecture Area: Build system
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants