Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Undefined symbol _tclEmptyStringRep

Closed / Fixed2057479fffffffffffffffffffffffffffffffffCreated 18 years agoUpdated 18 years ago
Descriptionplain2008-08-18 12:36:00
This is on Mac OS X 10.4.11 PowerPC with a freshly installed XCode 2.5.

Compiling CVS HEAD fails when attempting to link tcltest:

make tcltest-real LIB_RUNTIME_DIR="`pwd`"
gcc -g -pipe      -prebind -headerpad_max_install_names -Wl,-search_paths_first  tclTestInit.o tclTest.o tclTestObj.o tclTestProcBodyObj.o tclThreadTest.o tclUnixTest.o -F/Installerare/Tcl/tcl/build/tcl/Development -framework Tcl -lpthread -framework CoreFoundation  -sectcreate __TEXT __info_plist Tclsh-Info.plist \
         -o tcltest
/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: warning prebinding disabled because of undefined symbols
/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: Undefined symbols:
_tclEmptyStringRep
collect2: ld returned 1 exit status
make[4]: *** [tcltest-real] Error 1
make[3]: *** [tcltest] Error 2
make[2]: *** [build-tcl] Error 2
make[1]: *** [tcl] Error 2
make: *** [develop] Error 2

I have verified that this happens with a fresh checkout today of the tcl module into an empty directory, then: cd macosx; make.

Is this related to tclEmptyStringRep being MODULE_SCOPE?
dgp Ticket [2057479fff]: 1 change [History diff]2008-08-19 04:14:16
tallnielplain2008-08-19 04:34:39
Logged In: YES 
user_id=102050
Originator: NO

I also see this on OS X 10.4.11 Intel. A workaround is to configure with --disable-shared to run the test suite.
dasplain2008-08-19 04:59:05
Logged In: YES 
user_id=90580
Originator: NO

Culprit is the use of TclInvalidateStringRep() in Miguel's new TestconcatobjCmd()...
dasplain2008-08-20 03:56:04
Logged In: YES 
user_id=90580
Originator: NO

the following patch fixes the issue for me, Miguel, any objections to committing this?

Index: generic/tclTest.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclTest.c,v
retrieving revision 1.122
diff -u -p -r1.122 tclTest.c
--- generic/tclTest.c17 Aug 2008 14:15:25 -00001.122
+++ generic/tclTest.c19 Aug 2008 20:46:11 -0000
@@ -6617,11 +6617,17 @@ TestconcatobjCmd(
     
     list1Ptr = Tcl_NewStringObj("foo bar sum", -1);
     Tcl_ListObjLength(NULL, list1Ptr, &len);
-    TclInvalidateStringRep(list1Ptr);
+    if (list1Ptr->bytes != NULL) {
+ckfree((char *) list1Ptr->bytes);
+list1Ptr->bytes = NULL;
+    }
     
     list2Ptr = Tcl_NewStringObj("eeny meeny", -1);
     Tcl_ListObjLength(NULL, list2Ptr, &len);
-    TclInvalidateStringRep(list2Ptr);
+    if (list2Ptr->bytes != NULL) {
+ckfree((char *) list2Ptr->bytes);
+list2Ptr->bytes = NULL;
+    }
 
     /*
      * Verify that concat'ing a list obj with one or more empty strings does
msoferplain2008-08-20 04:58:14
Logged In: YES 
user_id=148712
Originator: NO

No problem, sorry about that - go ahead and commit
dasplain2008-08-20 18:46:25
Logged In: YES 
user_id=90580
Originator: NO

fix committed to HEAD and core-8-5-branch
Log in (anonymous is fine) to add a comment.