Subject: Re: buildlink, gcc3 and png
To: David Brownlee <abs@absd.org>
From: Johnny C. Lam <jlam@NetBSD.org>
List: tech-pkg
Date: 01/20/2004 01:46:30
--sm4nu43k4a2Rpi4c
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Thu, Jan 15, 2004 at 05:49:41PM +0000, David Brownlee wrote:
> 	graphics/png fails to compile under 1.6.x using gcc3.
> 
> /var/obj/pkg/graphics/png/work/.buildlink/bin/libtool  --mode=link
> /usr/pkg/gcc-3.3/bin/gcc -o pngtest -O2 -march=pentiumpro
> -finline-functions -ffast-math -fomit-frame-pointer -pipe -I/usr/include
> pngtest.o  -L/usr/lib -Wl,-R/usr/lib -Wl,-R/usr/pkg/lib libpng.la -lz -lm
> /usr/pkg/gcc-3.3/bin/gcc -o .libs/pngtest -O2 -march=pentiumpro
> -finline-functions -ffast-math -fomit-frame-pointer -pipe pngtest.o
> -Wl,-R/usr/pkg/lib  ./.libs/libpng.so
> -L/var/obj/pkg/graphics/png/work/.buildlink/lib -lz -lm -Wl,--rpath
> -Wl,/usr/pkg/lib
> /usr/bin/ld: cannot find -lgcc_eh
> collect2: ld returned 1 exit status
> 
> 	This can be rectified by linking libgcc_eh.a into
> 	work/.buildlink/lib/
> 
> 	On an i386 box this would be
> 	/usr/pkg/gcc-3.3/lib/gcc-lib/i386--netbsdelf/3.3/libgcc_eh.a
> 
> 	What would the correct fix be for this?

Can you update your pkgsrc, apply the attached patch, and then try to
build png again with USE_GCC3=YES set?

	Thanks,

	-- Johnny Lam <jlam@NetBSD.org>

--sm4nu43k4a2Rpi4c
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="compiler.mk.patch"

Index: mk/compiler.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/compiler.mk,v
retrieving revision 1.24
diff -u -r1.24 compiler.mk
--- mk/compiler.mk	10 Dec 2003 09:08:24 -0000	1.24
+++ mk/compiler.mk	20 Jan 2004 01:39:04 -0000
@@ -210,6 +210,12 @@
 .  endif
 .endif	# USE_GCC3
 
+.if defined(USE_GCC2) || defined(USE_GCC3)
+.  if defined(USE_BUILDLINK3) && !empty(USE_BUILDLINK3:M[yY][eE][sS])
+BUILDLINK_PASSTHRU_DIRS+=	${_GCC_PREFIX}
+.  endif
+.endif
+
 # Ensure that the correct rpath is passed to the linker if we need to
 # link against gcc shared libs.
 .if (defined(USE_GCC2) || defined(USE_GCC3)) && defined(USE_GCC_SHLIB)

--sm4nu43k4a2Rpi4c--