Skip to content

Compile error with OpenBSD and clang 19 #3252

@rhelmot

Description

@rhelmot

Describe the bug
jq will not compile for OpenBSD under clang 19 due to -Werror=implicit-function-declaration being automatic.

Sample errors:

   > src/builtin.c:247:31: error: call to undeclared function 'lgamma_r'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]                                                               
   >   247 |   jv ret = JV_ARRAY(jv_number(lgamma_r(jv_number_value(input), &sign)));                                                                                                                                                     
   >       |                               ^                                                                                                                                                                                              
   > src/builtin.c:1341:10: error: call to undeclared function 'timegm'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]                                                                
   >  1341 |   return timegm(tm);                                                                                                                                                                                                         
   >       |          ^ 

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions