Solved gmake fails compilation with pipe2() even if unistd.h is included


New Member

Messages: 5

I'm trying to compile Kitty Terminal with gmake.

The error:
gcc -MMD -D_XOPEN_SOURCE=700 -DNDEBUG -Wno-missing-field-initializers -Wall -std=c99 -Werror -O3 -fwrapv -fstack-protector-strong -pipe -march=native -fvisibility=hidden -fPIC -flto -pthread -fpic -D_GLFW_X11 -D_GLFW_BUILD_DLL -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include/dbus-1.0 -I/usr/local/lib/dbus-1.0/include -c /tmp/kitty/glfw/x11_init.c -o /tmp/kitty/build/glfw-x11-x11_init.c.o
/tmp/kitty/glfw/x11_init.c: In function '_glfwPlatformInit':
/tmp/kitty/glfw/x11_init.c:619:9: error: implicit declaration of function 'pipe2' [-Werror=implicit-function-declaration]
     if (pipe2(_glfw.x11.eventLoopData.wakeupFds, O_CLOEXEC | O_NONBLOCK) != 0)
cc1: all warnings being treated as errors
gmake: *** [Makefile:9: all] Error 1

The code it fails on is in glfw/x11_init.c
if (pipe2(_glfw.x11.eventLoopData.wakeupFds, O_CLOEXEC | O_NONBLOCK) != 0)      
                "X11: failed to create self pipe");      
        return GLFW_FALSE;      
specifically, the pipe2(2) call. However, pipe2(2)'s manual lists it as a function if one includes <unistd.h> - which glfw/x11_init.c does.