From owner-freebsd-ports Wed Feb 7 14:05:45 1996 Return-Path: owner-ports Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id OAA01432 for ports-outgoing; Wed, 7 Feb 1996 14:05:45 -0800 (PST) Received: from time.cdrom.com (time.cdrom.com [192.216.222.226]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id OAA01394 for ; Wed, 7 Feb 1996 14:05:37 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by time.cdrom.com (8.6.12/8.6.9) with SMTP id OAA06728 for ; Wed, 7 Feb 1996 14:05:20 -0800 Prev-Resent: Wed, 07 Feb 1996 14:05:20 -0800 Prev-Resent: "ports@freebsd.org " Received: from freefall.freebsd.org (freefall.cdrom.com [192.216.222.4]) by time.cdrom.com (8.6.12/8.6.9) with ESMTP id NAA06579 for ; Wed, 7 Feb 1996 13:47:57 -0800 Received: from postman.osf.org (postman.osf.org [130.105.1.152]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id NAA29813 for ; Wed, 7 Feb 1996 13:48:05 -0800 (PST) Received: from coltsfoot.osf.org (coltsfoot.osf.org [130.105.3.72]) by postman.osf.org (8.6.9/8.6.x) with SMTP id QAA19943; Wed, 7 Feb 1996 16:46:57 -0500 Message-Id: <199602072146.QAA19943@postman.osf.org> To: John Ousterhout Cc: jkh@freefall.freebsd.org Subject: tcl7.5b1 shared libs patch, message #3 X-Face: "UZ!}1W2N?eJdN(`1%|/OOPqJ).Idk?UyvWw'W-%`Gto8^IkEm>.g1O$[.;~}8E=Ire0|lO .o>:NlJS1@vO9bVmswRoq3j DdX9YGSeJ5a(mfX[1u>Z63G5_^+'8LVqjqvn X-Url: http://www.osf.org/~loverso/ Date: Wed, 07 Feb 96 16:46:57 -0500 From: John Robert LoVerso Resent-To: ports@freebsd.org Resent-Date: Wed, 07 Feb 1996 14:05:20 -0800 Resent-Message-ID: <6726.823730720@time.cdrom.com> Resent-From: "Jordan K. Hubbard" Sender: owner-ports@freebsd.org Precedence: bulk This is the third set of fixes for shared libraries with 7.5b1/4.1b1. This affects SunOS 5.4, HP-UX 9, FreeBSD 2.1, and probably others. Basically, you are using explicitly named library files when linking tclsh and wish. I.e., this: gcc tclAppInit.o libtcl7.5.so -lm -o tclsh Many shared lib implementations record the name of the library, and remember if it was specified from the library search path via "-l" or given directly. When given directly, as above, the run time loader attempts to find the *file*, but it doesn't look in the library path! Hence, these loads need to be turned into gcc tclAppInit.o -L. -ltcl7.5 -lm -o tclsh Ditto for wish, gcc tkAppInit.o libtk4.1.so ../../tcl7.5b1/unix/libtcl7.5.so \ -L/usr/X11R6/lib -lX11 -lm -o wish should become gcc tkAppInit.o -L. -ltk4.1 -L../../tcl7.5b1/unix -ltcl7.5 \ -L/usr/X11R6/lib -lX11 -lm -o wish Ditto for the build of the libtk4.1.so itself. I ended up doing something like this: TCL_LIB = libtcl${_VERSION}${SHLIB_SUFFIX}.1.0 TCL_LIB_LD = -L. -ltcl${_VERSION} ... ${TCL_LIB}: ${OBJS} rm -f ${TCL_LIB} $(SHLIB_LD) -o ${TCL_LIB} ${OBJS} $(SH_LIBS) and for Tk: TK_LIB = libtk${_VERSION}${SHLIB_SUFFIX}.1.0 TK_LIB_LD = -L. -ltk${_VERSION} ... LIBS = -L$(TCL_BIN_DIR) -ltcl75 $(X11_LIB_SWITCHES) $(DL_LIBS) -lm ... ${TK_LIB}: $(OBJS) rm -f ${TK_LIB} $(SHLIB_LD) -o ${TK_LIB} $(OBJS) $(LIBS) This brings up the last of the sets of shared library build problems: SunOS 5.4: Tcl's Makefile included this, but Tk's did not: LD_FLAGS = -R ${LIB_INSTALL_DIR} FreeBSD (and maybe NetBSD, Linux): Shared libraries are named as: lib.so.. given that m,n are the major/minor revsion of the library. Naming the library (as it does by default) libtcl7.5.so causes the loader to not be able to find the installed lib, since it (mistakenly) believes it has major revision of 5! The solution is to build it as: libtcl75.so.1.0 This is what I did (above) as it is how the Tcl7.4 "package" installs, and it makes the most sense. Other/Older ways of doing this were: libtcl.so.7.5 which is how the Tcl7.3 "package" installs libtcl.so.75.0 which is how the TclX7.4 "package" installs Hence, ${_VERSION} was 75, verses ${VERSION} of 7.5. Without this fix, the compile succeeds on FreeBSD, but the resulting binary won't run. John