Landslide TCL API Installation Guide

Introduction

The Landslide Tcl API provides support for 64-bit or 32-bit Tcl/Java on Linux, Windows and Mac.
64-bit Tcl/Java is possible on Windows and Mac, but user must provide their own Tcl and/or compile
their own Tcl/TclJBlend libraries. For information on how to compile see Compile Landslide provided 64-bit TCL 8.6.10

Landslide Tcl API depends upon TclBlend or tclJBlend. We provide TclBlend libraries for 32-bit
Linux and Windows installations, and JBlend for 64-bit Linux, Windows, and MAC installations.
The 64-bit Windows and Mac JBlend libraries are included in the JBlendLibs.zip file that will be in the
Landslide Tcl API Packages/Files (landslidetclapi.zip) file. For JBlend download and usage from tclJBlend WiKi page.

Java 8+ (1.8.0) is required for the Landslide TCL API.
The 32-bit and 64-bit 1.8.0 JRE for common OSs can be downloaded from the Landslide Troubleshoot Java Web Start Problems page.
All Java versions can be downloaded from Oracle's Java Website or for Open JDK from AdoptOpenJDK page.

If any of the file links return 404/not found, i.e. are not available from the Landslide homepage, ask Support for copies.

Once you have installed the Tcl API, go to the Using the Tcl API topic in the Landslide User Guide for more information.

Table of Contents

I. Standalone Installation

If do not already have your own Tcl installed on your system, you can use our provided version of Tcl 8.4 (32-bit) or Tcl 8.6 (64-bit) that is pre-packaged to work with our Tcl API.

A. Linux 64-bit Installation Instructions:

Our standalone Tcl API install provides its own version Tcl 8.6.10 compatible with 64-bit Java.

  1. Download
  2. Create a new directory on your computer as the landslide tcl api home, e.g. ~/landslidetclapi
  3. Extract linux64tclblend8.6.tar.gz to that directory
    • cd to the landslide tcl api home
    • tar zxf <path to linux64tclblend8.6.tar.gz>
      Note: If your Linux architecture is special and you need to compile your own Tcl binary using the tcl8.6.10 that we provided, please see Section V
  4. Extract landslidetclapi.zip to that directory
    • cd to the directory
    • unzip <path to landslidetclapi.zip> or jar xf <path to landslidetclapi.zip> (You will need either jar utility or unzip utility in your path)
  5. Copy jtclsh64 to landslidetclapi
  6. Edit landslidetclapi, setting the api_home and JVM_LIB_PATH and confirm JAVA_MAX_MEMORY
    vi landslidetclapi
                #######################################################################
                # Install location for the landslide TCL api and JRE libjvm.so/libjvm.dylib library
                # Set these to the correct locations for your 64-bit system
                #######################################################################
                api_home=/home/tester/landslidetclapi
                export JVM_LIB_PATH=/usr/jdk8u282-b08/jre/lib/amd64/server/libjvm.so
                jblend_lib=${api_home}/lib/tclJBlend-2.1
                
    			...
    
                #Change this to meet your memory needs of the Tcl API
                export JAVA_MAX_MEMORY=1024m      
               
    For Standalone case you only need to change the api_home to match the directory that you installed the Tcl API into and set the pathname of your Java's libjvm.so (or libjvm.dylib on Mac) file.
    jblend_lib can be changed if you are using your own JBlend libraries, but we include version 2.1 in our standalone setup.
  7. Make sure landslidetclapi is executable, then run it.
  8. Example:
                -bash-5.0$ mkdir landslidetclapi
                -bash-5.0$ cd landslidetclapi
                -bash-5.0$ tar zxf ../linux64tclblend8.6.tar.gz
                -bash-5.0$ unzip -q ../landslidetclapi.zip
                -bash-5.0$ cp jtclsh64 landslidetclapi
                -bash-5.0$ chmod 755 landslidetclapi
                -bash-5.0$ vi landslidetclapi
                
    //EDIT THE VARIABLES IN THE FILE AT THIS POINT

    #######################################################################
    # Install location for the landslide TCL api, JBlend, and JRE libjvm.so library
    # Set these to the correct locations for your 64-bit system
    #######################################################################
    api_home=/home/tester/landslidetclapi
    export JVM_LIB_PATH=/usr/jdk8u282-b08/jre/lib/amd64/server/libjvm.so
    jblend_lib=${api_home}/lib/tclJBlend-2.1

    //SAVE AND EXECUTE
                -bash-5.0$ ./landslidetclapi
                % source landslidetclapi.tcl
                Starting Java with Max Heap=1024m
                Debug Logs will be located in: /home/tester/.tas named: tclapi_0_.N.log
                %         
               
    Issues? See Troubleshooting before contacting support

B. Linux 32-bit Installation Instructions:

If you have any issues with missing 32-bit libraries when using Java 8, see KB article, KNI14185

  1. Download
  2. Create a new directory on your computer as the landslide tcl api home, e.g. ~/landslidetclapi
  3. Extract linuxtclblend.tar.gz to that directory
    • cd to to the directory
    • tar zxf <path to linuxtclblend.tar.gz>
  4. Extract landslidetclapi.zip to that directory
    • cd to the directory
    • unzip <path to landslidetclapi.zip> or jar xf <path to landslidetclapi.zip> (You will need either jar utility or unzip utility in your path)
  5. Copy jtclsh to landslidetclapi
  6. Edit landslidetclapi, setting the api_home and jre_home
                   # Install location for tclblend and landslide Tcl API
                   # Set these to the location of your tclblend and JRE
                   api_home=/home/user/landslidetclapi  --- Path to your directory
                   
                   jblend_lib=${api_home}/lib/tclJBlend-2.1
                   
                   #And update JVM_LIB_PATH:
                   export JVM_LIB_PATH=/usr/java/jre1.8.0_121/lib/amd64/server/libjvm.so
                   
                   #Change this to meet your memory needs of the Tcl API
                   export JAVA_MAX_MEMORY=1024m
                
  7. Make sure landslidetclapi is executable, then run it.
Issues? See Troubleshooting before contacting support

C. Windows 64-bit Installation Instructions:

  1. Download
  2. Create a new directory on your computer as the landslide tcl api home, e.g. C:\landslidetclapi
  3. Extract linux64tclblend8.6.tar.gz to that directory
    • cd to the landslide tcl api home
    • tar zxf <path to linux64tclblend8.6.tar.gz>
      Or just use a Zip/tar utility application
  4. Extract landslidetclapi.zip to that directory
    • cd to the directory
    • unzip <path to landslidetclapi.zip> or jar xf <path to landslidetclapi.zip>
      Or just use a Zip/tar utility application
  5. Copy jtclsh64.bat to landslidetclapi.bat
  6. Install a Windows 64-bit version of Tcl 8.6, if not already installed.

    Here are some Windows Tcl binaries found on the web: Note: If you need to compile your own Tcl binary using the tcl8.6.10 that we provided, please see Section V

  7. Edit landslidetclapi.bat, setting the API_HOME, JAVA_HOME, and JVM_LIB_PATH and TCLSH
    			rem Set this to where you installed Landslide API, i.e. most likely the directory this file is in
    			set API_HOME=D:/TclApi
    			
    			rem Set this to where Java/JRE is installed
    			set JRE_HOME=C:/Programs/Java/zulu11.58.23-ca-jre11.0.16.1-win_x64
    			
    			rem Set this to where Java/JRE main DLL is located
    			set JVM_LIB_PATH=C:/Programs/Java/zulu11.58.23-ca-jre11.0.16.1-win_x64/bin/server/jvm.dll
    			
    			rem Set this to your TCL Executable location
    			set TCLSH=%API_HOME%/IronTcl/bin/tclsh86t
    			
    			rem Change this as needed for memory
    			set JAVA_MAX_MEMORY=256m
               
    API_HOME: The directory you created in step 2.
    JRE_HOME: The directory of the installed Java distribution you want to use with Tcl API.
    JVM_LIB_PATH: The pathname of the libjvm.dll or jvm.dll that comes with the Java in JRE_HOME.
    TCLSH: The pathname of the Tcl 8.6 executable from step 6.
    JAVA_MAX_MEMORY: Set the Java memory to allocate to the Tcl API. This will need to be increased based on your own requirements
  8. Make sure landslidetclapi.bat is executable, then run it.

C. Windows 32-bit Installation Instructions:

  1. Download
  2. Create a new directory on your computer, e.g. C:\landslidetclapi
  3. Extract windowstclblend.zip to that directory
  4. Extract landslidetclapi.zip to that directory (you can use a zip utility like Winzip or the jar tool that comes with Java JDK)
  5. Copy jtclsh.bat to landslidetclapi.bat
  6. Edit landslidetclapi.bat, setting the API_HOME and JRE_HOME
                   rem Set this to where you installed Landslide API
                   set API_HOME=D:/COTS/tclapi
                
                   rem Set this to where Java/JRE is installed
                   set JRE_HOME=c:/Programs/Java/jdk1.6.0_10/jre
                
                   rem Change this to meet your memory needs of the Tcl API
                   export JAVA_MAX_MEMORY=1024m
                 
  7. Run landslidetclapi.bat

II. Adding Landslide Tcl API to existing Tcl Installations

If you already have your own Tcl installation, then you can install our Tcl API as a package to your Tcl configuration. Your Tcl environment should be compiled to support threading.

III. Upgrade Instructions

You must upgrade your Landslide Tcl API any time you upgrade your TAS! Just follow this simple procedure:

  1. Download and extract Landslide Tcl API Packages/Files (landslidetclapi.zip) to your api directory
  2. If upgrading from pre 14.0 release using an older JRE, you will need to change your JRE variables accordingly and possibly install JRE 8+.

IV. Troubleshooting:

These are some notes that may help in troubleshooting Tcl API setups.

If you get this error on startup:

            "XpUtils::iload -d /home/ddiolosa/api/lib/tcljava1.4.1 tclblend" failed:
            couldn't load file "/home/ddiolosa/api/lib/tcljava1.4.1/libtclblend.so": 
            libjava.so: cannot open shared object file: No such file or directory
         

This means you are not pointing to a JRE properly... Is LD_LIBRARY_PATH pointing to 32-bit JRE or 64-bit JRE to match your target installation?
If you are still installing the 32-bit API, it requires 32-bit libraries even if running on 64-bit linux, if they are not installed, you should try these commands to make sure:

            Redhat/Centos/yum: yum install unzip glibc.i686
            Debian/apt-get: apt-get install lib32z1 lib32gcc1
      

If you get this error on startup:

            JNI_CreateJavaVM failed.  Please also check "tclblend_init" settings and
			if your JVM is compatible with the Tcl interpreter (i.e. both 34 bit or
			both 64 bit)
      

This means the JRE you are pointing to is not supported for some reason by the API. It could be 32-bit vs 64-bit thing or some other special JRE limited distribution. Try a different JRE. A Server JRE seems to work better than Client JRE.

If you get this warning on login:

         Java HotSpot(TM) Client VM warning: You have loaded library
         /home/ddiolosa/api/lib/tcljava1.4.1/libtclblend.so  
         which might have disabled stack guard. The VM will try to fix 
         the stack guard now.
       

We have provided a new libtclblend.so in your API directory, you can copy this into API_HOME/lib/tcljava1.4.1 directory.Or else you will want to run execstack to remove the warning:

         /usr/sbin/execstack -c API_HOME/lib/tcljava1.4.1/libtclblend.so
         apt-get install execstack
       

You may need to get libhpi.so, which we provided in the API_HOME directory. See KB http://docid.spirent.com/KNI14185.
And install in your JRE as directed, or else put it somewhere else in your library path.

If you get this warning when exiting Tcl:
libgcc_s.so.1 must be installed for pthread_cancel to work
You need to get your 32-bit libgcc_s.so.1.
We have provided one that should be in your API_HOME.
Just put this file in your library path somewhere, maybe in API_HOME/lib

If you get these warnings:

         “ java.lang.UnstatisfiedLinkError:/xxxx/lib/i386/libbawt_xawt.so:libXext.so.6: cannot open shared object file:no such file or directory”. 
         “ java.lang.UnstatisfiedLinkError:/xxxx/lib/i386/libbawt_xawt.so: libXrender.so.1: cannot open shared object file:no such file or directory”. 
         “ java.lang.UnstatisfiedLinkError:/xxxx/lib/i386/libbawt_xawt.so: libXi.so.6: cannot open shared object file:no such file or directory”.          
        

Explanation/Resolution:
See KB http://docid.spirent.com/KNI14828 There are three required packages for i386 architecture missing in the system which are libxrender1, libxtst6, libxi6. They can be fixed by install these three packages: apt-get install libxrender1:i386 libxtst6:i386 libxi6:i386

Compile Landslide Provided 64-bit TCL 8.6.10

  1. Please cd to the <path to landslide tcl api home>
  2. tar zxf tcl8.6.10-src.tar.gz in current directory
  3. cd to the /tcl8.6.10/unix
  4. enter following command:

                      > ./configure --prefix= <absolute directory path of landslide tcl api home > --enable-64bit --enable-threads
                      >  make && make install
            
  5. for mac, cd to the /tcl8.6.10/macos
  6. enter following command, if you want more options, follow the README

                      > ./configure --prefix= <absolute directory path of landslide tcl api home > --enable-64bit --enable-threads
                      >  make -C .
                      >  sudo make -C . install