From durian@boogie.com  Mon Jan 23 18:51:08 2006
Return-Path: <durian@boogie.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id BA0A816A420
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 23 Jan 2006 18:51:08 +0000 (GMT)
	(envelope-from durian@boogie.com)
Received: from shadetreesoftware.com (ip-64-139-62-106.den.megapath.net [64.139.62.106])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 7D77043D81
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 23 Jan 2006 18:50:49 +0000 (GMT)
	(envelope-from durian@boogie.com)
Received: from mailhost.boogie.com (root@cpe-66-87-52-132.co.sprintbbd.net [66.87.52.132])
	by shadetreesoftware.com (8.13.4/8.13.4) with ESMTP id k0NIoiUb055499
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 23 Jan 2006 11:50:45 -0700 (MST)
	(envelope-from durian@boogie.com)
Received: from boogie.com (man.boogie.com [192.168.1.3])
	by mailhost.boogie.com (8.13.4/8.13.4) with ESMTP id k0NIoiFP040290
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 23 Jan 2006 11:50:44 -0700 (MST)
	(envelope-from durian@fever.boogie.com)
Received: from man.boogie.com (localhost [127.0.0.1])
	by boogie.com (8.13.4/8.13.4) with ESMTP id k0NIohxO013260
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 23 Jan 2006 11:50:44 -0700 (MST)
	(envelope-from durian@man.boogie.com)
Received: (from durian@localhost)
	by man.boogie.com (8.13.4/8.13.4/Submit) id k0NIohnn013259;
	Mon, 23 Jan 2006 11:50:43 -0700 (MST)
	(envelope-from durian)
Message-Id: <200601231850.k0NIohnn013259@man.boogie.com>
Date: Mon, 23 Jan 2006 11:50:43 -0700 (MST)
From: Mike Durian <durian@shadetreesoftware.com>
Reply-To: Mike Durian <durian@shadetreesoftware.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: openoffice.org-2.0 build fails with shlibsign core dump
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         92218
>Category:       ports
>Synopsis:       openoffice.org-2 build fails with shlibsign core dump
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    openoffice
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 23 19:00:15 GMT 2006
>Closed-Date:    Sun Apr 01 11:25:19 GMT 2007
>Last-Modified:  Sun Apr 01 11:25:19 GMT 2007
>Originator:     Mike Durian
>Release:        FreeBSD 6.0-STABLE i386
>Organization:
>Environment:
System: FreeBSD man.boogie.com 6.0-STABLE FreeBSD 6.0-STABLE #1: Sat Dec 17 12:54:43 MST 2005 root@man.boogie.com:/disk2/obj/disk2/src/sys/BOOGIE i386


	
>Description:
	When I try to build openoffice.org-2.0 the build fails with a
	shlibsign core dump.  The path to shlibsign is
	work/OOA680_m1/moz/unxfbsd.pro/misc/build/mozilla/security/nss/cmd/shlibsign

	The command causing the core dump is:
	FreeBSD6.0_OPT.OBJ/shlibsign -v -i /disk2/ports/editors/openoffice.org-2.0/work/OOA680_m1/moz/unxfbsd.pro/misc/build/mozilla/dist/lib/libsoftokn3.so

	The error message is:
	Fatal error 'Spinlock called when not threaded.' at line 87 in file /disk2/src/lib/libpthread/thread/thr_spinlock.c (errno = 0)

	The error message usually means libpthread is mixed with libc_r.
	When I run ldd on shlibsign, I don't see libc_r.

	ldd shlibsign
	shlibsign:
		libssl3.so => /usr/local/lib/libssl3.so (0x2808a000)
		libsmime3.so => /usr/local/lib/libsmime3.so (0x280ac000)
		libnss3.so => /usr/local/lib/libnss3.so (0x280cf000)
		libplc4.so => /usr/local/lib/libplc4.so (0x2813d000)
		libplds4.so => /usr/local/lib/libplds4.so (0x28165000)
		libnspr4.so => /usr/local/lib/libnspr4.so (0x2818c000)
		libpthread.so.2 => /usr/lib/libpthread.so.2 (0x281bc000)
		libc.so.6 => /lib/libc.so.6 (0x281e1000)
		libsoftokn3.so.1 => /usr/local/lib/libsoftokn3.so.1 (0x282b8000)

	However, when I throw the core dump into the debugger, gdb does
	load libc_r.  I don't know why shlibsign is picking up libc_r,
	but it probably shouldn't.


	sudo gdb FreeBSD6.0_OPT.OBJ/shlibsign shlibsign.core
	Password:
	GNU gdb 6.1.1 [FreeBSD]
	Copyright 2004 Free Software Foundation, Inc.
	GDB is free software, covered by the GNU General Public License, and you are
	welcome to change it and/or distribute copies of it under certain conditions.
	Type "show copying" to see the conditions.
	There is absolutely no warranty for GDB.  Type "show warranty" for details.
	This GDB was configured as "i386-marcel-freebsd"...(no debugging symbols found)...
	Core was generated by `shlibsign'.
	Program terminated with signal 6, Aborted.
	Reading symbols from /disk2/ports/editors/openoffice.org-2.0/work/OOA680_m1/moz/unxfbsd.pro/misc/build/mozilla/dist/lib/libssl3.so...(no debugging symbols found)...done.
	Loaded symbols for /disk2/ports/editors/openoffice.org-2.0/work/OOA680_m1/moz/unxfbsd.pro/misc/build/mozilla/dist/lib/libssl3.so
	Reading symbols from /disk2/ports/editors/openoffice.org-2.0/work/OOA680_m1/moz/unxfbsd.pro/misc/build/mozilla/dist/lib/libsmime3.so...(no debugging symbols found)...done.
	Loaded symbols for /disk2/ports/editors/openoffice.org-2.0/work/OOA680_m1/moz/unxfbsd.pro/misc/build/mozilla/dist/lib/libsmime3.so
	Reading symbols from /disk2/ports/editors/openoffice.org-2.0/work/OOA680_m1/moz/unxfbsd.pro/misc/build/mozilla/dist/lib/libnss3.so...(no debugging symbols found)...done.
	Loaded symbols for /disk2/ports/editors/openoffice.org-2.0/work/OOA680_m1/moz/unxfbsd.pro/misc/build/mozilla/dist/lib/libnss3.so
	Reading symbols from /disk2/ports/editors/openoffice.org-2.0/work/OOA680_m1/moz/unxfbsd.pro/misc/build/mozilla/dist/lib/libplc4.so...(no debugging symbols found)...done.
	Loaded symbols for /disk2/ports/editors/openoffice.org-2.0/work/OOA680_m1/moz/unxfbsd.pro/misc/build/mozilla/dist/lib/libplc4.so
	Reading symbols from /disk2/ports/editors/openoffice.org-2.0/work/OOA680_m1/moz/unxfbsd.pro/misc/build/mozilla/dist/lib/libplds4.so...(no debugging symbols found)...done.
	Loaded symbols for /disk2/ports/editors/openoffice.org-2.0/work/OOA680_m1/moz/unxfbsd.pro/misc/build/mozilla/dist/lib/libplds4.so
	Reading symbols from /disk2/ports/editors/openoffice.org-2.0/work/OOA680_m1/moz/unxfbsd.pro/misc/build/mozilla/dist/lib/libnspr4.so...(no debugging symbols found)...done.
	Loaded symbols for /disk2/ports/editors/openoffice.org-2.0/work/OOA680_m1/moz/unxfbsd.pro/misc/build/mozilla/dist/lib/libnspr4.so
	Reading symbols from /usr/lib/libpthread.so.2...(no debugging symbols found)...done.
	Loaded symbols for /usr/lib/libpthread.so.2
	Reading symbols from /lib/libc.so.6...(no debugging symbols found)...done.
	Loaded symbols for /lib/libc.so.6
	Reading symbols from /disk2/ports/editors/openoffice.org-2.0/work/OOA680_m1/moz/unxfbsd.pro/misc/build/mozilla/dist/lib/libsoftokn3.so...(no debugging symbols found)...done.
	Loaded symbols for /disk2/ports/editors/openoffice.org-2.0/work/OOA680_m1/moz/unxfbsd.pro/misc/build/mozilla/dist/lib/libsoftokn3.so
	Reading symbols from /usr/lib/libc_r.so.6...(no debugging symbols found)...done.
	Loaded symbols for /usr/lib/libc_r.so.6
	Reading symbols from /libexec/ld-elf.so.1...(no debugging symbols found)...done.
	Loaded symbols for /libexec/ld-elf.so.1
	#0  0x28257573 in kill () from /lib/libc.so.6
	[New LWP 100178]
	(gdb) bt
	#0  0x28257573 in kill () from /lib/libc.so.6
	#1  0x281861da in raise () from /usr/lib/libpthread.so.2
	#2  0x28256224 in abort () from /lib/libc.so.6
	#3  0x2819dad7 in pthread_testcancel () from /usr/lib/libpthread.so.2
	#4  0x28189326 in _spinlock () from /usr/lib/libpthread.so.2
	#5  0x281893e7 in _spinlock_debug () from /usr/lib/libpthread.so.2
	#6  0x2831affa in _thread_fd_table_init () from /usr/lib/libc_r.so.6
	#7  0x283198ac in _thread_init () from /usr/lib/libc_r.so.6
	#8  0x2830fe2a in _thread_init_hack () from /usr/lib/libc_r.so.6
	#9  0x2831c4a5 in _find_thread () from /usr/lib/libc_r.so.6
	#10 0x2830cc71 in _init () from /usr/lib/libc_r.so.6
	#11 0xbfbfb778 in ?? ()
	#12 0x280743d8 in ?? () from /libexec/ld-elf.so.1
	#13 0xbfbfb728 in ?? ()
	#14 0x2805ab95 in _rtld_error () from /libexec/ld-elf.so.1
	#15 0x2805d243 in _rtld () from /libexec/ld-elf.so.1
	#16 0x2805a3ce in .rtld_start () from /libexec/ld-elf.so.1



	I should also point out that libc_r does not appear anywhere in
	/etc/libmap.conf

	I also did a "ldd *.so* | grep libc_r" in /usr/local/lib to
	see if any third-party shared libraries might be out of date
	and linked to libc_r.  libc_r did not appear in any other
	library.


>How-To-Repeat:
	It fails for me every time, but obviously other people can build it.
>Fix:
	I don't know the OOo build system well enough, but I suspect
	some makefile is misconfigured and is pulling in libc_r when
	it shouldn't be.

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->openoffice 
Responsible-Changed-By: erwin 
Responsible-Changed-When: Mon Jan 23 19:03:11 UTC 2006 
Responsible-Changed-Why:  
Over to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=92218 

From: Mike Durian <durian@shadetreesoftware.com>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: ports/92218: openoffice.org-2.0 build fails with shlibsign core dump
Date: Sun, 29 Jan 2006 12:16:48 -0700

 I've done a bit of digging.  It looks like the
 work/OOA680_m1/moz/unxfbsd.pro/misc/build/mozilla/configure
 script is failing to detect that -lpthread contains the
 pthread_create() function.  It then finds -lc_r and uses it instead.
 
 The config.log file shows:
 configure:8578: checking for pthread_create in -lpthread
 gcc-ooo -o dummy dummy.c    -I/usr/X11R6/include  -I/usr/X11R6/include 
 -lpthread -lm
 /usr/lib/libpthread.so: undefined reference to `__usleep'
 collect2: ld returned 1 exit status
 configure:8600: checking for pthread_create in -lc_r
 gcc-ooo -o dummy dummy.c    -I/usr/X11R6/include  -I/usr/X11R6/include -lc_r  
 -lm
 
 
 I created the dummy.c file by hand and tried compiling it.  It compiles
 just fine (without the missing __usleep reference) if I use the system
 cc.  It fails when I try gcc-ooo.
 
 > cc -o dummy dummy.c -I/usr/X11R6/include -I/usr/X11R6/include -lpthread -lm
 > gcc-ooo -o dummy dummy.c -I/usr/X11R6/include -I/usr/X11R6/include -lpthread 
 -lm
 /usr/lib/libpthread.so: undefined reference to `__usleep'
 collect2: ld returned 1 exit status
 
 
 My gcc-ooo appears to be relatively old:
 > ls -l /usr/local/bin/gcc-ooo
 -r-xr-xr-x  3 root  wheel  77216 May 10  2005 /usr/local/bin/gcc-ooo
 
 
 It also looks like it is not a required dependancy:
 > pkg_info -W /usr/local/bin/gcc-ooo
 /usr/local/bin/gcc-ooo was installed by package gcc-ooo-3.4.1_2
 > pkg_info -R gcc-ooo-3.4.1_2
 Information for gcc-ooo-3.4.1_2:
 
 
 
 I'm going to un-install lang/gcc-ooo and see if that fixes my problem.
 If gcc-ooo is required by openoffice.org-2.0, then it will get rebuilt.
 
 Assuming a stale gcc-ooo is my problem, I'm not sure what a real fix
 is.  Others might experience this same problem.  I'm thinking the
 gcc-ooo port revision needed a bump due to a change in a system library or
 header file so time ago.
 
 mike
 
 

From: Mike Durian <durian@shadetreesoftware.com>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: ports/92218: openoffice.org-2.0 build fails with shlibsign core dump
Date: Sun, 29 Jan 2006 14:31:18 -0700

 Well, removing lang/gcc-ooo so it could be rebuilt did not help.  I
 still get the unresolved __usleep symbol, but I think I see what
 is really going on.
 
 I've been using and upgrading FreeBSD for quite a while now and
 there were some symbolic links in /lib dated from 2003 that probably
 should have been removed at some point.  In paticular,
 /lib/libc.so was a link to /lib/libc.so.5
 
 When building with the stock system compiler, ld searches /usr/lib
 for libraries.  The ld from gcc-ooo search /lib before /usr/lib.
 So when I linked with the system ld it found /usr/lib/libc.so which
 is a link to /lib/libc.so.6.  /lib/libc.so.6 resolves __usleep.
 
 The ld from gcc-ooo found /lib/libc.so which is a link to libc.so.5.
 libc.so.5 does not resolve __usleep and thus causes the test for
 pthread_create in -lpthread to fail.
 
 I have removed the symbolic links in /lib and I'll see how thing go.
 
 Conceivably, it might be worth adjusting the gcc-ooo linker to use the same
 search behavior as the stock system linker to avoid this sort
 of confusion in the future.
 
 mike
 
State-Changed-From-To: open->closed 
State-Changed-By: linimon 
State-Changed-When: Sun Apr 1 11:25:06 UTC 2007 
State-Changed-Why:  
openoffice has been updated many times since this PR was submitted.  I'm 
sorry that we did not handle it earlier. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=92218 
>Unformatted:
