-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Compile error with OpenBSD and clang 19 #3252
Comments
This patch works? diff --git a/src/builtin.c b/src/builtin.c
index c0aba96..146c4d0 100644
--- a/src/builtin.c
+++ b/src/builtin.c
@@ -5,6 +5,10 @@
# define _XPG6
# define __EXTENSIONS__
#endif
+#ifdef __GLIBC__
+# define _BSD_SOURCE
+# define _DEFAULT_SOURCE
+#endif
#include <sys/time.h>
#include <stdlib.h>
#include <stddef.h> |
I thought this line from configure.ac was supposed to automatically define Line 8 in fa6a2ff
Hmm, no apparently it only sets It also depends on the version of autoconf; in 2.65, it doesn't even set You can only rely on this macro to set |
Add to diff --git a/Makefile.am b/Makefile.am
index c7504e4..cb09065 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,7 +20,7 @@ LIBJQ_SRC = src/builtin.c src/bytecode.c src/compile.c src/execute.c \
### C build options
AM_CFLAGS = -Wextra -Wall -Wno-unused-parameter -Wno-unused-function \
- -Woverlength-strings
+ -Woverlength-strings -D_BSD_SOURCE -D_DEFAULT_SOURCE
if WIN32
AM_CFLAGS += -municode |
Describe the bug
jq will not compile for OpenBSD under clang 19 due to -Werror=implicit-function-declaration being automatic.
Sample errors:
To Reproduce
./configure && make
Expected behavior
A clear and concise description of what you expected to happen.
Environment (please complete the following information):
OpenBSD 7.5, clang 19
Additional context
Fixed with CFLAGS=-D_BSD_SOURCE=1. Autoconf detects these symbols in -lm but they are not visible in headers by default.
The text was updated successfully, but these errors were encountered: