Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux: <sys/sysctl.h> missing #87

Open
darealshinji opened this issue Jan 1, 2023 · 2 comments · May be fixed by #89
Open

Linux: <sys/sysctl.h> missing #87

darealshinji opened this issue Jan 1, 2023 · 2 comments · May be fixed by #89

Comments

@darealshinji
Copy link

When I try to compile on Linux with GCC I get this error:

  CC       xo_syslog.lo
xo_syslog.c:61:10: fatal error: sys/sysctl.h: No such file or directory
   61 | #include <sys/sysctl.h>
      |          ^~~~~~~~~~~~~~

The only sysctl.h file I have on my system is linux/sysctl.h:

 $ find /usr/include/* -name 'sysctl.h'
/usr/include/linux/sysctl.h

Simply commenting out the line however helps too.
Maybe add a check for this header file to configure.ac?
On Ubuntu the path sys/sysctl.h seems to be only available in the dietlibc package.

@AnttiNykanen
Copy link

Ran into this as well on Fedora 37.

glibc 2.32 removes sys/sysctl.h. From https://lwn.net/Articles/828210/ :

The deprecated <sys/sysctl.h> header and the sysctl function have been
removed. To support old binaries, the sysctl function continues to
exist as a compatibility symbol (on those architectures which had it),
but always fails with ENOSYS. This reflects the removal of the system
call from all architectures, starting with Linux 5.5.

Since it compiles fine by removing the header from xo_syslog.c , probably that's the correct way to deal with the issue?

@darealshinji
Copy link
Author

Better put some #ifdef check around it for systems that absolutely need it (FreeBSD?) and keep it disabled by default otherwise.

parona-source added a commit to parona-source/libxo that referenced this issue Oct 28, 2023
* HAVE_SYSCTLBYNAME and HAVE_SYS_SYSCTL could be paired together as
  sysctlbyname isn't available if sysctl.h isn't available.
* Sysctl kernel interface isn't available in linux >=5.5 and the header
  is absent in glibc-2.32 and musl-1.0.0

Closes: Juniper#87
Signed-off-by: Alfred Wingate <parona@protonmail.com>
parona-source added a commit to parona-source/libxo that referenced this issue Oct 28, 2023
* HAVE_SYSCTLBYNAME and HAVE_SYS_SYSCTL could be paired together as
  sysctlbyname isn't available if sysctl.h isn't available.
* Sysctl syscall isn't available in linux >=5.5 and the header
  is absent in glibc-2.32 and musl-1.0.0

Closes: Juniper#87
Signed-off-by: Alfred Wingate <parona@protonmail.com>
parona-source added a commit to parona-source/libxo that referenced this issue Oct 28, 2023
* HAVE_SYSCTLBYNAME and HAVE_SYS_SYSCTL could be paired together as
  sysctlbyname isn't available if sysctl.h isn't available.
* Sysctl syscall isn't available in linux >=5.5 and the header
  is absent in glibc-2.32 and musl-1.0.0

Closes: Juniper#87
Signed-off-by: Alfred Wingate <parona@protonmail.com>
parona-source added a commit to parona-source/libxo that referenced this issue Oct 28, 2023
* HAVE_SYSCTLBYNAME and HAVE_SYS_SYSCTL could be paired together as
  sysctlbyname isn't available if sysctl.h isn't available.
* Sysctl syscall isn't available in linux >=5.5 and the header
  is absent in glibc-2.32 and musl-1.0.0

Closes: Juniper#87
Signed-off-by: Alfred Wingate <parona@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants