THIS PAGE IS OBSOLETE

Build and Installation Procedures for the EPICS Input/Output Controllers (IOCs) on 64-bit machines

The following notes provide details on how to build the base EPICS and the LBTO TCS and IT IOCs as user "tcs" on the 64-bit test machine machine in Tucson (tcs-test.tucson.lbto.org). The build is done such that the files can be saved in a tarball and put on any machine for use. By setting up the proper environment variables and overlaying the LBTO-specific files, the LBTO-configured version of the EPICS ALH can be run either on the mountain or on the Tucson Test Cluster.

0. Logon as tcs@tcs-test.tucson.lbto.org and do the following:
cd /home/tcs/ioc
mkdir epics 
cd epics  (/home/tcs/ioc/epics the <top>). 

Use "/home/tcs/ioc/epics" everywhere you see <top> in the directions."

1. Download tarballs into this newly created directory:

2. Create setupBuild.sh file with the following environment variables for use when building EPICS/ALH:

export EPICS_HOME="/home/tcs/ioc/epics"
export EPICS_BASE="${EPICS_HOME}/base-3.14.12.4"
export EPICS_EXTENSIONS="${EPICS_HOME}/extensions"
export EPICS_HOST_ARCH=`${EPICS_BASE}/startup/EpicsHostArch`

export EPICS_LBT_ALH_SUPPORT="${EPICS_HOME}/LBTALHSupport"
export EPICS_LBT_ALH_CONFIGURE="${EPICS_HOME}/LBTALHConfigure"
export ALARMHANDLER="${EPICS_LBT_ALH_CONFIGURE}"

export PATH="${PATH}:${EPICS_BASE}/bin/${EPICS_HOST_ARCH}:${EPICS_EXTENSIONS}/bin/${EPICS_HOST_ARCH}"

if [ -z "$LD_LIBRARY_PATH" ];  then
  export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${EPICS_BASE}/lib/${EPICS_HOST_ARCH}:${EPICS_HOME}/lib/${EPICS_HOST_ARCH}"
else
  export LD_LIBRARY_PATH="${EPICS_BASE}/lib/${EPICS_HOST_ARCH}:${EPICS_HOME}/lib/${EPICS_HOST_ARCH}"
fi

This setup file is NOT exactly the same as the environment variables that will be needed for running EPICS/ALH. However, in order to build EPICS the first time, you need to have certain EPICS environment variables set. This file exists in SVN (https://svn/repos/alh/trunk/setupBuild.sh).

3. Unpack the EPICS base while in <top>:
tar xvfz baseR3.14.12.4.tar.gz

4. Get into the configuration directory:
cd base-3.14.12.4/configure

5. Edit the CONFIG_SITE file. The "LINKER_USE_RPATH" should be set to "NO". Note: This will require setting of environment variables (setupBuild.sh) so the Base executables can find their shared libraries at build-time.

6. Now cd to /home/tcs/ioc/epics/base-3.14.12.4/src/cap5 and edit the Makefile. The "xsubpp" is not in the location as described by default by this file. Change the line

$(PERL) $(EXTUTILS)/xsubpp -typemap $(EXTUTILS)/typemap $< > $@_new && $(MV) $@_new $@

to

xsubpp -typemap $(EXTUTILS)/typemap $< > $@_new && $(MV) $@_new $@

7. cd ../.. (This should put you back in /base-3.14.12.4)

8. Run the setupBuild.sh script to set the environment variables and then make as follows:
source ../setupBuild.sh
gmake
cd ..
ln -s base-3.14.12.4 base   (You need this soft link in order to build the extensions). 

9. Now build the EPICS extensions (in 2 parts).

Part 1:
cd <top>
tar xvfz extensionsTop_20120904.tar.gz
cd extensions
gmake

cd src
tar xvfz gateway2_0_5_1.tar.gz
mv gateway2_0_5_1 gateway
cd gateway
gmake
cp -p O.linux-x86_64/gateway ../../bin/linux-x86_64/.

Note this second part is being deferred at this time (10 July 2015) as only the services are moving to a 64-bit environment and not the GUIs. There are no GUI libraries on tcs-test at this time.
Part 2: build the alarm handler

cd ./src (extensions/src directory)
cp ../../alh1_2_33.tar.gz .
tar xvfz alh1_2_33.tar.gz
cd alh1_2_33
gmake

The alh executable lives /extensions/bin/linux-x86 by default.

10. Build the TCS and IT IOCs
When running the makeBaseApp.pl, make sure you use the full path name to the perl script or you will get errors that it cannot find various files when you do the gmake.

Multiple IOCs can be setup in the same manner. The LBTO IOCs are called tcsioc (for TCS services) and itioc (for server alerts). In the LBTO case, the following was done.

cd <top>
<top>/base-3.14.12.4/bin/linux-x86_64/makeBaseApp.pl -t example tcsioc              (This IOC is called "tcsioc".)
<top>/base-3.14.12.4/bin/linux-x86_64/makeBaseApp.pl -i -t example tcsioc           (Do not enter an "Application name" when prompted.)
gmake                                                                

and

cd <top>
<top>/base-3.14.12.4/bin/linux-x86_64/makeBaseApp.pl -t example itioc              (This IOC is called "itioc".)
<top>/base-3.14.12.4/bin/linux-x86_64/makeBaseApp.pl -i -t example itioc           (Do not enter an "Application name" when prompted.)
gmake

Be careful after having made the IOC. If you make again after altering the base build, you will blow away any subsequent modifications you have made!

11. Following the standard procedure:
cd iocBoot/itioc
chmod +x st.cmd
cd../tcsioc
chmod +x st.cmd

These files will be superseded in Step 12.

12. The LBTO-specific files stored in SVN are layered on top of the EPICS build. The SVN files include setup scripts, service scripts, and an "ALH" script used to launch the ALHGUI. Update or check out the alh trunk in order to get the latest version of the files. Since this is the "build" location, the trunk directory should not be deleted as one can then easily tell which LBTO-specific files have been updated since the last build.
 
cd <top>
svn co https://svn.lbto.org/repos/alh/trunk

or 

cd trunk
svn update
 
cp <top>/trunk/itioc/* <top>/iocBoot/itioc/.
cp <top>/trunk/tcsioc/* <top>/iocBoot/tcsioc/.
cp <top>/trunk/itiocApp/src/* <top>/itiocApp/src/.
cp <top>/trunk/tcsiocApp/src/* <top>/tcsiocApp/src/.
cp <top>/trunk/GATEWAY.access <top>/bin/linux-x86_64/.

The first two commands will copy the it.cmd and tcs.cmd files which supersede the corresponding st.cmd file in the respective directories. Also, the envPaths files will be put into the boot directories. The next two commands copy the ioc main programs, itiocMain.cpp and tcsiocMain.cpp, as well as their respective Makefiles into the proper directories. While the systems are in transition from 32-bit to 64-bit, one will probably have to edit the first line of the it.cmd and tcs.cmd files to ensure the 64-bit binary directory is used. The first line should refer to "linux-x86_64" and not "linux-x86". The paths in the envPaths file will probably also need to be updated for the destination machine (three paths will probably need to be changed).

13. The tcsioc obtains TCS Data Dictionary values via the Data Dictionary Service (DDS). There are Ice files in SVN which are needed to support the tcsioc. On the 64-bit machine, you should use version 3.5.1 version of Ice. As such, the Makefile has to be modified to use the newer version. Edit two of the last three lines in the tcsiocApp/src/Makefile such that they look like this:
ICE_HOME:=/lbt/tcs_runtime/Ice-3.5.1
USR_INCLUDES+=-I$(ICE_HOME)/include
USR_LDFLAGS+= -L$(ICE_HOME)/lib64 -Wl,-rpath,$(ICE_HOME)/lib64 -lIce -lIceUtil

There are three changes which have been made in contrast to the 32-bit Makefile.

14. Now build the tcsioc.
cd <top>/tcsiocApp/src 
svn export https://svn.lbto.org/repos/tcs/trunk/dds/ice/DDSServer.ice
svn export https://svn.lbto.org/repos/tcs/trunk/dds/ice/Factory.ice
/lbt/tcs_runtime/Ice-3.5.1/bin/slice2cpp DDSServer.ice
/lbt/tcs_runtime/Ice-3.5.1/bin/slice2cpp Factory.ice
gmake clean
gmake

15. Now make the itioc which reads its channel information from an ASCII text file, /lbt/data/logs/zabbix/zabbix_alerts.log, on tcs64-1 (this is being set up as of 10 July 2015).
cd <top>/itiocApp/src 
gmake clean
gmake

16. Copy the ancillary scripts into the <top> directory from the SVN checkout so these files can be packaged with the rest of the code for the destination system. Please be aware that you may have to change some directory paths in all of these files to be the proper place on the destination system.
cd <top>
cp trunk/setup.sh . (for now this is the same as setupBuild.sh with an extra line to define ZABBIX_DIR)
cp trunk/ALH . (check setup script being sourced)
cp trunk/epics-iocs .  (check EPICSDIR) 

17. Create a subdirectory for the LBT ALH support files:
mkdir LBTALHSupport
cp trunk/LBTALHSupport/* LBTALHSupport/.

18. Make a tar file of the LBT ALH configuration files. This step is currently obsolete.

cd trunk/LBTALHConfigure
tar cvpf ALHConfigureDDMMM.tar ALH*.alhConfig
mv ALHConfigureDDMMM.tar ../../.

19. Create a tar of the entire build.

cd .. (This is one directory above <top>.)
tar cvpf EpicsIOC10July2015.tar epics

20. Logon to the destination machine as user ioc and unpack the tar file. (13 Juy 2015: I had to login to tcs64-1 as user tcs, copy the tar file and put it into /lbt. I then unpacked it as user ioc.)
ssh -X ioc@tcs64-1.mountain.lbto.org
cd /lbt
scp tcs@tcs-test.tucson.lbto.org:/home/tcs/ioc/EpicsIOC10July2015.tar
tar xvpf EpicsIONC10July2015.tar    

Once the "epics" directory is created in /lbt, delete the tar file.

21. Now check the following
  1. EPICSDIR is set correctly in the epics-ioc service startup file
  2. check the setup.sh file EPICS_HOME variable is set correctly for the destination directory
  3. check the ALH script has the correct address for the setup.sh file (ALH is still being run from the 32-bit machines pointing to a different home directory.)
  4. delete the trunk directory
  5. delete all tar files in /lbt/epics
  6. make sure the iocBoot/[it|tcs]ioc/envPaths file is set correctly
  7. make sure the LBTALHSupport/ice.cfg file has the correct IP (or server name) where the dds is running

22. The public EPICS/ALH configuration files must be put in the public directory which is currently "/home/telescope/TCS/Configuration/ALH". The files here may or may not need to be updated.
su -l telescope
cd /home/telescope/TCS/Configuration/ALH
cp /lbt/epics/ALHConfigureDDMMM.tar .  
tar xvpf ALHConfigureDDMMM.tar

This will have created a directory, LBTALHConfigure, whose contents are the ALH configuration files for the entire system.

23. Create an ALH link in /lbt/astronomy/bin. This is already done on the obs (32-bit) machines.
cd /lbt/astronomy/bin
ln -s /lbt/epics/ALH ALH

Before the tcsioc is started, you need to make sure the IP which is associated with the TCS Data Dictionary Service (DDS) is set properly. This value is set in a "private" ALH configuration file, ice.cfg, which is located in the directory associated with the EPICS variable LBTALHSupport.

24. Finally, put the epics-ioc in /etc/init.d as user ioc.

cd /etc/init.d
cp /lbt/epicsv1.0/epics*service .

25. The IOCs can be started by the service or manually (if necessary). It is best to start/stop the IOCs via the service. As user ioc or tcs on host ioc (aliased to tcs1 or tcs2), type
sudo systemctl start epics-ioc

Note: The TCS IOC writes information to SYSLOG (local 6) which is also written to stdout.

26. Execution - The ALH GUI is only available to run on 32-bit machines (obs for example). Log in to obs and run ALH . Only the telescope user has permission to write to the log files and has permission to acknowledge alarms.

ALH.png

Note: To run an alarm handler on a different machine than the one running the ioc, set EPICS_CA_ADDR_LIST environment variable to the IP address of the gateway, with the correct port.
export EPICS_CA_ADDR_LIST "192.168.3.16:5066"

Stop and start the TO's ALH running on obs1:
ssh -X telescope@obs1.mountain.lbto.org
setenv DISPLAY :0
ALH &

27. Once the IOC is running, use caput and caget to see variables. For example:
source /lbt/epics/setup.sh
caget lbc:side0:dewarTemp    (to see LBC dewar temp...doesn't work on binary vals....not sure why)
caput your_fav_var value     (to change the vars...works for all types)

28. Initialize channels that are only written periodically.
The IT channels are only written when a change occurs, so they need to be initialized when the IOC is restarted.
ssh telescope@obs3.mountain.lbto.org
setITChannels.sh 
The MODS instrument channels are only written every half an hour, so the script should be run when the IOC is restarted to get the values and initialize the channels.
ssh telescope@obs3.mountain.lbto.org
emailMODSErrors.sh
emailMODS2Errors.sh

Some helpful links....

-- %USERSIG{MicheleDeLaPena - 2015-07-10}%

This topic: Software > Software > ALH > AlarmHandlerBuildInstall64
Topic revision: 05 Feb 2020, MatthieuBec
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback