Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 53cff17

Browse files
authored
Fix System.Globalization.Native build on Big Sur (#28181)
* Fix System.Globalization.Native build on Big Sur * Fix build * Add flags for Linux
1 parent 3d4e15b commit 53cff17

File tree

3 files changed

+22
-28
lines changed

3 files changed

+22
-28
lines changed

configurecompiler.cmake

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,7 @@ elseif (CLR_CMAKE_PLATFORM_UNIX)
341341
# This linker option causes executables we build to be marked as containing
342342
# position independent code.
343343
# It is necessary to make ASLR work for executables.
344-
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--build-id=sha1 -Wl,-z,relro,-z,now")
345-
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie -Wl,-z,relro,-z,now")
344+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
346345

347346
endif(WIN32)
348347

@@ -359,8 +358,8 @@ endif(CLR_CMAKE_PLATFORM_UNIX)
359358

360359
if(CLR_CMAKE_PLATFORM_LINUX)
361360
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -Wa,--noexecstack")
362-
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--build-id=sha1")
363-
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--build-id=sha1")
361+
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--build-id=sha1 -Wl,-z,relro,-z,now")
362+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--build-id=sha1 -Wl,-z,relro,-z,now")
364363
endif(CLR_CMAKE_PLATFORM_LINUX)
365364
if(CLR_CMAKE_PLATFORM_FREEBSD)
366365
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -Wa,--noexecstack")

src/corefx/System.Globalization.Native/CMakeLists.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,7 @@ if (NOT CLR_CMAKE_PLATFORM_DARWIN)
2626
return()
2727
endif()
2828
else()
29-
find_library(ICUCORE icucore)
30-
if(ICUI18N STREQUAL ICUCORE-NOTFOUND)
31-
message(FATAL_ERROR "Cannot find libicucore, skipping build for System.Globalization.Native. .NET globalization is not expected to function.")
32-
return()
33-
endif()
34-
35-
add_definitions(-DOSX_ICU_LIBRARY_PATH=\"/usr/lib/libicucore.dylib\")
29+
add_definitions(-DOSX_ICU_LIBRARY_PATH="/usr/lib/libicucore.dylib")
3630
endif()
3731

3832
include(configure.cmake)

src/corefx/System.Globalization.Native/configure.cmake

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
1-
include(CheckCSourceCompiles)
2-
include(CheckSymbolExists)
1+
if (CLR_CMAKE_PLATFORM_DARWIN)
2+
set(HAVE_SET_MAX_VARIABLE 1)
3+
set(HAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS 1)
4+
else()
5+
include(CheckCSourceCompiles)
6+
include(CheckSymbolExists)
37

4-
set(CMAKE_REQUIRED_INCLUDES ${UTYPES_H} ${ICU_HOMEBREW_INC_PATH})
8+
set(CMAKE_REQUIRED_INCLUDES ${UTYPES_H} ${ICU_HOMEBREW_INC_PATH})
59

6-
CHECK_C_SOURCE_COMPILES("
7-
#include <unicode/udat.h>
8-
int main(void) { enum UDateFormatSymbolType e = UDAT_STANDALONE_SHORTER_WEEKDAYS; }
9-
" HAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS)
10+
CHECK_C_SOURCE_COMPILES("
11+
#include <unicode/udat.h>
12+
int main(void) { enum UDateFormatSymbolType e = UDAT_STANDALONE_SHORTER_WEEKDAYS; }
13+
" HAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS)
1014

11-
if(NOT CLR_CMAKE_PLATFORM_DARWIN)
1215
set(CMAKE_REQUIRED_LIBRARIES ${ICUUC} ${ICUI18N})
13-
else()
14-
set(CMAKE_REQUIRED_LIBRARIES ${ICUCORE})
15-
endif()
1616

17-
check_symbol_exists(
18-
ucol_setMaxVariable
19-
"unicode/ucol.h"
20-
HAVE_SET_MAX_VARIABLE)
17+
check_symbol_exists(
18+
ucol_setMaxVariable
19+
"unicode/ucol.h"
20+
HAVE_SET_MAX_VARIABLE)
2121

22-
unset(CMAKE_REQUIRED_LIBRARIES)
23-
unset(CMAKE_REQUIRED_INCLUDES)
22+
unset(CMAKE_REQUIRED_LIBRARIES)
23+
unset(CMAKE_REQUIRED_INCLUDES)
24+
endif()
2425

2526
configure_file(
2627
${CMAKE_CURRENT_SOURCE_DIR}/config.h.in

0 commit comments

Comments
 (0)