I used up some of my few remaining brain cells and came up with a modified 
patch that allows apr to build.  I hope the email does not mangle the lines.  
The two changed lines in the include patch are each only one line of text

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    23 Apr 2018 20:43:08 -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-include_apr_general_h
===================================================================
RCS file: patches/patch-include_apr_general_h
diff -N patches/patch-include_apr_general_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-include_apr_general_h 23 Apr 2018 20:42:50 -0000
@@ -0,0 +1,13 @@
+$OpenBSD$
+fix build failure on arm:
+implicit declaration of function '_Offsetof' is invalid in C99
+Index: include/apr_general.h
+--- include/apr_general.h.orig
++++ include/apr_general.h
+@@ -76,5 +76,5 @@ typedef int               apr_signum_t;
+  * @return offset
+  */
+
+-#if defined(CRAY) || (defined(__arm) && !(defined(LINUX) || 
defined(__FreeBSD__)))
++#if defined(CRAY) || (defined(__arm) && !(defined(LINUX) || 
defined(__FreeBSD__) || defined(__OpenBSD__)))
+ #ifdef __STDC__
+ #define APR_OFFSET(p_type,field) _Offsetof(p_type,field) #else

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of 
[email protected]
Sent: April 23, 2018 9:38 PM
To: 'Stefan Sperling' <[email protected]>
Cc: 'OpenBSD Ports' <[email protected]>
Subject: Re: apr patch problem

I am not very experienced at patching and ports but here is what I did.  There 
seems to be a problem with the patch, but when I try to correct it, it gets 
worse.  I think line 12 needs a "-", and I do not know what happened to the 
last line of your patch .

**** The original patch

op1bsdsnap# patch Makefile /home/sysadmin/apr_patch Hmm...  Looks like a 
unified diff to me...
The text leading up to this was:
--------------------------
|ndex: 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   23 Apr 2018 20:43:08 -0000
--------------------------
Patching file Makefile using Plan A...
Hunk #1 succeeded at 4.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Index: patches/patch-include_apr_general_h
|===================================================================
|RCS file: patches/patch-include_apr_general_h
|diff -N patches/patch-include_apr_general_h
|--- /dev/null  1 Jan 1970 00:00:00 -0000
|+++ patches/patch-include_apr_general_h        23 Apr 2018 20:42:50 -0000
--------------------------
(Creating file patches/patch-include_apr_general_h...)
Patching file patches/patch-include_apr_general_h using Plan A...
Empty context always matches.
Hunk #1 succeeded at 1.
Hmm...  Ignoring the trailing garbage.
done
op1bsdsnap#

*** What the patch produced (apr_general part only)

op1bsdsnap# more patches/patch-include_apr_general_h
$OpenBSD$
fix build failure on arm:
implicit declaration of function '_Offsetof' is invalid in C99
Index: include/apr_general.h
--- include/apr_general.h.orig
+++ include/apr_general.h
@@ -76,7 +76,7 @@ typedef int               apr_signum_t;
  * @return offset
  */

-#if defined(CRAY) || (defined(__arm) && !(defined(LINUX) ||
defined(__FreeBSD__)))
+#if defined(CRAY) || (defined(__arm) && !(defined(LINUX) ||
+defined(__FreeBSD__) || defined(__OpenBSD__)))
 #ifdef __STDC__


*** Trying to build

