summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmair Majid <omajid@redhat.com>2020-02-18 13:27:24 -0500
committerGitHub <noreply@github.com>2020-02-18 10:27:23 -0800
commit25bb13bc33c5911c6319722203dbb83eaebe7b08 (patch)
treee4745d0f4a3d8e3309a9e3df799aae28f36506a8
parenta74f1dbf5a3aed3c4f5ba723641598aac07c31d9 (diff)
downloadcoreclr-25bb13bc33c5911c6319722203dbb83eaebe7b08.tar.gz
coreclr-25bb13bc33c5911c6319722203dbb83eaebe7b08.tar.bz2
coreclr-25bb13bc33c5911c6319722203dbb83eaebe7b08.zip
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.
-rw-r--r--configurecompiler.cmake4
1 files changed, 4 insertions, 0 deletions
diff --git a/configurecompiler.cmake b/configurecompiler.cmake
index 41da56307b..d769e82f57 100644
--- a/configurecompiler.cmake
+++ b/configurecompiler.cmake
@@ -503,11 +503,15 @@ if (CLR_CMAKE_PLATFORM_UNIX)
# to a struct or a class that has virtual members or a base class. In that case, clang
# may not generate the same object layout as MSVC.
add_compile_options(-Wno-incompatible-ms-struct)
+ # Do not convert a #warning into an #error
+ add_compile_options("-Wno-error=#warnings")
else()
add_compile_options(-Wno-unused-variable)
add_compile_options(-Wno-unused-but-set-variable)
add_compile_options(-fms-extensions)
add_compile_options(-Wno-unknown-pragmas)
+ # Do not convert a #warning into an #error
+ add_compile_options(-Wno-error=cpp)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
add_compile_options(-Wno-nonnull-compare)
endif()