gamemode
gamemode copied to clipboard
1.7: build fails
Looks like 1.7 build is failing with -Werror=implicit-function-declaration
[tkloczko@devel-g2v x86_64-redhat-linux-gnu]$ ninja
[1/8] Compiling C object common/liblib-common.a.p/common-pidfds.c.o
FAILED: common/liblib-common.a.p/common-pidfds.c.o
/usr/bin/gcc -Icommon/liblib-common.a.p -Icommon -I../common -I. -I.. -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -std=c11 -O0 -fstack-protector -Wstrict-prototypes -Wundef -fno-common -Werror-implicit-function-declaration -Wformat-security -Werror=format-security -Wconversion -Wunreachable-code -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -Os -fPIC -MD -MQ common/liblib-common.a.p/common-pidfds.c.o -MF common/liblib-common.a.p/common-pidfds.c.o.d -o common/liblib-common.a.p/common-pidfds.c.o -c ../common/common-pidfds.c
../common/common-pidfds.c: In function ‘open_pidfds’:
../common/common-pidfds.c:70:26: error: implicit declaration of function ‘pidfd_open’; did you mean ‘fdopen’? [-Werror=implicit-function-declaration]
70 | int fd = pidfd_open(pid, 0);
| ^~~~~~~~~~
| fdopen
cc1: some warnings being treated as errors
[2/8] Compiling C object common/libdaemon-common.a.p/common-pidfds.c.o
FAILED: common/libdaemon-common.a.p/common-pidfds.c.o
/usr/bin/gcc -Icommon/libdaemon-common.a.p -Icommon -I../common -I. -I.. -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -std=c11 -O0 -fstack-protector -Wstrict-prototypes -Wundef -fno-common -Werror-implicit-function-declaration -Wformat-security -Werror=format-security -Wconversion -Wunreachable-code -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -Os -fPIC -MD -MQ common/libdaemon-common.a.p/common-pidfds.c.o -MF common/libdaemon-common.a.p/common-pidfds.c.o.d -o common/libdaemon-common.a.p/common-pidfds.c.o -c ../common/common-pidfds.c
../common/common-pidfds.c: In function ‘open_pidfds’:
../common/common-pidfds.c:70:26: error: implicit declaration of function ‘pidfd_open’; did you mean ‘fdopen’? [-Werror=implicit-function-declaration]
70 | int fd = pidfd_open(pid, 0);
| ^~~~~~~~~~
| fdopen
cc1: some warnings being treated as errors
ninja: build stopped: subcommand failed.
hey, whats up
I had the same error or problem, the solution is to look for the file common-pidfds.c in the common folder, inside the gamemode folder in your personal folder, open the file and look for the line
int fd = pidfd_open(pid, 0);
and replace for this >>> int fd = fdopen(pid, 0);
static int pidfd_open(pid_t pid, unsigned int flags) { return (int)syscall(__NR_pidfd_open, pid, flags); } #endif
/* pidfd functions */ int open_pidfds(pid_t *pids, int *fds, int count) { int i = 0;
for (i = 0; i < count; i++) {
int pid = pids[i];
int fd = fdopen(pid, 0);
if (fd < 0)
break;
fds[i] = fd;
}
hello, I had the same problem, after I've change it like in the previous comment, when I use ./bootstrap.sh I get this error:
` + meson builddir --prefix=/usr --buildtype debugoptimized -Dwith-systemd-user-unit-dir=/etc/systemd/user Directory already configured.
Just run your build command (e.g. ninja) and Meson will regenerate as necessary. If ninja fails, run "ninja reconfigure" or "meson --reconfigure" to force Meson to regenerate.
If build failures persist, run "meson setup --wipe" to rebuild from scratch using the same options as passed when configuring the build. To change option values, run "meson configure" instead.
- ninja -C builddir ninja: Entering directory `builddir' ninja: no work to do.
- set +x Install to /usr? [y/N] `
and if I continue to install when I test it with gamemoded -t
I get:
` : Loading config
Loading config file [/usr/share/gamemode/gamemode.ini]
: Running tests
Segmentation fault (core dumped) `
Same here, getting a segfault, after compiling with fdopen
: Loading config Loading config file [/usr/share/gamemode/gamemode.ini] : Running tests
[1] 21099 segmentation fault (core dumped) gamemoded -t
I had the same error or problem, the solution is to look for the file common-pidfds.c in the common folder, inside the gamemode folder in your personal folder, open the file and look for the line
int fd = pidfd_open(pid, 0);
and replace for this >>> int fd = fdopen(pid, 0);
While this did compile for me, the resulting installation didn't work, e.g. if I activated Feral for a game in Lutris, the game wouldn't start properly.
What worked for me instead is to disable #if
check in the compiler directives for the definition of the pidf_open
function:
//#if !HAVE_FN_PIDFD_OPEN
#include <sys/syscall.h>
#ifndef __NR_pidfd_open
#define __NR_pidfd_open 434
#endif
static int pidfd_open(pid_t pid, unsigned int flags)
{
return (int)syscall(__NR_pidfd_open, pid, flags);
}
//#endif
I read around a bit and apparently the c compiler on your system may or may not provide the pidfd_open
wrapper function. Inside of meson.build
this is apparently accounted for by first checking if the c compiler has the function and then setting HAVE_FN_PIDFD_OPEN
presumably to false so that the function would get defined as part of common-pidfds.c
instead by refering directly to the system call rather than the wrapper.
Why that still falls through mystifies me and I lack expertise in C to tell but ultimately you can either force the function to get defined as above or as indicated in #410 try to use a different c compiler that exposes the wrapper.
Same here, getting a segfault, after compiling with fdopen
: Loading config Loading config file [/usr/share/gamemode/gamemode.ini] : Running tests
[1] 21099 segmentation fault (core dumped) gamemoded -t
did you ever fix this?
Same issue for me. compile fails on same error as op ; proposed workaround end in segfault.
Kubuntu 23.04