Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 2cec450057b0a58d41ca8e1b923fa673a129648a
Ticket: 3181906fffffffffffffffffffffffffffffffff
Compile error with --disable-load on Mac OS X
User & Date: mthuurne on 2011-02-15 08:27:18
Changes

  1. assignee changed to: "kennykb"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    Platform: Mac OS X, version 10.4/10.5/10.6
    The problem occurs on 10.6 as well, but is harder to reproduce there, see below.
    
    When configured with --disable-load, the tclLoadDyld.c source is not built. However, tclIOUtil.c will use TclpLoadMemoryGetBuffer() and TclpLoadMemory() (both implemented in tclLoadDyld.c) if TCL_LOAD_FROM_MEMORY is #defined. This leads to missing symbols at link time:
    
    gcc-4.2 -Os -arch i386 -D__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__=1050 -pipe   -isysroot /Developer/SDKs/MacOSX10.5.sdk   -arch i386 -D__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__=1050 -isysroot /Developer/SDKs/MacOSX10.5.sdk  tclAppInit.o -L/Users/mth/prog/openmsx/tclbug-build -ltcl8.5 -framework CoreFoundation  -sectcreate __TEXT __info_plist Tclsh-Info.plist \
     -o tclsh
    Undefined symbols:
      "_TclpLoadMemoryGetBuffer", referenced from:
          _TclLoadFile in libtcl8.5.a(tclIOUtil.o)
      "_TclpLoadMemory", referenced from:
          _TclLoadFile in libtcl8.5.a(tclIOUtil.o)
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    make: *** [tclsh] Error 1
    
    I worked around the issue by modifying conifgure like this: (instead of unconditionally #defining TCL_LOAD_FROM_MEMORY on Darwin)
    
    if test "$DL_OBJS" != "tclLoadNone.o"; then
    cat >>confdefs.h <<\_ACEOF
    #define TCL_LOAD_FROM_MEMORY 1
    _ACEOF
    fi
    
    To reproduce the problem, it is essential to compile for OS X 10.4 or 10.5, since those contain Tcl 8.4 in the SDK while 10.6 contains Tcl 8.5 in the SDK and tclsh is linked to the systemwide libtcl instead to the one just built (maybe that is a bug in itself?). For convenience, I attached the script that I used to demonstrate the problem. It sets environment variables and compile flags to build for Mac OS X 10.5, even if you run it on 10.6.
    
    
  4. foundin changed to: "obsolete: 8.5.9"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "mthuurne"
  10. subsystem changed to: "40. Dynamic Loading"
  11. title changed to: "Compile error with --disable-load on Mac OS X"
  12. type changed to: "Bug"