install Tcl-8.5.10

本文详细介绍Tcl脚本语言的构建与使用方法,包括下载、安装步骤及配置细节,适用于LFS-7.0平台。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Introduction to Tcl

The Tcl package contains the Tool Command Language, a robust general-purpose scripting language.

This package is known to build and work properly using an LFS-7.0 platform.

Package Information

Additional Downloads

Optional Documentation

User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/tcl

Installation of Tcl

This package is also installed in LFS during the bootstrap phase. As it is not installed during Chapter 6 of LFS, installation instructions are included here in BLFS.

If you downloaded the optional documentation, unpack the tarball by issuing the following command:

tar -xf ../tcl8.5.10-html.tar.gz --strip-components=1

Install Tcl by running the following commands:

cd unix && ./configure --prefix=/usr \ --enable-threads \ --mandir=/usr/share/man && make && sed -i \ -e "s@^\(TCL_SRC_DIR='\).*@\1/usr/include'@" \ -e "/TCL_B/s@='\(-L\)\?.*unix@='\1/usr/lib@" \ tclConfig.sh

To test the results, issue: make test.

Now, as the root user:

make install && make install-private-headers && ln -v -sf tclsh8.5 /usr/bin/tclsh && chmod -v 755 /usr/lib/libtcl8.5.so

If you downloaded the optional documentation, install it by issuing the following commands as the root user:

install -v -m755 -d /usr/share/doc/tcl-8.5.10 && cp -v -R ../html/* /usr/share/doc/tcl-8.5.10

Command Explanations

--enable-threads: This switch forces the package to build with thread support.

make install-private-headers: This command is used to install the Tcl library interface headers used by other packages if they link to the Tcl library.

ln -v -sf tclsh8.5 /usr/bin/tclsh: This command is used to create a compatibility symbolic link to the tclsh8.5 file as many packages expect a file named tclsh.

sed -i -e ... tclConfig.sh: The Tcl package expects that its source tree is preserved so that packages depending on it for their compilation can utilize it. This sedremoves the references to the build directory and replaces them with saner system-wide locations.

Contents

Installed Programs: tclsh and tclsh8.5
Installed Libraries: libtcl8.5.so and libtclstub8.5.a
Installed Directories: /usr/lib/tcl8, /usr/lib/tcl8.5, /usr/share/man/mann, and optionally, /usr/share/doc/8.5.10

Short Descriptions

tclsh

is a symlink to the tclsh8.5 program.

tclsh8.5

is a simple shell containing the Tcl interpreter.

libtcl.so

contains the API functions required by Tcl.

转载于:https://www.cnblogs.com/ylqmf/archive/2012/01/14/2322555.html

📦 一、安装依赖环境 更新系统并安装基础编译工具: bash sudo apt update sudo apt upgrade -y sudo apt install build-essential autoconf automake libxmu-dev libx11-dev tcl8.5-dev tk8.5-dev -y 注:libxmu-dev和tcl/tk是NS2的核心依赖库136。 ⚙️ 二、处理GCC版本兼容性问题 Ubuntu 22.04默认GCC版本(≥11)与NS2不兼容,需降级至GCC-5: 安装GCC-5工具链: bash sudo apt install gcc-5 g++-5 -y 设置GCC-5为默认编译器: bash sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 50 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 50 sudo update-alternatives --config gcc # 选择gcc-5的编号 sudo update-alternatives --config g++ # 选择g++-5的编号 验证:gcc -v 应显示版本为5.x67。 📂 三、下载并解压NS2安装包 bash wget https://udomain.dl.sourceforge.net/project/nsnam/allinone/ns-allinone-2.35/ns-allinone-2.35.tar.gz tar -xzvf ns-allinone-2.35.tar.gz cd ns-allinone-2.35 🛠 四、修复已知编译错误 修改ls.h文件避免编译失败: bash sed -i '137s/erase(/this->erase(/' ns-2.35/linkstate/ls.h 注:此操作修正GCC高版本中C++作用域解析错误346。 ⚡ 五、执行安装脚本 bash sudo ./install 安装过程约需10-15分钟,出现 "Ns make successful!" 即成功16。 若失败,检查终端输出日志,常见问题多为依赖缺失或GCC版本未切换。 🔧 六、配置环境变量 编辑用户配置文件(以~/.bashrc为例): bash nano ~/.bashrc 在文件末尾添加(替换/home/username为你的实际路径): bash export PATH="$PATH:/home/username/ns-allinone-2.35/bin:/home/username/ns-allinone-2.35/tcl8.5.10/unix:/home/username/ns-allinone-2.35/tk8.5.10/unix" export LD_LIBRARY_PATH="/home/username/ns-allinone-2.35/otcl-1.14:/home/username/ns-allinone-2.35/lib:$LD_LIBRARY_PATH" export TCL_LIBRARY="/home/username/ns-allinone-2.35/tcl8.5.10/library" 应用配置: bash source ~/.bashrc ✅ 七、验证安装 终端输入 ns,出现 % 提示符即表示成功24: bash ns # 输出示例:% 运行测试用例(可选): bash cd ns-2.35 ./validate 这能行吗
最新发布
06-17
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值