简体   繁体   English

没有root用户安装TCL / TK

[英]Install TCL/TK without root

I'm trying to install TCL/TK as a regular user on RedHat 5: 我正在尝试以RedHat 5上的常规用户身份安装TCL / TK:

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: 到目前为止一切顺利:$ {BASE_PATH} /include/tcl.h存在,并且$ {BASE_PATH} /lib/tclConfig.sh看起来不错:

# 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: 然后,我尝试安装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?!? 我错过了什么?!?

I followed below steps to install tcl, tk on Linux(Ubuntu). 我按照以下步骤在Linux(Ubuntu)上安装tcl,tk。 please use sudo to avoid any permission related issue Create directory of your choice say /opt/tcltk 请使用sudo避免任何与权限相关的问题创建您选择的目录,说/ opt / tcltk

install tcl 安装tcl

  1. Create dir /opt/tcltk 创建目录/ opt / tcltk
  2. Download tcl8.6.9-src.tar.gz, tk8.6.9.1-src.tar.gz from ( http://www.tcl.tk/software/tcltk/download.html ) 从( http://www.tcl.tk/software/tcltk/download.html )下载tcl8.6.9-src.tar.gz,tk8.6.9.1-src.tar.gz
  3. Move above these two tar files in opt/tcltk/ 在opt / tcltk /中的这两个tar文件上方移动
  4. cd /opt/tcltk/ to install tcl8.6.9 cd / opt / tcltk /安装tcl8.6.9
  5. /opt/tcltk> sudo gunzip -c tcl8.6.9-src.tar.gz | / opt / tcltk> sudo gunzip -c tcl8.6.9-src.tar.gz | tar -xf - 焦油-xf-
  6. cd /opt/tcltk/tcl8.6.9/unix/ cd /opt/tcltk/tcl8.6.9/unix/
  7. /opt/tcltk/tcl8.6.9/unix> sudo ./configure --prefix=/opt/tcltk /opt/tcltk/tcl8.6.9/unix> sudo ./configure --prefix = / opt / tcltk
  8. /opt/tcltk/tcl8.6.9/unix> sudo make /opt/tcltk/tcl8.6.9/unix> sudo make
  9. Optional you can check make by executing “sudo make test” 可选,您可以通过执行“ sudo make test”来检查make
  10. /opt/tcltk/tcl8.6.9/unix> sudo make install /opt/tcltk/tcl8.6.9/unix> sudo make install
  11. verify installation by executing "/opt/tcltk/bin/tclsh8.6" on cli 通过在cli上执行“ /opt/tcltk/bin/tclsh8.6”来验证安装

Install tk 安装tk

  1. cd /opt/tcltk/ to Extract tk tar cd / opt / tcltk /提取tk tar

  2. /opt/tcltk/>sudo gunzip -c tk8.6.9.1-src.tar.gz | / opt / tcltk /> sudo gunzip -c tk8.6.9.1-src.tar.gz | tar -xf - 焦油-xf-

  3. /opt/tcltk/tk8.6.9/unix>sudo ./configure --prefix=/opt/tcltk /opt/tcltk/tk8.6.9/unix>sudo ./configure --prefix = / opt / tcltk

  4. /opt/degrib/tcltk/tk8.6.9/unix>sudo make /opt/degrib/tcltk/tk8.6.9/unix>sudo make

  5. sudo make install 须藤使安装

Please fell free to comments if there is any issue while installation 如果在安装过程中出现任何问题,请发表评论

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). 如果您想以普通用户身份安装Tcl,从源代码发行版开始就很容易做到(您需要选择所需的版本;我现在一般建议使用8.6.1,但这是一个建议势必会随着时间而改变)。

Then, change to the unix directory inside the unpacked source distribution and run ./configure ; 然后,转到解压缩的源分发版中的unix目录并运行./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. 重要说明:要以非root用户身份安装, 必须指定--prefix选项进行configure以说出要安装的位置,并且必须将其指定为完整路径。 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 . 然后,只需进行makemake install Or combine into one as make all install ; 或合并为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 ; 之后,我会发现通过执行/home/dkf/bin/tclsh8.6可以运行Tcl 8.6.1,二进制库和tclConfig.sh将位于/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. 如果未指定--prefix ,则源发行版将使用/usr/local作为默认目录,但是该目录通常只能由root用户写入。

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. 您必须指定这样的路径的原因是,Tcl的支持脚本的路径已包含在二进制库中。 (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. 构建Tk时,您需要同级的 Tcl构建。 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; 您还应该指定--with-tcl=并提供刚刚安装的tclConfig.sh的路径。 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. 一旦构建并安装了Tcl和Tk,您(可能)就不需要保留源代码树了。

OK, I admit that I do keep them around, but I'm a data packrat… 好的,我承认我确实在附近,但是我是一个数据包…

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM