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

Handle glibc sys/sysctl.h deprecation #27048

Merged
merged 1 commit into from
Oct 16, 2019

Conversation

omajid
Copy link
Member

@omajid omajid commented Oct 4, 2019

glibc has deprecated sys/sysctl.h:

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."
 ^
1 error generated.

Fix that by preferring sysconf and only including sys/sysctl.h if HAVE_SYSCONF is not true. This mirrors the order of the implementation code in this file (sysinfo.cpp) which checks for HAVE_SYSCONF before HAVE_SYSCTL.

Fixes #27008

glibc has deprecated sys/sysctl.h:

    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."
     ^
    1 error generated.

Fix that by preferring sysconf and only including sys/sysctl.h if
HAVE_SYSCONF is not true. This mirrors the order of the implementation
code in this file (sysinfo.cpp) which checks for HAVE_SYSCONF
before HAVE_SYSCTL.

Fixes #27008
Copy link
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@omajid
Copy link
Member Author

omajid commented Oct 10, 2019

The windows NT failure looks unrelated (this is PAL code, not used on Windows, right?) Anyone willing to merge this?

@janvorli janvorli merged commit 6ce179a into dotnet:master Oct 16, 2019
jkotas added a commit to dotnet/corert that referenced this pull request Dec 27, 2019
omajid added a commit to omajid/dotnet-coreclr that referenced this pull request Feb 8, 2020
glibc has deprecated sys/sysctl.h:

    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."
     ^
    1 error generated.

Fix that by preferring sysconf and only including sys/sysctl.h if
HAVE_SYSCONF is not true. This mirrors the order of the implementation
code in this file (sysinfo.cpp) which checks for HAVE_SYSCONF
before HAVE_SYSCTL.

Fixes #27008
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

coreclr fails to build with glibc 2.30 due to sys/sysctl.h deprecation
3 participants