From fd5f28af2560df0cbeed9b76c022b61457a2fe57 Mon Sep 17 00:00:00 2001 From: Juan Hoyos Date: Thu, 18 Nov 2021 16:12:01 -0800 Subject: [PATCH] [release/3.1] Stop leaking atoll in pal and fix unicode header lookup (#28220) * Stop leaking atoll in pal This fixes the build in newer OSX SDKs. * Port modified version of dotnet/runtime#56829 --- .../System.Globalization.Native/CMakeLists.txt | 13 +++++++++---- src/pal/src/include/pal/palinternal.h | 2 ++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/corefx/System.Globalization.Native/CMakeLists.txt b/src/corefx/System.Globalization.Native/CMakeLists.txt index 038de6de554d..69c8153b241f 100644 --- a/src/corefx/System.Globalization.Native/CMakeLists.txt +++ b/src/corefx/System.Globalization.Native/CMakeLists.txt @@ -7,9 +7,14 @@ add_definitions(-DBIT64) set(ICU_HOMEBREW_INC_PATH "/usr/local/opt/icu4c/include") -find_path(UTYPES_H "unicode/utypes.h" PATHS ${ICU_HOMEBREW_INC_PATH}) -if(UTYPES_H STREQUAL UTYPES_H-NOTFOUND) - message(FATAL_ERROR "Cannot find utypes.h, try installing libicu-dev (or the appropriate package for your platform)") +if (CLR_CMAKE_PLATFORM_DARWIN) + execute_process(COMMAND brew --prefix OUTPUT_VARIABLE brew_prefix OUTPUT_STRIP_TRAILING_WHITESPACE) + set(ICU_HOMEBREW_INC_PATH "${brew_prefix}/opt/icu4c/include") +endif() + +find_path(UCURR_H "unicode/ucurr.h" PATHS ${ICU_HOMEBREW_INC_PATH}) +if(UCURR_H STREQUAL UCURR_H-NOTFOUND) + message(FATAL_ERROR "Cannot find ucurr.h, try installing libicu-dev (or the appropriate package for your platform)") return() endif() @@ -44,7 +49,7 @@ set(NATIVEGLOBALIZATION_SOURCES pal_icushim.c ) -include_directories(${UTYPES_H}) +include_directories(${UCURR_H}) _add_library(System.Globalization.Native SHARED diff --git a/src/pal/src/include/pal/palinternal.h b/src/pal/src/include/pal/palinternal.h index 77978f30d75a..12e161dff188 100644 --- a/src/pal/src/include/pal/palinternal.h +++ b/src/pal/src/include/pal/palinternal.h @@ -206,6 +206,7 @@ function_name() to call the system's implementation #define srand DUMMY_srand #define atoi DUMMY_atoi #define atof DUMMY_atof +#define atoll DUMMY_atoll #define tm PAL_tm #define size_t DUMMY_size_t #define time_t PAL_time_t @@ -413,6 +414,7 @@ function_name() to call the system's implementation #undef wint_t #undef atoi #undef atol +#undef atoll #undef atof #undef malloc #undef realloc