Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-D_XOPEN_SOURCE=700 breaks build with non-glibc #238

Closed
jbeich opened this issue Jun 19, 2022 · 1 comment · Fixed by #239
Closed

-D_XOPEN_SOURCE=700 breaks build with non-glibc #238

jbeich opened this issue Jun 19, 2022 · 1 comment · Fixed by #239

Comments

@jbeich
Copy link
Contributor

jbeich commented Jun 19, 2022

On BSDs libc exposes all features by default. When _XOPEN_SOURCE is specified non-standard features are hidden. Cheating compliance is possible but _DEFAULT_SOURCE (GNU) has no effect because the knob name is different: __BSD_VISIBLE on DragonFly/FreeBSD/OpenBSD and _NETBSD_SOURCE on NetBSD.

Also, usleep was removed in POSIX.1-2008 (-D_XOPEN_SOURCE=700).

$ cc --version
FreeBSD clang version 14.0.5 (https://github.com/llvm/llvm-project.git llvmorg-14.0.5-0-gc12386ae247c)
Target: x86_64-unknown-freebsd14.0
Thread model: posix
InstalledDir: /usr/bin

$ gmake
[...]
src/config.c:483:22: error: use of undeclared identifier 'DT_DIR'
                if (ent->d_type == DT_DIR)
                                   ^
src/ipc.c:53:6: warning: implicit declaration of function 'flock' is invalid in C99 [-Wimplicit-function-declaration]
        if (flock(lfd, LOCK_EX | LOCK_NB))
            ^
src/ipc.c:53:17: error: use of undeclared identifier 'LOCK_EX'
        if (flock(lfd, LOCK_EX | LOCK_NB))
                       ^
src/ipc.c:53:27: error: use of undeclared identifier 'LOCK_NB'
        if (flock(lfd, LOCK_EX | LOCK_NB))
                                 ^
src/keyboard.c:224:4: warning: implicit declaration of function 'usleep' is invalid in C99 [-Wimplicit-function-declaration]
                        usleep(ent->data*1E3);
                        ^
src/vkbd/uinput.c:262:3: warning: implicit declaration of function 'usleep' is invalid in C99 [-Wimplicit-function-declaration]
                usleep(100000);
                ^
src/vkbd/uinput.c:298:3: warning: implicit declaration of function 'usleep' is invalid in C99 [-Wimplicit-function-declaration]
                usleep(100000);
                ^
src/vkbd/uinput.c:332:3: warning: implicit declaration of function 'usleep' is invalid in C99 [-Wimplicit-function-declaration]
                usleep(100000);
                ^
@rvaiya
Copy link
Owner

rvaiya commented Jun 19, 2022

Thanks. Keeping the feature test macros straight can be a chore :P. I'm not sure why I originally included both _XOPEN_SOURCE and _DEFAULT_SOURCE, presumably the former preceded the letter and ended up as residual cruft.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants