[Fwd: Re: Scotty Shared library]

Graeme McKerrell (graemem@pdd.3com.com)
Wed, 19 Jun 1996 07:43:33 +0100

Received: from gonzo (localhost) by gonzo.pdd.3com.com; Tue, 18 Jun 96 17:09:43 BST
Sender: graemem
Message-Id: <31C6D4C7.15FB7483@pdd.3com.com>
Date: Tue, 18 Jun 1996 17:09:43 +0100
From: Graeme McKerrell <graemem@pdd.3com.com>
Organization: 3Com Ltd
X-Mailer: Mozilla 2.0 (X11; I; SunOS 4.1.3_U1 sun4m)
Mime-Version: 1.0
To: Andrew Yoder <ayoder@fore.com>
Subject: Re: Scotty Shared library
References: <199606171923.PAA10534@dolphin.fore.com>
<31C64AEE.794BDF32@pdd.3com.com> <199606181538.LAA21478@dolphin.fore.com>
Content-Type: multipart/mixed; boundary="------------59E2B6001CFBAE393F54BC7E"
X-Mozilla-Status: 0011

This is a multi-part message in MIME format.

--------------59E2B6001CFBAE393F54BC7E
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Andrew Yoder wrote:
>
> Hi,
>
> Thanks for your help. I've gotten scotty to compile now. Did you have
> any problems with scotty not being able to find the tnm.so library?
>
> Scotty gives me this error:
> ---------------
> initialization failed: can't find package scotty 2.1.0
> This usually means that you have to define the TCLLIBPATH environment
> variable to point to the tnm library directory or you have to include
> the path to the tnm library directory in Tcl's auto_path variable.
> ---------------
>
> I set TCLLIBPATH to be the directory which contains tnm.so, but this
> does not seems to aleaviate the problem. Any ideas?
>
> Thanks for your help,
> Andy Yoder
>
I've set up a directory structure which enables the running of dynamically
loading code in a relocatable manner

ROOT--+
+-bin-+
| +-addprog (script for dynamic launching)
| +-scotty ----> link to addprog
| +-tclsh ----> link to addprog
| +-wish ----> link to addprog
| |
| +-sun4-+
| +-scotty2.1.0
| +-tclsh7.5
| +-wish4.1
| +-scotty ----> link to scotty2.1.0
| +-tclsh ----> link to tclsh7.5
| +-wish ----> link to wish4.1
|
+-lib-+
| +-pkgIndex.tcl
| +-tclConfig.sh
| +-tkConfig.sh
| +-libresolv.so.1.0
| +-libtcl75.so.1.0
| +-libtk41.so.1.0
| +-tnm2.1.0.so
| +-tcl7.5-+
| | +--- MAIN TCL STUFF
| |
| +-tk4.1-+
| | +--- MAIN TK STUFF
| |
| +-tnm2.0.1-+
| | +--- MAIN TNM STUFF
| |
| +-tkined4.1-+
| | +--- MAIN TKINED STUFF
| |
| +-tcl ----> link to tcl7.5
| +-tk ----> link to tk4.1
| +-tnm ----> link to tnm2.1.0
|
+-man-+
| +- MAIN MANUAL STUFF
|
+-include-+
+ MAIN INCLUDE STUFF

The ROOT directory is specified as -prefix when using configure to set up the
makefiles for the various packages.
Once the installation is in place however there is no path dependancy and hence
load problems if the "addprog" script is used. This script is included below and
changes it's function depending on what it is named, hence the softlinks to it
actually launch the program with the same name in the relavent architechture
directory.
ROOT can be set to anything as long as the relative relationship between bin
and lib stay the same.

-- CUT HERE --
#!/bin/sh
#########################################
# This script starts up a program in a
# architecture independant
#########################################
ARCH=`arch`
FILE=`basename $0`
#
# We need to get an absolute path name to the distribution
#
PWD=`dirname $0`
#
# If this is an absolute pathname then we're done...
#
if (test -f "/./$0") then
echo "Great this is an absolute pathname!"
else
#
# ... it's not so prepend the current working directory
#
PWD=`pwd`/$PWD
fi

if(test $FILE = "addprog" ) then
echo "*************************************************"
if(test -d $ARCH) then
echo "Directory for \"$ARCH\" exists, that's a good start."
else
echo "Creating directory for \"$ARCH\"."
mkdir ARCH
fi
for i in $@ ; do
echo "Creating architecture independant file for \"$i\""
ln -s addprog $i
done
echo "*************************************************"
else
file=$PWD/$ARCH/$FILE
if(test -f $file) then
#
# Set up the environment variables for this distribution
#
export TCL_LIBRARY TK_LIBRARY TNM_LIBRARY LD_LIBRARY_PATH TCLLIBPATH
TCL_LIBRARY=$PWD/../lib/tcl
TK_LIBRARY=$PWD/../lib/tk
TNM_LIBRARY=$PWD/../lib/tnm
TCLLIBPATH=$TNM_LIBRARY
LD_LIBRARY_PATH="$PWD/../lib:$LD_LIBRARY_PATH"
exec $file $@
else
echo "*************************************************"
echo "\"$file\" not found"
echo "*************************************************"
fi
fi
-- CUT HERE --

Hope this helps
Yours
Graeme

--------------59E2B6001CFBAE393F54BC7E
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename=".sig2"

_______________________________________________________
/ ___ | \
| ,' ` | """ |
| | ;--, .~~~, .~~~, .~~,~~. .~~~, | O O |
| | ``; | | | |---' | ! | |---' | ` ^ ' |
| `.__,' .!. `._.'. `._.' `. .' `._.' | (\_/) |
| | \_/ |
| graemem@pdd.3com.com | |
| | |
\_______________________________________________|________/
--------------59E2B6001CFBAE393F54BC7E--