From 0d46c687312dfcaf44853aaa1d26d9cbc9824c6f Mon Sep 17 00:00:00 2001 From: chenrun1 Date: Fri, 27 Sep 2024 14:03:34 +0800 Subject: [PATCH] libxx:fix build error when enable LIBCXXTOOLCHAIN MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: 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 Signed-off-by: chenrun1 --- libs/libxx/CMakeLists.txt | 2 +- libs/libxx/Makefile | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libs/libxx/CMakeLists.txt b/libs/libxx/CMakeLists.txt index f9856903b932b..6dacc93499c75 100644 --- a/libs/libxx/CMakeLists.txt +++ b/libs/libxx/CMakeLists.txt @@ -32,7 +32,7 @@ if(CONFIG_HAVE_CXX) include(uClibc++.cmake) elseif(CONFIG_LIBCXX) include(libcxx.cmake) - else() + elseif(CONFIG_LIBCXXMINI) include(libcxxmini.cmake) endif() diff --git a/libs/libxx/Makefile b/libs/libxx/Makefile index 7b5bb8ee3a429..396c6646bd0a1 100644 --- a/libs/libxx/Makefile +++ b/libs/libxx/Makefile @@ -33,12 +33,13 @@ ifeq ($(CONFIG_UCLIBCXX),y) include uClibc++.defs else ifeq ($(CONFIG_LIBCXX),y) include libcxx.defs -else +else ifeq ($(CONFIG_LIBCXXMINI),y) include libcxxmini.defs +endif + ifeq ($(CONFIG_ETL),y) include etl.defs endif -endif ifeq ($(CONFIG_LIBCXXABI),y) include libcxxabi.defs