Repository navigation
Build fails on GCC 16: missing #include <unistd.h> (close/read not declared) #459
Description
Build fails on GCC 16: 'close'/'read' not declared in this scope (missing #include <unistd.h>)
Summary
Building from main fails to compile with GCC 16 because several source files
call POSIX functions (close, read, open) without including <unistd.h>.
They currently compile only because older libstdc++/glibc headers pulled
<unistd.h> in transitively. GCC 16 / the matching libstdc++ no longer does, so
the calls are now unresolved and the build breaks.
This is purely a missing-include issue — the fix is one #include <unistd.h>
per affected translation unit.
Environment
- OS: Fedora Linux 44
- Compiler: gcc-c++ 16.1.1 (Red Hat 16.1.1-2)
- CMake: 4.3.0
- Qt: 6.11.1
- KDE Plasma / KWin: 6.6.5 (Wayland)
- Build: KWin plugin —
cmake -S . -B build -DINPUTACTIONS_BUILD_KWIN=ON -DCMAKE_BUILD_TYPE=Release - Superproject commit:
c5b721f(submodules:core@0d72dbd,libevdev-cpp@4707a9e)
Errors
.../libevdev-cpp/src/libevdev-cpp/Device.cpp:50:9: error: 'close' was not declared in this scope; did you mean 'pclose'?
50 | close(fd);
.../libevdev-cpp/src/libevdev-cpp/Device.cpp:67:9: error: 'close' was not declared in this scope; did you mean 'pclose'?
.../core/src/libinputactions/interfaces/implementations/FileConfigProvider.cpp:61:9: error: 'close' was not declared in this scope; did you mean 'pclose'?
61 | close(m_inotifyFd);
.../core/src/libinputactions/interfaces/implementations/FileConfigProvider.cpp:83:12: error: 'read' was not declared in this scope; did you mean 'fread'?
83 | while (read(m_inotifyFd, &buffer, sizeof(buffer)) > 0) {
(open() happens to resolve because <fcntl.h> is already included; only the
<unistd.h> symbols are affected.)
Affected files & fix
Add #include <unistd.h> to each:
Needed for the KWin plugin build:
InputActions/libevdev-cpp→src/libevdev-cpp/Device.cpp(close,open)InputActions/core→src/libinputactions/interfaces/implementations/FileConfigProvider.cpp(close,read)
Also needed for the standalone build:
InputActions/libinput-cpp→src/libinput-cpp/PathContext.cppInputActions/standalone→src/daemon/input/StandaloneInputBackend.cppInputActions/standalone→src/ipc/libinputactions-standalone-ipc/MessageSocketConnection.cppInputActions/standalone→src/ipc/libinputactions-standalone-ipc/MessageSocketConnection.h
Patch
# InputActions/libevdev-cpp — src/libevdev-cpp/Device.cpp
#include "logging.h"
#include <QLoggingCategory>
#include <fcntl.h>
+#include <unistd.h>
#include <libevdev/libevdev.h>
# InputActions/core — src/libinputactions/interfaces/implementations/FileConfigProvider.cpp
#include "FileConfigProvider.h"
+#include <unistd.h>
#include <QDir>
#include <QFile>
# InputActions/libinput-cpp — src/libinput-cpp/PathContext.cpp
#include "PathContext.h"
+#include <unistd.h>
#include "Device.h"
#include "Event.h"
#include <fcntl.h>
# InputActions/standalone — src/daemon/input/StandaloneInputBackend.cpp
#include "StandaloneInputBackend.h"
+#include <unistd.h>
#include "StandaloneInputDevice.h"
# InputActions/standalone — src/ipc/libinputactions-standalone-ipc/MessageSocketConnection.cpp
#include "MessageSocketConnection.h"
+#include <unistd.h>
# InputActions/standalone — src/ipc/libinputactions-standalone-ipc/MessageSocketConnection.h
#include "JsonSerializer.h"
+#include <unistd.h>
#include "messages.h"With these includes added, the KWin plugin builds and links cleanly (verified on
the environment above).
Activity
github-actions commentedon Jun 2, 2026
Opening issues is restricted to maintainers. Users should use discussions instead.
taj-ny commentedon Jun 2, 2026
You're not supposed to fetch the source code from this repository anymore. See https://github.com/taj-ny/InputActions/releases/tag/v0.9.0 and https://wiki.inputactions.org/main/getting-started/installation/kwin.html#installation.