From b883eb592998965de02b36ddad40ae02e9d88cac Mon Sep 17 00:00:00 2001 From: zhanghongyu Date: Tue, 31 Oct 2023 19:06:50 +0800 Subject: [PATCH] mbedtls: fix build error when libcxx is enabled. if !defined(unix) && !defined(__unix) && !defined(__unix__) && \ !defined(__APPLE__) && !defined(_WIN32) && !defined(__QNXNTO__) && \ !defined(__HAIKU__) && !defined(__midipix__) error "Platform entropy sources only work on Unix and Windows, see MBEDTLS_NO_PLATFORM_ENTROPY in mbedtls_config.h" nuttx/libs/libxx/libcxx/include/__config nuttx/libs/libxx/libcxx/include/limits.h:40, apps/crypto/mbedtls/mbedtls/include/mbedtls/check_config.h:31, apps/crypto/mbedtls/mbedtls/include/mbedtls/build_info.h:151, apps/crypto/mbedtls/mbedtls/library/common.h:26, apps/crypto/mbedtls/mbedtls/library/entropy_poll.c:25 if defined(__NuttX__) undef __linux__ undef __APPLE__ undef __FreeBSD__ undef __GLIBC__ undef __NetBSD__ undef _WIN32 undef __sun__ undef _AIX / For the current use of the __unix__ macro in this library, / NuttX is not __unix__. / This might need to be revisited in future. undef __unix__ endif Signed-off-by: zhanghongyu --- crypto/mbedtls/CMakeLists.txt | 2 +- crypto/mbedtls/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crypto/mbedtls/CMakeLists.txt b/crypto/mbedtls/CMakeLists.txt index 9d9561814..03bf85316 100644 --- a/crypto/mbedtls/CMakeLists.txt +++ b/crypto/mbedtls/CMakeLists.txt @@ -77,7 +77,7 @@ if(CONFIG_CRYPTO_MBEDTLS) nuttx_export_header(TARGET mbedtls INCLUDE_DIRECTORIES ${MBEDTLS_DIR}/include) target_sources(mbedtls PRIVATE ${CSRCS}) target_include_directories(mbedtls PRIVATE ${INCDIR}) - target_compile_definitions(mbedtls PRIVATE __unix__) + target_compile_definitions(mbedtls PRIVATE unix) if(CONFIG_ARCH_SIM) target_compile_options(mbedtls PRIVATE -O0) diff --git a/crypto/mbedtls/Makefile b/crypto/mbedtls/Makefile index 400259dcd..bb79154c3 100644 --- a/crypto/mbedtls/Makefile +++ b/crypto/mbedtls/Makefile @@ -36,7 +36,7 @@ MBEDTLS_UNPACKLIBDIR = $(MBEDTLS_UNPACKNAME)$(DELIM)library MBEDTLS_UNPACKPROGDIR = $(MBEDTLS_UNPACKNAME)$(DELIM)programs # This lets Mbed TLS better use some of the POSIX features we have -CFLAGS += ${DEFINE_PREFIX}__unix__ +CFLAGS += ${DEFINE_PREFIX}unix mbedtls/library/bignum.c_CFLAGS += -fno-lto