问题
I'm trying to install TCL/TK as a regular user on RedHat 5:
TCL_VERSION=8.6.1
BASE_PATH=/myownpath
tar -xzf tcl${TCL_VERSION}-src.tar.gz
cd tcl${TCL_VERSION}/unix
./configure \
--prefix=${BASE_PATH} \
--without-tzdata \
--enable-64bit
make -j9
sed -e "s@^\(TCL_SRC_DIR='\).*@\1${BASE_PATH}'@" \
-e "/TCL_B/s@='\(-L\)\?.*unix@='\1${BASE_PATH}/lib@" \
-i tclConfig.sh
make install
make install-private-headers
chmod -v 755 ${BASE_PATH}/lib/libtcl*.so
So far so good: ${BASE_PATH}/include/tcl.h exists and ${BASE_PATH}/lib/tclConfig.sh looks fine:
# String to pass to the compiler so that an extension can
# find installed Tcl headers.
TCL_INCLUDE_SPEC='-I/myownpath/include'
Then I try installing TK:
tar -xzf tk${TCL_VERSION}-src.tar.gz
cd tk${TCL_VERSION}/unix
./configure \
--prefix=${BASE_PATH} \
--enable-64bit \
--with-tcl=${BASE_PATH}/lib \
make -j9
sed -e "s@^\(TK_SRC_DIR='\).*@\1${BASE_PATH}'@" \
-e "/TK_B/s@='\(-L\)\?.*unix@='\1${BASE_PATH}/lib@" \
-i tkConfig.sh
make install
make install-private-headers
chmod -v 755 ${BASE_PATH}/lib/libtk*.so
It fails at make with the following message:
tk8.6.1/unix/../generic/tk.h:19:17: error: tcl.h: No such file or directory
What did I miss?!?
回答1:
I followed below steps to install tcl, tk on Linux(Ubuntu). please use sudo to avoid any permission related issue Create directory of your choice say /opt/tcltk
install tcl
- Create dir /opt/tcltk
- Download tcl8.6.9-src.tar.gz, tk8.6.9.1-src.tar.gz from (http://www.tcl.tk/software/tcltk/download.html)
- Move above these two tar files in opt/tcltk/
- cd /opt/tcltk/ to install tcl8.6.9
- /opt/tcltk> sudo gunzip -c tcl8.6.9-src.tar.gz | tar -xf -
- cd /opt/tcltk/tcl8.6.9/unix/
- /opt/tcltk/tcl8.6.9/unix> sudo ./configure --prefix=/opt/tcltk
- /opt/tcltk/tcl8.6.9/unix> sudo make
- Optional you can check make by executing “sudo make test”
- /opt/tcltk/tcl8.6.9/unix> sudo make install
- verify installation by executing "/opt/tcltk/bin/tclsh8.6" on cli
Install tk
cd /opt/tcltk/ to Extract tk tar
/opt/tcltk/>sudo gunzip -c tk8.6.9.1-src.tar.gz | tar -xf -
/opt/tcltk/tk8.6.9/unix>sudo ./configure --prefix=/opt/tcltk
/opt/degrib/tcltk/tk8.6.9/unix>sudo make
sudo make install
Please fell free to comments if there is any issue while installation
回答2:
If you're wanting to install Tcl as a normal user, it's easy to do so starting with the source distribution (you'll need to pick the version you want; I recommend 8.6.1 in general right now, but that's a recommendation that's bound to change over time).
Then, change to the unix
directory inside the unpacked source distribution and run ./configure
; IMPORTANT: to install as non-root you must specify the --prefix
option to configure
to say where it is going to be installed, and you have to specify it as a full path. For example, if I was to install it beneath my home directory, I'd use:
./configure --prefix=/home/dkf
Then, just do make
and make install
. Or combine into one as make all install
; if you're not installing as a different user, you can do it as one step. After this, I'll find I can run Tcl 8.6.1 by doing /home/dkf/bin/tclsh8.6
and the binary library and tclConfig.sh
will be in /home/dkf/lib
; adjust in the obvious way for the path you specify. If you do not specify the --prefix
, the source distribution uses /usr/local
as a default, but that's a directory which is only normally writable by the root user.
The reason you have to specify the path like this is that the path to Tcl's support scripts is baked into the binary library. (It's runtime overridable, but I don't recommend doing that when you can easily just get things right to start out with.)
When building Tk, you need a sibling Tcl build. Currently, you're recommended to have them be the same version too. You should also specify --with-tcl=
and give the path to the tclConfig.sh
that you just installed; while it might work without, it's easiest to just do it this way. Once you've built and installed Tcl and Tk, you (probably) don't need to keep the source trees around.
OK, I admit that I do keep them around, but I'm a data packrat…
来源:https://stackoverflow.com/questions/19163983/install-tcl-tk-without-root