Installing Tcl Locally: Difference between revisions

From EggWiki
Jump to navigation Jump to search
(Created page with "__TOC__ == Installing Tcl == As you all know, Tcl ([http://www.tcl.tk/ official site], [http://en.wikipedia.org/wiki/Tcl wiki page]) is needed to compile Eggdrop, but some users may not possess root credentials needed to install Tcl via a package manager, or may wish to use a version of Tcl different from one already installed globally. Users can instead install a local copy to their shell. === Obtaining Tcl === Before doing anything else, we make sure that we are in o...")
 
No edit summary
 
Line 14: Line 14:


You should see something like this appear on your screen:
You should see something like this appear on your screen:
  username@shell:~$ wget https://prdownloads.sourceforge.net/tcl/tcl8.6.12-src.tar.gz
  username@shell:~$ wget {{LSR/Tcl/URL}}
   
   
  --2008-11-16 06:28:25--  {{LSR/Tcl/URL}}
  --2008-11-16 06:28:25--  {{LSR/Tcl/URL}}

Latest revision as of 04:34, 20 February 2022

Installing Tcl

As you all know, Tcl (official site, wiki page) is needed to compile Eggdrop, but some users may not possess root credentials needed to install Tcl via a package manager, or may wish to use a version of Tcl different from one already installed globally. Users can instead install a local copy to their shell.

Obtaining Tcl

Before doing anything else, we make sure that we are in our home directory, using the command:

cd ~

Next step of course is downloading Tcl! Recommended place for doing that is the official web page, or their Sourceforge page.

Easiest way to download directly to shell is using the command wget:

wget https://prdownloads.sourceforge.net/tcl/tcl8.6.12-src.tar.gz

You should see something like this appear on your screen:

username@shell:~$ wget https://prdownloads.sourceforge.net/tcl/tcl8.6.12-src.tar.gz

--2008-11-16 06:28:25--  https://prdownloads.sourceforge.net/tcl/tcl8.6.12-src.tar.gz
Resolving prdownloads.sourceforge.net... 216.34.181.60
Connecting to prdownloads.sourceforge.net|216.34.181.60|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://voxel.dl.sourceforge.net/sourceforge/tcl/tcl8.6.12-src.tar.gz [following]
--2008-11-16 06:28:25--  http://voxel.dl.sourceforge.net/sourceforge/tcl/tcl8.6.12-src.tar.gz
Resolving voxel.dl.sourceforge.net... 208.122.28.3, 208.122.28.21, 208.122.28.2, ...
Connecting to voxel.dl.sourceforge.net|208.122.28.3|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4405210 (4.2M) [application/x-gzip]
Saving to: `tcl8.6.12-src.tar.gz' 

100%[==================================================================>] 4,405,210   1.12M/s   in 3.8s

2008-11-16 06:28:29 (1.10 MB/s) - `tcl8.6.12-src.tar.gz' saved [4405210/4405210]

Now that we have downloaded the sources we need to configure and compile them.

Installing

First of all, we need to unpack that archive we just downloaded. We can do that by typing

tar -zxf tcl8.6.12-src.tar.gz

You can include v in -xfz (e.g. -zxvf) if you want to see all the files that are being unpacked from the archive but it's unimportant to us.

You should now have a directory called tcl8.6.12 along with that archive we downloaded. Next step is

cd tcl8.6.12

to enter that directory. When you are compiling things by hand like we are now, it's generally a good idea to read the README and/or INSTALL file(s) that come with the source. Reading the README file in this case tells us we need to enter subdirectory unix. Do that

cd unix

There is a README file inside that directory with detailed installation instructions but we'll keep it fast and simple.

Next we need to run the configure script. As we are installing Tcl locally in our shell, we need to change the default installation directories. We do that by specifying the --prefix switch. So our next command will look something like:

./configure --prefix=$HOME/local

This will change the default installation directory to local inside our home directory. $HOME is an environment variable containing the full path to your home directory. Alternatively you could have typed out the full path to your home directory (usually /home/username).

If the configure script executed without errors or warnings we can now proceed to make. In case the configure script reported errors or warnings I recommend you either google the error, ask in #tcl channel on any network or a help channel for your OS.

Next command will be

make

You will now see screen after screen of stuff that will mean absolutely nothing to you. But that's ok =) Just make sure there are no errors! Depending on the machine specifications it might take a while for the compile to finish.

If you get an error during this step similar to:

/usr/bin/ld: cannot find -ltcl86

Please issue the following command to fix it:

ln -s libtcl86.so.1 libtcl86.so

then proceed with make

After make ends we can proceed to make install. If you didn't specify the correct path when running configure or don't have write rights on that directory, 'make install' will fail! Now run

make install

After that finishes you should be able change to the directory we installed Tcl to and see the following directories in $HOME/local/

username@shell:~/local$ ls
bin  include  lib  man

To see if everything worked, you can issue the following command:

echo 'puts [info patchlevel]' | $HOME/local/bin/tclsh8.6

You should see:

8.6.12

Configuring Eggdrop

After you have successfully installed Tcl to your home directory, you can proceed to compiling your Eggdrop! The only smal change from the usual compilation of Eggdrop is that you need to tell Eggdrop where to look for the local version of Tcl you just installed. To do this, you must include two switches when running the configure script. Your ./configure line should now look like:

./configure --with-tcllib=$HOME/local/lib/libtcl8.6.so --with-tclinc=$HOME/local/include/tcl.h

It is important that you include the libtcl8.6.so and tcl.h in the switch! Otherwise it will not work! You can proceed as usual on the rest of installation.

Note: If you get an error like this when running make: error while loading shared libraries: libtcl8.6.so: cannot open shared object file..

Use this command if you use a bash shell: (you also may want to put this in your ~/.bashrc to enable it the next time you login)

export LD_LIBRARY_PATH=$HOME/local/lib:${LD_LIBRARY_PATH}

Use this command if you use a csh shell:

setenv LD_LIBRARY_PATH $HOME/local/lib:${LD_LIBRARY_PATH}


Installing tcllib

If you don't know what tcllib is, you probably don't need it. For those that do, here's some simple instructions on how to install it locally.


First of all, make sure we are in our home directory:

cd

Get the files:

wget https://core.tcl-lang.org/tcllib/uv/tcllib-1.20.tar.gz

Next step is to unpack the file we just downloaded:

tar -zxf tcllib-1.20.tar.gz

Change into the directory:

cd tcllib-1.20

Run the configure script, telling it to install the files to the same place where we previously installed Tcl:

./configure --prefix=$HOME/local

Install the files:

make install