Tcl Source Code

View Ticket
Login
Ticket UUID: 602849
Title: threaded build fails on FreeBSD 4.6
Type: Bug Created on: 2002-08-31 14:26:57
Submitter: das Assigned to: hobbs
Subsystem: 49. Threading Severity:
Priority: 5 Medium Last modified: 2002-09-04 02:55:02
Status: Closed Closed by: hobbs
Resolution: Fixed Closed on: 2002-09-03 19:55:02
Version: obsolete: 8.4b3
Description:
This is on host usf-cf-x86-freebsd-1 on the SourceForge
compilefarm (FreeBSD 4.6-STABLE):
The threaded build fails to link because of the
presence of an erroneous "-pthread" argument to 'ld'.

the patch to tcl.m4 below fixes the problem and doesn't
affect any of the other builds on the compilefarm
negatively, but I suspect is proabably not a good
solution in general.

Index: tcl.m4
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/tcl.m4,v
retrieving revision 1.80
diff -u -r1.80 tcl.m4
--- tcl.m4      31 Aug 2002 13:28:00 -0000      1.80
+++ tcl.m4      31 Aug 2002 14:25:13 -0000
@@ -438,7 +438,7 @@
                   
AC_CHECK_LIB(c_r,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
                    if test "$tcl_ok" = "yes"; then
                        # The space is needed
-                       THREADS_LIBS=" -pthread"
+                       THREADS_LIBS=" "
                    else
                        TCL_THREADS=0
                        AC_MSG_WARN("Don t know how to
find pthread lib on your system - you must disable
thread support or edit the LIBS in the Makefile...")
User Comments:
hobbs added on 2002-09-03 03:35:44:
Logged In: YES 
user_id=72656

I built on the same machine without problems.

das added on 2002-09-03 07:41:00:
Logged In: YES 
user_id=90580

really? I just tried again, same problem (on a fresh
checkout of the HEAD):

-------------------------------------------------------------------------------------------------

usf-cf-x86-freebsd-1 tcl $ ~/HEAD/tcl/unix/configure
--enable-threads

usf-cf-x86-freebsd-1 tcl $ make
lrm -f libtclstub8.4.a
ar cr libtclstub8.4.a tclStubLib.o  ; ranlib libtclstub8.4.a
rm -f libtcl8.4.so
ld -Bshareable -x -o libtcl8.4.so  regcomp.o regexec.o
regfree.o regerror.o tclAlloc.o  tclAsync.o tclBasic.o
tclBinary.o  tclCkalloc.o tclClock.o tclCmdAH.o tclCmdIL.o
tclCmdMZ.o  tclCompCmds.o tclCompExpr.o tclCompile.o
tclDate.o tclEncoding.o  tclEnv.o tclEvent.o tclExecute.o
tclFCmd.o tclFileName.o tclGet.o  tclHash.o tclHistory.o
tclIndexObj.o tclInterp.o tclIO.o tclIOCmd.o  tclIOGT.o
tclIOSock.o tclIOUtil.o tclLink.o tclListObj.o  tclLiteral.o
tclLoad.o tclMain.o tclNamesp.o tclNotify.o  tclObj.o
tclPanic.o tclParse.o tclParseExpr.o tclPipe.o  tclPkg.o
tclPosixStr.o tclPreserve.o tclProc.o tclRegexp.o 
tclResolve.o tclResult.o tclScan.o tclStringObj.o
tclThread.o  tclThreadAlloc.o tclThreadJoin.o tclStubInit.o
tclStubLib.o  tclTimer.o tclUtf.o tclUtil.o tclVar.o
tclUnixChan.o tclUnixEvent.o tclUnixFCmd.o  tclUnixFile.o
tclUnixPipe.o tclUnixSock.o  tclUnixTime.o tclUnixInit.o
tclUnixThrd.o tclUnixNotfy.o   tclLoadDl.o -pthread -lm  
-rpath /usr/local/lib
/usr/libexec/elf/ld: unrecognized option 'tclLoadDl.o'
/usr/libexec/elf/ld: use the --help option for usage information
*** Error code 1

Stop in
/home/users/d/da/das/build/usf-cf-x86-freebsd-1/HEAD/tcl.

-------------------------------------------------------------------------------------------------

if the -pthread in the ld line is removed, the link succeeds

hobbs added on 2002-09-03 07:59:08:
Logged In: YES 
user_id=72656

Yes, really ...

usf-cf-x86-freebsd-1 [~/build/freebsd/tcl84st] 7 % make shell
rm -f libtclstub8.4.a
ar cr libtclstub8.4.a tclStubLib.o  ; ranlib libtclstub8.4.a
rm -f libtcl8.4.a
ar cr libtcl8.4.a regcomp.o regexec.o regfree.o regerror.o
tclAlloc.o  tclAsync.o tclBasic.o tclBinary.o  tclCkalloc.o
tclClock.o tclCmdAH.o tclCmdIL.o tclCmdMZ.o  tclCompCmds.o
tclCompExpr.o tclCompile.o tclDate.o tclEncoding.o  tclEnv.o
tclEvent.o tclExecute.o tclFCmd.o tclFileName.o tclGet.o 
tclHash.o tclHistory.o tclIndexObj.o tclInterp.o tclIO.o
tclIOCmd.o  tclIOGT.o tclIOSock.o tclIOUtil.o tclLink.o
tclListObj.o  tclLiteral.o tclLoad.o tclMain.o tclNamesp.o
tclNotify.o  tclObj.o tclPanic.o tclParse.o tclParseExpr.o
tclPipe.o  tclPkg.o tclPosixStr.o tclPreserve.o tclProc.o
tclRegexp.o  tclResolve.o tclResult.o tclScan.o
tclStringObj.o tclThread.o  tclThreadAlloc.o tclThreadJoin.o
tclStubInit.o tclStubLib.o  tclTimer.o tclUtf.o tclUtil.o
tclVar.o tclUnixChan.o tclUnixEvent.o tclUnixFCmd.o 
tclUnixFile.o tclUnixPipe.o tclUnixSock.o  tclUnixTime.o
tclUnixInit.o tclUnixThrd.o tclUnixNotfy.o   tclLoadDl.o ;
ranlib libtcl8.4.a
gcc -pipe -export-dynamic -pthread  tclAppInit.o
-L/home/users/h/ho/hobbs/build/freebsd/tcl84st -ltcl8.4
-pthread -lm  -Wl,-rpath,/usr/local/lib -o tclsh
% parray tcl_platform
tcl_platform(byteOrder) = littleEndian
tcl_platform(machine)   = i386
tcl_platform(os)        = FreeBSD
tcl_platform(osVersion) = 4.6-STABLE
tcl_platform(platform)  = unix
tcl_platform(threaded)  = 1
tcl_platform(user)      = hobbs
tcl_platform(wordSize)  = 4

The question is likely about paths ... why do you have ld
-Bshareable, where I have ar and gcc?  Works for me ...

dkf added on 2002-09-03 17:01:50:
Logged In: YES 
user_id=79902

One build (the failing one) is dynamic, and one (the
succeeding one) is static. Why would this make a difference?

das added on 2002-09-03 18:58:48:
Logged In: YES 
user_id=90580

that's a good point, indeed if I configure with
--disable-shared my build succeeds as well...

hobbs added on 2002-09-04 02:55:02:
Logged In: YES 
user_id=72656

OK, corrected this for FreeBSD to remove it in the FreeBSD
specific section with a sed macro.  This was only needed on
dynamic builds.