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

cannot compile on Fedora 33 64bits #96

Open
ROBERT-MCDOWELL opened this issue Dec 10, 2020 · 2 comments
Open

cannot compile on Fedora 33 64bits #96

ROBERT-MCDOWELL opened this issue Dec 10, 2020 · 2 comments

Comments

@ROBERT-MCDOWELL
Copy link

hello,

here is the log

cd src && make all
make[1]: Entering directory '/home/src/cpulimit/src'
cc -o cpulimit cpulimit.c list.o process_iterator.o process_group.o -Wall -g -D_GNU_SOURCE
cpulimit.c:41:10: fatal error: sys/sysctl.h: No such file or directory
41 | #include <sys/sysctl.h>
| ^~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [Makefile:15: cpulimit] Error 1

@changyp6
Copy link

This is because Fedora 33 has GLIBC 2.32, however, GLIBC 2.32 has removed sys/sysctl.h header file.
You can find this change in GLIBC 2.32 Release Note

This probably needs the author to fix.

@changyp6
Copy link

This patch is a quick fix for this issue:

diff --git a/src/cpulimit.c b/src/cpulimit.c
index 50eabea..eba4615 100644
--- a/src/cpulimit.c
+++ b/src/cpulimit.c
@@ -38,12 +38,14 @@
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/time.h>
+#ifdef __APPLE__
 #include <sys/sysctl.h>
+#endif
 #include <sys/resource.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 
-#ifdef __APPLE__ || __FREEBSD__
+#if defined(__APPLE__) || defined(__FREEBSD__)
 #include <libgen.h>
 #endif

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

No branches or pull requests

2 participants