ltfs icon indicating copy to clipboard operation
ltfs copied to clipboard

Issue during compilation with glibc >= 2.30

Open forrest96er opened this issue 1 year ago • 1 comments

On Linux systems which use glibc ≥2.30 the following will be logged during compilation:

In file included from arch/arch_info.c:52:0: /usr/include/sys/sysctl.h:21:2: error: #warning "The <sys/sysctl.h> header is deprecated and will be removed." [-Werror=cpp] #warning "The <sys/sysctl.h> header is deprecated and will be removed." ^~~~~~~ cc1: all warnings being treated as errors

The release notes for glibc 2.30 read:

“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.”

(See also https://sourceware.org/ml/libc-alpha/2019-08/msg00029.html for the full release notes.)

To Reproduce

1 install glibc and glibc-dev / glibc-devel >= 2.30

2 compile ltfs v. 2.4.5.0 : ./autogen.sh ./configure --prefix=$1 --enable-message-checker --enable-warning-as-error make

Solution

Because of the deprecated sysctl() function, sysconf() should be used instead.

Source file src/libltfs/arch/arch_info.c

forrest96er avatar Mar 27 '23 22:03 forrest96er

It's not mandatory at this time because the main target is RHEL8 and RHEL7.

But it is good to move the API to sysconf() before reconsidering the main target OSs, because RHEL7 and RHEL8 support the API already.

piste-jp avatar Apr 05 '23 04:04 piste-jp