Subject: Re: pkg/12705: pkgsrc/www/mozilla for 0.8.1 fails to build on i388 1.5T (includes possible fix)
To: NetBSD Bugs and PR posting List <netbsd-bugs@NetBSD.ORG>
From: Greg A. Woods <woods@weird.com>
List: netbsd-bugs
Date: 05/04/2001 18:13:31
[ On Friday, May 4, 2001 at 14:12:22 (-0500), Frederick Bruckman wrote: ]
> Subject: Re: pkg/12705: pkgsrc/www/mozilla for 0.8.1 fails to build on i388  1.5T
>
> I see. So the mystery is why configure didn't put "-L/usr/pkg/lib
> -Wl,-R/usr/pkg/lib" in the file ".../pthreads/Makefile".

Indeed!

Actually it should be somewhere in the twisty little maze of included
makefile segments in mozilla/nsprpub/config/*, and indeed a grep through
there shows it appears in at least one logical place:

$ fgrep L/usr/pkg/lib * 
autoconf.mk:OS_LDFLAGS  =  -Wl,-R/usr/pkg/lib/mozilla -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -Wl,-R/usr/X11R6/lib -L/usr/X11R6/lib -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib/mozilla -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -Wl,-R/usr/X11R6/lib -L/usr/X11R6/lib -Wl,-R/usr/pkg/lib -L/usr/pkg/lib

further a search for :

	autoconf.mk.in:OS_LDFLAGS       = @LDFLAGS@
	config.mk:LDFLAGS               = $(OS_LDFLAGS)
	rules.mk:       $(CC) $(OBJS) -Fe$@ -link $(LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS)
	rules.mk:       $(CC) $(OBJS) -Fe$@ $(LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS)
	rules.mk:       $(CC) -o $@ $(CFLAGS) $(OBJS) $(LDFLAGS)

However it doesn't appear in the correct rule for building shared
libraries in rules.mk:

        $(MKSHLIB) $(OBJS) $(EXTRA_LIBS)

That rule will use only:

autoconf.mk:MKSHLIB             = $(CC) -o $@ $(DSO_LDOPTS)
autoconf.mk:DSO_LDOPTS  = -shared -Wl,-soname,lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX) -Wl,-R/usr/pkg/lib/mozilla

Those are set by `configure' in mozilla/nsprpub:

config.status:s%@MKSHLIB@%$(CC) -o $@ $(DSO_LDOPTS)%g
config.status:s%@DSO_LDOPTS@%-shared -Wl,-soname,lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX) -Wl,-R/usr/pkg/lib/mozilla%g

and it appears that the configure script was specifically patched in
order to "correct" those definitions

1080a1092,1093
>             DLL_SUFFIX=so
>             DSO_LDOPTS='-shared -Wl,-soname,lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)'

1093c1098
<         DSO_LDOPTS="$DSO_LDOPTS -R$(LIBRUNPATH)"
---
>         DSO_LDOPTS="$DSO_LDOPTS -Wl,-R$LIBRUNPATH"


HOWEVER, if I add "$LDFLAGS" to the end of the assignment above, the
build continues on working fine.....

I.e. the above patch should probably be:

<         DSO_LDOPTS="$DSO_LDOPTS -R$(LIBRUNPATH)"
---
>         DSO_LDOPTS="$DSO_LDOPTS -Wl,-R$LIBRUNPATH $LDFLAGS"


So, now I'm really wondering how anyone else managed to build Mozilla
0.8.1 on any NetBSD machine!  I guess I should soon know if the build
finishes and if the installed product works....


> Do "config.log" and "config.status" indicate that the test for pthreads
> passed? 

Yes, and from the `configure' output:

	checking for pthread_create in -lpthread... yes

>   At the top, package level, what is the result of "make -V
> LDFLAGS -V CONFIGURE_ENV"?

$ make -V LDFLAGS -V CONFIGURE_ENV
 -Wl,-R${MOZ_LIBDIR} -Wl,-R${X11BASE}/lib -L${X11BASE}/lib -Wl,-R${LOCALBASE}/lib -L${LOCALBASE}/lib
CPPFLAGS="${CPPFLAGS}" CFLAGS="${CFLAGS} ${CPPFLAGS}" LDFLAGS="${LDFLAGS}" M4="${M4}" YACC="${YACC}" AWK="${AWK}" PATH=${PATH}:${LOCALBASE}/bin:${X11BASE}/bin

-- 
							Greg A. Woods

+1 416 218-0098      VE3TCP      <gwoods@acm.org>     <woods@robohack.ca>
Planix, Inc. <woods@planix.com>;   Secrets of the Weird <woods@weird.com>