op1bsdsnap# make install
===>  Checking files for apr-1.6.3p1
>> Fetch https://www.apache.org/dist/apr/apr-1.6.3.tar.gz
apr-1.6.3.tar.gz 100% 
|*************************************************************|  1047 KB    
00:00
>> (SHA256) apr-1.6.3.tar.gz: OK
===> apr-1.6.3p1 depends on: metaauto-* -> metaauto-1.0p1 ===> apr-1.6.3p1 
depends on: autoconf-2.69 -> autoconf-2.69p2 ===>  Verifying specs:  pthread 
===>  found pthread.25.1 ===>  Extracting for apr-1.6.3p1 ===>  Patching for 
apr-1.6.3p1
===>   Applying OpenBSD patch patch-apr-config_in
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|$OpenBSD: patch-apr-config_in,v 1.3 2017/10/25 19:36:46 naddy Exp $
|Index: apr-config.in
|--- apr-config.in.orig
|+++ apr-config.in
--------------------------
Patching file apr-config.in using Plan A...
Hunk #1 succeeded at 223.
done
===>   Applying OpenBSD patch patch-build_apr_hints_m4
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|$OpenBSD: patch-build_apr_hints_m4,v 1.1 2017/10/25 19:36:46 naddy Exp 
|$
|
|Index: build/apr_hints.m4
|--- build/apr_hints.m4.orig
|+++ build/apr_hints.m4
--------------------------
Patching file build/apr_hints.m4 using Plan A...
Hunk #1 succeeded at 135.
done
===>   Applying OpenBSD patch patch-configure_in
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|$OpenBSD: patch-configure_in,v 1.1 2017/10/25 19:36:46 naddy Exp $
|
|Index: configure.in
|--- configure.in.orig
|+++ configure.in
--------------------------
Patching file configure.in using Plan A...
Hunk #1 succeeded at 2281.
Hunk #2 succeeded at 2470.
Hunk #3 succeeded at 2488.
done
===>   Applying OpenBSD patch patch-include_apr_general_h
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|$OpenBSD$
|fix build failure on arm:
|implicit declaration of function '_Offsetof' is invalid in C99
|Index: include/apr_general.h
|--- include/apr_general.h.orig
|+++ include/apr_general.h
--------------------------
Patching file include/apr_general.h using Plan A...
patch: **** malformed patch at line 12: defined(__FreeBSD__)))
***>   patch-include_apr_general_h did not apply cleanly
===>   Ignoring patchfile patch-include_apr_general_h.orig
===>   Applying OpenBSD patch patch-misc_unix_rand_c
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|$OpenBSD: patch-misc_unix_rand_c,v 1.1 2017/10/25 19:36:46 naddy Exp $
|
|Index: misc/unix/rand.c
|--- misc/unix/rand.c.orig
|+++ misc/unix/rand.c
--------------------------
Patching file misc/unix/rand.c using Plan A...
Hunk #1 succeeded at 87.
done
===>   Applying OpenBSD patch patch-network_io_unix_sockets_c
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|$OpenBSD: patch-network_io_unix_sockets_c,v 1.6 2017/08/11 14:23:18 
|danj Exp $
|Index: network_io/unix/sockets.c
|--- network_io/unix/sockets.c.orig
|+++ network_io/unix/sockets.c
--------------------------
Patching file network_io/unix/sockets.c using Plan A...
Hunk #1 succeeded at 338.
Hunk #2 succeeded at 388.
done
*** Error 1 in . (/usr/ports/infrastructure/mk/bsd.port.mk:2636 
'/usr/ports/pobj/apr-1.6.3/.patch_done': @if cd /usr/ports/devel/apr/patches...)
*** Error 1 in . (/usr/ports/infrastructure/mk/bsd.port.mk:1938 
'/usr/ports/packages/arm/all/apr-1.6.3p1.tgz')
*** Error 1 in . (/usr/ports/infrastructure/mk/bsd.port.mk:2438 
'_internal-package')
*** Error 1 in . (/usr/ports/infrastructure/mk/bsd.port.mk:2417 'package')
*** Error 1 in . (/usr/ports/infrastructure/mk/bsd.port.mk:1956 
'/var/db/pkg/apr-1.6.3p1/+CONTENTS')
*** Error 1 in /usr/ports/devel/apr 
(/usr/ports/infrastructure/mk/bsd.port.mk:2417 'install') op1bsdsnap#
+defined(__FreeBSD__) || defined(__OpenBSD__)))
 #ifdef __STDC__

*** I tried adding the "-" in line 12.

op1bsdsnap# more patches/patch-include_apr_general_h
$OpenBSD$
fix build failure on arm:
implicit declaration of function '_Offsetof' is invalid in C99
Index: include/apr_general.h
--- include/apr_general.h.orig
+++ include/apr_general.h
@@ -76,7 +76,7 @@ typedef int               apr_signum_t;
  * @return offset
  */

-#if defined(CRAY) || (defined(__arm) && !(defined(LINUX) ||
-defined(__FreeBSD__)))
+#if defined(CRAY) || (defined(__arm) && !(defined(LINUX) ||
+defined(__FreeBSD__) || defined(__OpenBSD__)))
 #ifdef __STDC__


*** Retried the build.

op1bsdsnap# make clean=dist
===>  Cleaning for apr-1.6.3p1
===>  Dist cleaning for apr-1.6.3p1
op1bsdsnap# make clean
===>  Cleaning for apr-1.6.3p1
op1bsdsnap# make install
===>  Checking files for apr-1.6.3p1
>> Fetch https://www.apache.org/dist/apr/apr-1.6.3.tar.gz
apr-1.6.3.tar.gz 100% 
|*************************************************************|  1047 KB    
00:00
>> (SHA256) apr-1.6.3.tar.gz: OK
===> apr-1.6.3p1 depends on: metaauto-* -> metaauto-1.0p1 ===> apr-1.6.3p1 
depends on: autoconf-2.69 -> autoconf-2.69p2 ===>  Verifying specs:  pthread 
===>  found pthread.25.1 ===>  Extracting for apr-1.6.3p1 ===>  Patching for 
apr-1.6.3p1
===>   Applying OpenBSD patch patch-apr-config_in
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|$OpenBSD: patch-apr-config_in,v 1.3 2017/10/25 19:36:46 naddy Exp $
|Index: apr-config.in
|--- apr-config.in.orig
|+++ apr-config.in
--------------------------
Patching file apr-config.in using Plan A...
Hunk #1 succeeded at 223.
done
===>   Applying OpenBSD patch patch-build_apr_hints_m4
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|$OpenBSD: patch-build_apr_hints_m4,v 1.1 2017/10/25 19:36:46 naddy Exp 
|$
|
|Index: build/apr_hints.m4
|--- build/apr_hints.m4.orig
|+++ build/apr_hints.m4
--------------------------
Patching file build/apr_hints.m4 using Plan A...
Hunk #1 succeeded at 135.
done
===>   Applying OpenBSD patch patch-configure_in
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|$OpenBSD: patch-configure_in,v 1.1 2017/10/25 19:36:46 naddy Exp $
|
|Index: configure.in
|--- configure.in.orig
|+++ configure.in
--------------------------
Patching file configure.in using Plan A...
Hunk #1 succeeded at 2281.
Hunk #2 succeeded at 2470.
Hunk #3 succeeded at 2488.
done
===>   Applying OpenBSD patch patch-include_apr_general_h
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|$OpenBSD$
|fix build failure on arm:
|implicit declaration of function '_Offsetof' is invalid in C99
|Index: include/apr_general.h
|--- include/apr_general.h.orig
|+++ include/apr_general.h
--------------------------
Patching file include/apr_general.h using Plan A...
Hunk #1 failed at 76.
1 out of 1 hunks failed--saving rejects to include/apr_general.h.rej done
***>   patch-include_apr_general_h did not apply cleanly
===>   Ignoring patchfile patch-include_apr_general_h.orig
===>   Applying OpenBSD patch patch-misc_unix_rand_c
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|$OpenBSD: patch-misc_unix_rand_c,v 1.1 2017/10/25 19:36:46 naddy Exp $
|
|Index: misc/unix/rand.c
|--- misc/unix/rand.c.orig
|+++ misc/unix/rand.c
--------------------------
Patching file misc/unix/rand.c using Plan A...
Hunk #1 succeeded at 87.
done
===>   Applying OpenBSD patch patch-network_io_unix_sockets_c
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|$OpenBSD: patch-network_io_unix_sockets_c,v 1.6 2017/08/11 14:23:18 
|danj Exp $
|Index: network_io/unix/sockets.c
|--- network_io/unix/sockets.c.orig
|+++ network_io/unix/sockets.c
--------------------------
Patching file network_io/unix/sockets.c using Plan A...
Hunk #1 succeeded at 338.
Hunk #2 succeeded at 388.
done
*** Error 1 in . (/usr/ports/infrastructure/mk/bsd.port.mk:2636 
'/usr/ports/pobj/apr-1.6.3/.patch_done': @if cd /usr/ports/devel/apr/patches...)
*** Error 1 in . (/usr/ports/infrastructure/mk/bsd.port.mk:1938 
'/usr/ports/packages/arm/all/apr-1.6.3p1.tgz')
*** Error 1 in . (/usr/ports/infrastructure/mk/bsd.port.mk:2438 
'_internal-package')
*** Error 1 in . (/usr/ports/infrastructure/mk/bsd.port.mk:2417 'package')
*** Error 1 in . (/usr/ports/infrastructure/mk/bsd.port.mk:1956 
'/var/db/pkg/apr-1.6.3p1/+CONTENTS')
*** Error 1 in /usr/ports/devel/apr 
(/usr/ports/infrastructure/mk/bsd.port.mk:2417 'install') op1bsdsnap#

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Stefan 
Sperling
Sent: April 23, 2018 1:45 PM
To: [email protected]
Cc: 'OpenBSD Ports' <[email protected]>
Subject: Re: apr problem

On Mon, Apr 23, 2018 at 01:20:51PM -0700, [email protected] wrote:
> I am building php on arm and have run into this:
> 
>  
> 
> /usr/bin/libtool --silent --mode=compile cc -pthread  -O2 -pipe
> -DHAVE_CONFIG_H  -D_POSIX_THREADS -DAPR_POOL_DEBUG=1   -I./include
> -I/usr/ports/pobj/apr-1.6.3/apr-1.6.3/include/arch/unix
> -I./include/arch/unix
> -I/usr/ports/pobj/apr-1.6.3/apr-1.6.3/include/arch/unix
> -I/usr/ports/pobj/apr-1.6.3/apr-1.6.3/include
> -I/usr/ports/pobj/apr-1.6.3/apr-1.6.3/include/private
> -I/usr/ports/pobj/apr-1.6.3/apr-1.6.3/include/private  -o 
> network_io/unix/sendrecv.lo -c network_io/unix/sendrecv.c && touch 
> network_io/unix/sendrecv.lo
> 
> network_io/unix/sendrecv.c:181:23: warning: implicit declaration of 
> function '_Offsetof' is invalid in
> 
>       C99 [-Wimplicit-function-declaration]
> 
>     if (from->salen > APR_OFFSETOF(struct sockaddr_in, sin_port)) {
> 
>                       ^
> 

It seems this package has been failing on arm for a while.

Does this fix the port on arm?

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    23 Apr 2018 20:43:08 -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-include_apr_general_h
===================================================================
RCS file: patches/patch-include_apr_general_h
diff -N patches/patch-include_apr_general_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-include_apr_general_h 23 Apr 2018 20:42:50 -0000
@@ -0,0 +1,15 @@
+$OpenBSD$
+fix build failure on arm:
+implicit declaration of function '_Offsetof' is invalid in C99
+Index: include/apr_general.h
+--- include/apr_general.h.orig
++++ include/apr_general.h
+@@ -76,7 +76,7 @@ typedef int               apr_signum_t;
+  * @return offset
+  */
+ 
+-#if defined(CRAY) || (defined(__arm) && !(defined(LINUX) ||
+defined(__FreeBSD__)))
++#if defined(CRAY) || (defined(__arm) && !(defined(LINUX) ||
++defined(__FreeBSD__) || defined(__OpenBSD__)))
+ #ifdef __STDC__
+ #define APR_OFFSET(p_type,field) _Offsetof(p_type,field) #else



Reply via email to