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

Commit 25bb13b

Browse files
authored
Fix build on systems with glibc >= 2.30 (#28012)
On newer systems with glibc 2.30, the compiler emits a warning: In file included from coreclr/src/pal/src/misc/sysinfo.cpp:32: /usr/include/sys/sysctl.h:21:2: error: "The <sys/sysctl.h> header is deprecated and will be removed." [-Werror,-W#warnings] #warning "The <sys/sysctl.h> header is deprecated and will be removed." ^ The glibc 2.30 release notes cover this at https://sourceware.org/ml/libc-alpha/2019-08/msg00029.html: * The Linux-specific <sys/sysctl.h> header and the sysctl function have been deprecated and will be removed from a future version of glibc. Application should directly access /proc instead. For obtaining random bits, the getentropy function can be used. To keep coreclr release/3.1 building, disable treating the #warning as an error. Clang and GCC have separate flags to turn this error off.
1 parent a74f1db commit 25bb13b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

configurecompiler.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,11 +503,15 @@ if (CLR_CMAKE_PLATFORM_UNIX)
503503
# to a struct or a class that has virtual members or a base class. In that case, clang
504504
# may not generate the same object layout as MSVC.
505505
add_compile_options(-Wno-incompatible-ms-struct)
506+
# Do not convert a #warning into an #error
507+
add_compile_options("-Wno-error=#warnings")
506508
else()
507509
add_compile_options(-Wno-unused-variable)
508510
add_compile_options(-Wno-unused-but-set-variable)
509511
add_compile_options(-fms-extensions)
510512
add_compile_options(-Wno-unknown-pragmas)
513+
# Do not convert a #warning into an #error
514+
add_compile_options(-Wno-error=cpp)
511515
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
512516
add_compile_options(-Wno-nonnull-compare)
513517
endif()

0 commit comments

Comments
 (0)