APR's configure script logic results in inconsistent type and format string definitions on OpenBSD. apr_off_t is defined as 'long long' but APR_OFF_T_FMT is defined as "ld".
This results in obvious build failures e.g. if httpd is built with -Werror. This is just one example of many such errors: /home/stsp/svn/src/httpd-2.4.37/server/util_expr_eval.c:1144:56: error: format specifies type 'long' but the argument has type 'apr_off_t' (aka 'long long') [-Werror,-Wformat] return apr_psprintf(ctx->p, "%" APR_OFF_T_FMT, sb.size); ~~~ ^~~~~~~ This happens because off_t is defined as 'long long', and because sizeof(long) and sizeof(long long) are both 8, on OpenBSD/amd64. The configure script section which sets APR_OFF_T_FMT first checks for: "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_long" and sets APR_OFF_T_FMT to "ld", before it checks for: "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_long_long". This looks like a generic problem, but I am not sure the existing logic could be make to work in general. Switching the order of checks makes the configure script produce valid results on OpenBSD but I am not sure if that would be a correct thing to do on other platforms. Since the existing logic apparently works on other platforms it's probably best to leave as it is and add an override for OpenBSD. However, any platform where off_t is 'long long' and long is a 64 bit type is affected by this issue. For previous discussion within OpenBSD, see this thread on the OpenBSD ports mailing list: https://marc.info/?t=154496320200002&r=1&w=2 Index: configure.in =================================================================== --- configure.in (revision 1850876) +++ configure.in (working copy) @@ -1763,6 +1763,10 @@ case $host in long_value="__int64" int64_strfn="_strtoi64" ;; + *-openbsd*) + off_t_fmt='#define APR_OFF_T_FMT APR_INT64_T_FMT' + off_t_strfn='apr_strtoi64' + ;; esac APR_CHECK_TYPES_COMPATIBLE(ssize_t, int, [ssize_t_fmt="d"]) @@ -1867,6 +1871,14 @@ elif test "$ac_cv_type_off_t" = "yes"; then off_t_strfn='_strtoi64' off_t_size=8 ;; + *-openbsd*) + int64_t_fmt='#define APR_INT64_T_FMT "lld"' + uint64_t_fmt='#define APR_UINT64_T_FMT "llu"' + uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "llx"' + int64_value="long long" + long_value="long long" + int64_strfn="strtoll" + ;; esac else # Fallback on int