Bug 92218 - openoffice.org-2 build fails with shlibsign core dump
Summary: openoffice.org-2 build fails with shlibsign core dump
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-openoffice (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-23 19:00 UTC by Mike Durian
Modified: 2007-04-01 12:25 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Durian 2006-01-23 19:00:15 UTC
	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.

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.
How-To-Repeat: 	It fails for me every time, but obviously other people can build it.
Comment 1 Erwin Lansing freebsd_committer freebsd_triage 2006-01-23 19:03:11 UTC
Responsible Changed
From-To: freebsd-ports-bugs->openoffice

Over to maintainer
Comment 2 Mike Durian 2006-01-29 19:16:48 UTC
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
Comment 3 Mike Durian 2006-01-29 21:31:18 UTC
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
Comment 4 Mark Linimon freebsd_committer freebsd_triage 2007-04-01 12:25:06 UTC
State Changed
From-To: open->closed

openoffice has been updated many times since this PR was submitted.  I'm 
sorry that we did not handle it earlier.