Subject: apache builds on -current
To: None <tech-pkg@netbsd.org>
From: James Chacon <jmc@netbsd.org>
List: tech-pkg
Date: 02/11/2004 22:23:49
--vtzGhvizbBRQ85DL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

I was working my way through a bulk build and noticed that apache wasn't
building for me.

It's failing due to there being no libgcc_s on NetBSD -current (at least
right now) so the compiler tests don't do much good there. 

Also, looking through defs.NetBSD.mk I see the --whole-archive trick is
turned off unless you're on 1.5. I don't see how 1.6 fixed this as you'd
still need to at a minimum to --whole-archive the libgcc_pic.a version.
(I see the perl patches still do this for instance).

So as far as I can tell (and from some test builds) whole-archive is needed
on 1.6 as well unless libgcc_s exists and the application should be using
that instead.

Can someone review these patches and sanity check my reasoning here?

Thanks

James


--vtzGhvizbBRQ85DL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff

Index: mk/defs.NetBSD.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/defs.NetBSD.mk,v
retrieving revision 1.60
diff -u -r1.60 defs.NetBSD.mk
--- mk/defs.NetBSD.mk	31 Jan 2004 16:52:16 -0000	1.60
+++ mk/defs.NetBSD.mk	12 Feb 2004 04:06:34 -0000
@@ -155,6 +155,10 @@
 .if !empty(OS_VERSION:M1.5*)
 LINK_ALL_LIBGCC_HACK=	-Wl,--whole-archive -lgcc -Wl,--no-whole-archive
 .endif
+# Before gcc3 is fixed to provide libgcc_s this is still needed
+.if !empty(OS_VERSION:M1.6*) && !exists(/usr/lib/libgcc_s.so) && !exists(${LOCALBASE}/lib/libgcc_s.so)
+LINK_ALL_LIBGCC_HACK=   -Wl,--whole-archive -lgcc_pic -Wl,--no-whole-archive
+.endif
 
 .if !defined(DEBUG_FLAGS)
 _STRIPFLAG_CC?=		-s	# cc(1) option to strip
Index: www/php4/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/www/php4/Makefile,v
retrieving revision 1.36
diff -u -r1.36 Makefile
--- www/php4/Makefile	24 Jan 2004 15:23:47 -0000	1.36
+++ www/php4/Makefile	12 Feb 2004 04:06:34 -0000
@@ -26,6 +26,14 @@
 #
 .if ${OPSYS} == "NetBSD" && ${OBJECT_FMT} == "ELF"
 MAKE_ENV+=		LINK_LIBGCC_LDFLAGS="${LINK_ALL_LIBGCC_HACK}"
+# if we are using gcc3, we need to link against libgcc_s, too. This
+# ensures modules can resolve symbols they require from gcc.
+.  if !empty(CC_VERSION:Mgcc-3*)
+.    if exists(/usr/lib/libgcc_s.so) || exists(${LOCALBASE}/lib/libgcc_s.so)
+USE_GCC_SHLIB=          YES # defined
+LINK_LIBGCC_LDFLAGS+=   -lgcc_s
+.    endif
+.  endif
 .endif
 
 # Ensure we export symbols in the linked shared object.
Index: www/apache/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/www/apache/Makefile,v
retrieving revision 1.137
diff -u -r1.137 Makefile
--- www/apache/Makefile	9 Feb 2004 19:57:55 -0000	1.137
+++ www/apache/Makefile	12 Feb 2004 04:06:34 -0000
@@ -112,8 +112,10 @@
 # if we are using gcc3, we need to link against libgcc_s, too. This
 # ensures modules can resolve symbols they require from gcc.
 .    if !empty(CC_VERSION:Mgcc-3*)
+.      if exists(/usr/lib/libgcc_s.so) || exists(${LOCALBASE}/lib/libgcc_s.so)
 USE_GCC_SHLIB=		YES # defined
 LINK_LIBGCC_LDFLAGS+=	-lgcc_s
+.      endif
 .    endif
 .  endif
 .endif
Index: www/apache6/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/www/apache6/Makefile,v
retrieving revision 1.87
diff -u -r1.87 Makefile
--- www/apache6/Makefile	9 Feb 2004 19:57:55 -0000	1.87
+++ www/apache6/Makefile	12 Feb 2004 04:06:35 -0000
@@ -114,8 +114,10 @@
 # if we are using gcc3, we need to link against libgcc_s, too. This
 # ensures modules can resolve symbols they require from gcc.
 .    if !empty(CC_VERSION:Mgcc-3*)
+.      if exists(/usr/lib/libgcc_s.so) || exists(${LOCALBASE}/lib/libgcc_s.so)
 USE_GCC_SHLIB=		# defined
 LINK_LIBGCC_LDFLAGS+=	-lgcc_s
+.      endif
 .    endif
 .  endif
 .endif

--vtzGhvizbBRQ85DL--