Skip to content

cannot compile on Fedora 33 64bits #96

Open

Description

@ROBERT-MCDOWELL

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

Activity

  1. changyp6 commented on Dec 18, 2020

    @changyp6

    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.

  2. changyp6 commented on Dec 18, 2020

    @changyp6

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions