earlyoom icon indicating copy to clipboard operation
earlyoom copied to clipboard

C Undeclared terms Issue

Open MdotO opened this issue 2 years ago • 2 comments

I get the following error when using make command inside the Repo. I am using Amazon Linux 1(tested with Linux 2 as well) but to no avail. The gcc version is 7.3.1 in Amazon Linux 2. Not too learned about this sort of C stuff so not sure what other information to provide. Please let me know if you require any other information. If I use Amazon Linux 1, there are even more undeclared terms error in different files

kill.c: In function ‘send_signal’:
kill.c:133:29: error: ‘SYS_pidfd_send_signal’ undeclared (first use in this function); did you mean ‘__NR_pidfd_send_signal’?
         return (int)syscall(SYS_pidfd_send_signal, pidfd_or_negative_pgid, sig, NULL, 0);
                             ^~~~~~~~~~~~~~~~~~~~~
                             __NR_pidfd_send_signal
kill.c:133:29: note: each undeclared identifier is reported only once for each function it appears in
kill.c: In function ‘is_larger’:
kill.c:299:32: error: ‘SYS_pidfd_open’ undeclared (first use in this function); did you mean ‘__NR_pidfd_open’?
         int res = (int)syscall(SYS_pidfd_open, cur->pid, 0);
                                ^~~~~~~~~~~~~~
                                __NR_pidfd_open
kill.c: In function ‘send_signal’:
kill.c:137:1: warning: control reaches end of non-void function [-Wreturn-type]
 }

MdotO avatar Jun 14 '22 05:06 MdotO

I hit this today trying to compile master, on the vagrant box centos/7.

reverting 2e004040deb5b30880d72740bd71095e326479de fixes the issue, and leaves 2 minor warnings behind.

It'd be nice to get fix for this, I can ifdef around if that's ok?

ilc-fg avatar Aug 02 '22 16:08 ilc-fg

Similar error on Ubuntu 16.04

Checking connectivity... done.
cc   -Wall -Wextra -Wformat-security -Wconversion -DVERSION=\""(unknown version)"\" -g -fstack-protector-all -std=gnu99 -o earlyoom meminfo.c kill.c msg.c main.c globals.c
kill.c: In function ‘send_signal’:
kill.c:133:29: error: ‘SYS_pidfd_send_signal’ undeclared (first use in this function)
         return (int)syscall(SYS_pidfd_send_signal, pidfd_or_negative_pgid, sig, NULL, 0);
                             ^
kill.c:133:29: note: each undeclared identifier is reported only once for each function it appears in
kill.c: In function ‘is_larger’:
kill.c:302:32: error: ‘SYS_pidfd_open’ undeclared (first use in this function)
         int res = (int)syscall(SYS_pidfd_open, cur->pid, 0);
                                ^
kill.c: In function ‘send_signal’:
kill.c:137:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
Makefile:20: recipe for target 'earlyoom' failed
make: *** [earlyoom] Error 1

DIYer22 avatar Aug 24 '22 06:08 DIYer22