This installation manual describes how to install tclscan based on your running tcl version.
To complete the instructions experience with a Linux environment rudimentary udnerstanding of coding and some patients are required.
Install tcl-dev and clang.
sudo apt-get install tcl-dev clangsudo subscription-manager repos --enable rhel-7-server-devtools-rpms
sudo subscription-manager repos --enable rhel-server-rhscl-7-rpms
sudo yum install llvm-toolset-7 tcl-develFor more troubleshooting see https://developers.redhat.com/products/clang-llvm-go-rust/hello-world/#fndtn-windows
Install rustup and cargo from source.
curl https://sh.rustup.rs -sSf | shSome of the code relies on features in the nightly build of rust, so you need to switch to it.
$ rustup toolchain install nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
$ rustup default nightlyActivate the rust environment in your shell
source ~/.cargo/envRust-bindgen is a tool that allows you to generate rust bindings from c header files.
Clone the rust-bindgen repository.
git clone https://github.com/rust-lang-nursery/rust-bindgenCheck out a recent release
git tag
...
v0.42.2
v0.42.3
v0.43.0
v0.43.1
vX.YY.Z
git checkout vX.YY.Z (e.g. the latest branch)
Update the cargo and build
cargo update
cargo buildPrepare the rust to c bindings in two steps:
- Edit
tclscan/src/mytcl.hto define the path totcl.hinstalled throughtcl-dev/tcl-devel. - Locate youre
libclang.sofile that you installed from the clang package.
Generate tcl.rs in the tclsca/src/ directory using bindgen
LD_PRELOAD=/usr/lib/llvm-6.0/lib/libclang.so.1 rust-bindgen/target/debug/bindgen -o tclscan/src/tcl.rs tclscan/src/mytcl.hIf you get the error
error: 'rustfmt' is not installed for the toolchain 'nightly-x86_64-unknown-linux-gnu'Simply install rustfmt:
$ rustup component add rustfmt --toolchain nightly-x86_64-unknown-linux-gnuUpate your running environment
cargo updateSet environment variable for linking against libtcl.so
export RUSTFLAGS="-C link_args="-ltcl""Compile the program
cargo buildA successfull build produce the executable tclscan/target/debug/tclscan.
If you want to install tclscan on other systems, keep in mind that it depends on libtcl.so in your $LD_LIBRARY_PATH.