Skip to content
Tcl Source Code View Ticket
Login

View Ticket

--disable-shared still links dynamically on Mac OS X

Closed / Fixed956908ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 22 years ago
Descriptionplain2004-05-19 17:58:04
The Mac OS X makefile does not support building a statically linked 
tclsh (useful for testing patches), so you have to use the configure 
script in the unix/ dir. This works ok, but passing in --disable-
shared causes a makefile which links against Tcl like:

-L/Users/neilmadden/tcl/unix/ -ltcl8.5

(or something like that). However, the Mac OS X linker still prefers 
to link dynamically against a system lib, if it can find one, so the 
above is ignored. The way to get around it is to manually hack the 
Makefile to just have the libtcl8.5.a listed as an object file, rather 
than using the -L/-l combo, e.g.:

/Users/neilmadden/tcl/unix/libtcl8.5.a

It would be nice if the configure script could detect building on Mac 
OS X and do this automatically.
tallniel Ticket [956908ffff]: 1 change [History diff]2004-05-20 01:01:28
dasplain2004-11-26 14:24:18
Logged In: YES 
user_id=90580

also c.f. duplicate 1071458
dasplain2005-01-25 13:53:26
Logged In: YES 
user_id=90580

fixed this by adding the linker flag '-Wl,-search_paths_first' to LDFLAGS in 
tcl.m4. c.f. man ld:
       -search_paths_first
              By default when the -dynamic flag is  in  effect,  the  -lx  and
              -weak-lx   options   first   search  for  a  file  of  the  form
              `libx.dylib' in each directory in the library search path,  then
              a  file  of  the  form  `libx.a'  is searched for in the library
              search paths.  This option changes  it  so  that  in  each  path
              `libx.dylib'  is searched for then `libx.a' before the next path
              in the library search path is searched.

fix committed to tcl and tk HEAD & core-8-4-branch and tclconfig
Log in (anonymous is fine) to add a comment.