On 2018/12/16 13:23, Stefan Sperling wrote:
> APR's configure script figures out that off_t is 'long long' on
> OpenBSD but at the same time sets APR_OFF_T_FMT to "ld".
>
> This results in a build failure when I try to compile httpd-2.4.37:
>
> /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);
>
> ~~~ ^~~~~~~
>
>
> I suspect we should add OS-specific overrides to APR's configure script.
> The patch below does this and fixes the above error. Am I right that this
> is what the script should be doing for all OpenBSD architectures?
> If we decide to patch our port of APR like this, then I will submit my
> patch upstream as well.
Makes sense to me, though I'm wondering why I didn't run into this build
failure before.
> Ports which depend on APR would probably need a bump, correct?
The easy way to do that is just bump major in apr's SHARED_LIBS.
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/devel/apr/Makefile,v
> retrieving revision 1.42
> diff -u -p -r1.42 Makefile
> --- Makefile 25 Oct 2017 19:36:46 -0000 1.42
> +++ Makefile 16 Dec 2018 12:00:54 -0000
> @@ -4,7 +4,7 @@ COMMENT= Apache Portable Runtime
>
> V= 1.6.3
> DISTNAME= apr-$V
> -REVISION= 0
> +REVISION= 1
> SHARED_LIBS += apr-1 6.0 # .6.2
>
> CATEGORIES= devel
> Index: patches/patch-configure_in
> ===================================================================
> RCS file: /cvs/ports/devel/apr/patches/patch-configure_in,v
> retrieving revision 1.1
> diff -u -p -r1.1 patch-configure_in
> --- patches/patch-configure_in 25 Oct 2017 19:36:46 -0000 1.1
> +++ patches/patch-configure_in 16 Dec 2018 12:00:16 -0000
> @@ -1,9 +1,37 @@
> $OpenBSD: patch-configure_in,v 1.1 2017/10/25 19:36:46 naddy Exp $
>
> +Fix mismatch between apr_off_t (long long) and APR_OFF_FMT_T ("ld")
> +
> Index: configure.in
> --- configure.in.orig
> +++ configure.in
> -@@ -2281,7 +2281,7 @@ fi
> +@@ -1828,6 +1828,14 @@ case $host in
> + long_value="__int64"
> + int64_strfn="_strtoi64"
> + ;;
> ++ *-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
> +
> + APR_CHECK_TYPES_COMPATIBLE(ssize_t, int, [ssize_t_fmt="d"])
> +@@ -1928,6 +1936,10 @@ elif test "$ac_cv_type_off_t" = "yes"; then
> + off_t_fmt='#define APR_OFF_T_FMT "I64d"'
> + off_t_strfn='_strtoi64'
> + ;;
> ++ *-openbsd*)
> ++ off_t_fmt='#define APR_OFF_T_FMT APR_INT64_T_FMT'
> ++ off_t_strfn='apr_strtoi64'
> ++ ;;
> + esac
> + else
> + # Fallback on int
> +@@ -2281,7 +2293,7 @@ fi
> APR_IFALLYES(header:semaphore.h func:sem_open func:sem_close dnl
> func:sem_unlink func:sem_post func:sem_wait,
> hasposixser="1", hasposixser="0")
> @@ -12,7 +40,7 @@ Index: configure.in
> hassysvser="0")
> APR_IFALLYES(func:flock define:LOCK_EX, hasflockser="1", hasflockser="0")
> APR_IFALLYES(header:fcntl.h define:F_SETLK, hasfcntlser="1",
> hasfcntlser="0")
> -@@ -2470,6 +2470,8 @@ else
> +@@ -2470,6 +2482,8 @@ else
> fi
>
> dnl ----------------------------- Checking for /dev/random
> @@ -21,7 +49,7 @@ Index: configure.in
> AC_MSG_CHECKING(for entropy source)
>
> why_no_rand=""
> -@@ -2486,6 +2488,13 @@ AC_ARG_WITH(egd,
> +@@ -2486,6 +2500,13 @@ AC_ARG_WITH(egd,
> AC_MSG_RESULT(EGD-compatible daemon)
> rand="1"
> ])
>