THIS PAGE IS OBSOLETE

Alarm Handler Build and Installation Procedures

Please note that these instructions only apply to the ALH GUI now -- the other EPICS applications are running on a 64-bit computer (see AlarmHandlerBuildInstall64).


The following notes provide details on how to build the base EPICS, the LBTO TCS and IT IOCs, and the EPICS alarm handler as user "lbtscm" on the build machine in Tucson (rm580h-1). 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 lbtscm@rm580h-1.tucson.lbto.org and do the following:
cd lbt32 (at this time - Oct 2014)
mkdir epicsv1.0 (1.0 is the current version number)
cd epicsv1.0  (/home/lbtscm/lbt32/epicsv1.0 is the <top>). 

Use "/home/lbtscm/lbt32/epicsv1.0" 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/lbtscm/lbt32/epicsv1.0"
   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="/home/telescope/TCS/Configuration/ALH/LBTALHConfigure"
   export ALARMHANDLER="${EPICS_LBT_ALH_CONFIGURE}"   (Note: This is an ALH defined environment variable.  May be deprecated for our use.)
   export PATH="${PATH}:${EPICS_BASE}/bin/${EPICS_HOST_ARCH}"
   export PATH="${PATH}:${EPICS_EXTENSIONS}/bin/${EPICS_HOST_ARCH}"
   export LD_LIBRARY_PATH="${EPICS_BASE}/lib/${EPICS_HOST_ARCH}":${EPICS_HOME}/lib/${EPICS_HOST_ARCH}"
   export EPICS_CA_AUTO_ADDR_LIST=NO
   export EPICS_CA_ADDR_LIST=localhost

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. cd .. (This should put you back in /base-3.14.12.4)

7. 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). 

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

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

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.

9. 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/makeBaseApp.pl -t example tcsioc              (This IOC is called "tcsioc".)
<top>/base-3.14.12.4/bin/linux-x86/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/makeBaseApp.pl -t example itioc              (This IOC is called "itioc".)
<top>/base-3.14.12.4/bin/linux-x86/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!

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

These files will be superseded in Step 11.

11. 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.
 
cd <top>
svn co https://svn.lbto.org/repos/alh/trunk

A checkout is done so that subsequent builds which may be done in this version can check for updates to any files. The LBTO-specific repository files are found in <top>/trunk.
 
cp <top>/trunk/itioc/it.cmd  <top>/iocBoot/itioc/.
cp <top>/trunk/tcsioc/tcs.cmd <top>/iocBoot/tcsioc/.
cp <top>/trunk/itiocApp/src/* <top>/itiocApp/src/.
cp <top>/trunk/tcsiocApp/src/* <top>/tcsiocApp/src/.

The first two commands will copy the it.cmd and tcs.cmd files which supersede the st.cmd file in the respective 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.

12. 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. Build the two LBTO IOCs: itioc and tcsioc. The source files and updated Makefile are in SVN (exported to the trunk directory). Additionally, you need DDS Ice files that are in SVN.

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.4.2/bin/slice2cpp DDSServer.ice
/lbt/tcs_runtime/Ice-3.4.2/bin/slice2cpp Factory.ice
gmake clean
gmake

13. Now make the itioc which reads its channel information from an ASCII text file, /var/log/zabbix/zabbix_alerts.log on TCS1.
cd <top>/itiocApp/src 
gmake clean
gmake

14. Copy the ancillary scripts into the <top> directory from the SVN checkout so these files can be packaged with the rest of the system:
cd <top>
cp trunk/setup.sh .
cp trunk/ALH .
cp trunk/epics-tcsioc.service .
cp trunk/epics-itioc.service .

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

16. Make a tar file of the LBT ALH configuration files.

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

17. Delete the trunk directory checked out from SVN.

cd <top>
rm -fr trunk

18. Create a tar of the entire build.

cd .. (This is one directory above <top>.)
tar cvpf EPICSALHV1_0.tar epicsv1.0

19. Logon to the mountain (or Tucson Test Cluster) as root and unpack the tar file.
ssh -X root@tcs1.mountain.lbto.org
pswd
cd /lbt
scp lbtscm@rm580h-1.tucson.lbto.org:/home/lbtscm/lbt32/EPICSALHV1_0.tar .
pswd
tar xvpf EPICSALHV1_0.tar    

An "epicsv1.0" directory will be created in /lbt.

20. The envPaths files must be modified; the "/home/lbtscm/lbt32" must be replaced with "/lbt". Edit the envPaths file in "/lbt/epicsv1.0/iocBoot/itioc" and in "/lbt/epicsv1.0/iocBoot/tcsioc".

21. The public EPICS/ALH configuration files must be put in the public directory which is currently "/home/telescope/TCS/Configuration/ALH".
su -l telescope
pwd
cd TCS/Configuration/ALH
cp /lbt/epicsv1.0/ALHConfigureDDMMM.tar .
tar xvpf ALHConfigureDDMMM.tar

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

22. Create an ALH link in /lbt/astronomy/bin.
Note: this used to be /lbt/developers - but currently on the mountain ALH is coming from /lbt/astronomy/bin, so this step is incorrect. Maybe other steps are also incorrect since the link on the mountain is from stow/alh-holder, not from /lbt/epicsv1.0 as noted here. Needs update.

cd /lbt/astronomy/bin
ln -s /lbt/epicsv1.0/ALH ALH

23. Finally, put the epics-itioc.service and epics-tcs.service in /etc/init.d as user telescope.

su -l telescope
pswd
cd /etc/init.d
cp /lbt/epicsv1.0/epics*service .

24. 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 telescope, type
/etc/init.d/epics-tcsioc.service start
/etc/inid.d/epics-itioc.service start

The IOCs can be started manually in the following way as user telescope:
cd /lbt/epicsv1.0
source ./setup.sh
cd iocBoot/itioc
./it.cmd &
cd /lbt/epicsv1.0/iocBoot/tcsioc
./tcs.cmd &

Note: The IOCs write information to SYSLOG (local 6) which is also written to stdout.

25. Execution - In another window, run the alarm handler as any user just by typing, ALH. Unless you are the telescope operator, you should not run the ALH as user telescope. User telescope writes the log files for the ALH and has permission to acknowledge alarms. All other users do not write to the log files and do not have 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 IOC.

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

26. 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)

Some helpful links....

Dump of the Session and Doug's README

The following dump is just for reference - Doug's initial build was also 64-bit, so it does not completely apply. When we no longer need it, it can be deleted.

cp ~ksummers/epics/setup.sh .
 vi setup.sh
 ll
 tar xvfz ~ksummers/Install/baseR3.14.12.4.tar.gz
 ln -s base-3.14.12.4/ base
 ll
 source setup.sh
 cd base
 gmake
 cd ..
 ll
 tar xvfz ~ksummers/Install/extensionsTop_20120904.tar.gz
 cd extensions/
 gmake
 cd ..
 ll
 cd extensions/
 ll
 cd src
 ll
 tar xvfz ~ksummers/Install/alh1_2_33.tar.gz
 cd alh1_2_33/
 gmake
 cd ../..
 ll
 cd ..
 ll
 mkdir iocboot
 mv iocboot iocBoot
 cd iocBoot
 ../base/bin/linux-x86/makeBaseApp.pl -t example iocalarm
after this command, I had a configure directory and an iocalarmApp directory in iocBoot directory

[lbtscm@rm580f-1 iocBoot]$ ../base/bin/linux-x86/makeBaseApp.pl -i -t example iocalarm
Using target architecture linux-x86 (only one available)
The following applications are available:
    iocalarm
What application should the IOC(s) boot?
The default uses the IOC's name, even if not listed above.
Application name?
[lbtscm@rm580f-1 iocBoot]$ ll
total 20
drwxrwxr-x+ 2 lbtscm domain users 4096 Jun  6 16:30 configure
drwxrwxr-x+ 4 lbtscm domain users   40 Jun  6 16:30 iocalarmApp
drwxrwxr-x+ 3 lbtscm domain users   36 Jun  6 16:30 iocBoot
-rw-rw-r--+ 1 lbtscm domain users  467 Jun  6 16:30 Makefile

gmake

.....
View.o axArea.o axRunW.o axSubW.o browser.o current.o dialog.o file.o force.o guidance.o ...
 showmask.o sllLib.o beepSevr.o noAck.o    -lca -lCom -lXmu -lXm -lXt -lX11   
gmake[1]: Leaving directory `/lbt/epics/extensions/src/alh1_2_33/O.linux-x86'
[lbtscm@rm580f-1 alh1_2_33]$ cd ../..
[lbtscm@rm580f-1 extensions]$ ll
total 28
drwxrwxr-x+ 3 lbtscm domain users   22 Jun  6 16:28 bin
drwxr-xr-x+ 5 lbtscm domain users 4096 Jun  6 16:27 configure
-rw-r--r--+ 1 lbtscm domain users  156 Jun 22  2007 Makefile
-rw-r--r--+ 1 lbtscm domain users 7141 Sep  4  2012 README
drwxr-xr-x+ 3 lbtscm domain users   37 Jun  6 16:28 src
[lbtscm@rm580f-1 extensions]$ cd ..

[lbtscm@rm580f-1 epics]$ ll
total 20
lrwxrwxrwx.  1 lbtscm domain users   15 Jun  6 16:26 base -&gt; base-3.14.12.4/
drwxr-xr-x+ 14 lbtscm domain users 4096 Jun  6 16:26 base-3.14.12.4
drwxr-xr-x+  5 lbtscm domain users   70 Jun  6 16:28 extensions
-rw-rw-r--+  1 lbtscm domain users  625 Jun  6 16:25 setup.sh

[lbtscm@rm580f-1 epics]$ /lbt/epics/base/bin/linux-x86/makeBaseApp.pl -t example alarm
[lbtscm@rm580f-1 epics]$ ls -al
total 40
drwxrwxr-x+  6 lbtscm domain users  116 Jun  9 07:49 .
drwxr-xr-x. 34 lbtscm root         4096 Jun  9 07:48 ..
drwxrwxr-x+  4 lbtscm domain users   40 Jun  9 07:49 alarmApp
lrwxrwxrwx.  1 lbtscm domain users   15 Jun  6 16:26 base -&gt; base-3.14.12.4/
drwxr-xr-x+ 14 lbtscm domain users 4096 Jun  6 16:26 base-3.14.12.4
drwxrwxr-x+  2 lbtscm domain users 4096 Jun  9 07:49 configure
drwxr-xr-x+  5 lbtscm domain users   70 Jun  6 16:28 extensions
-rw-rw-r--+  1 lbtscm domain users  467 Jun  9 07:49 Makefile
-rw-rw-r--+  1 lbtscm domain users  625 Jun  6 16:25 setup.sh
[lbtscm@rm580f-1 epics]$ /lbt/epics/base/bin/linux-x86/makeBaseApp.pl -i -t example alarm
Using target architecture linux-x86 (only one available)
The following applications are available:
    alarm
What application should the IOC(s) boot?
The default uses the IOC's name, even if not listed above.
Application name?

[lbtscm@rm580f-1 epics]$ ls -al
total 48
drwxrwxr-x+  7 lbtscm domain users 4096 Jun  9 07:49 .
drwxr-xr-x. 34 lbtscm root         4096 Jun  9 07:48 ..
drwxrwxr-x+  4 lbtscm domain users   40 Jun  9 07:49 alarmApp
lrwxrwxrwx.  1 lbtscm domain users   15 Jun  6 16:26 base -&gt; base-3.14.12.4/
drwxr-xr-x+ 14 lbtscm domain users 4096 Jun  6 16:26 base-3.14.12.4
drwxrwxr-x+  2 lbtscm domain users 4096 Jun  9 07:49 configure
drwxr-xr-x+  5 lbtscm domain users   70 Jun  6 16:28 extensions
drwxrwxr-x+  3 lbtscm domain users   39 Jun  9 07:49 iocBoot
-rw-rw-r--+  1 lbtscm domain users  467 Jun  9 07:49 Makefile
-rw-rw-r--+  1 lbtscm domain users  625 Jun  6 16:25 setup.sh
[lbtscm@rm580f-1 epics]$ gmake
gmake -C ./configure install
.....
mkdir ../../../bin
mkdir ../../../bin/linux-x86
gmake[3]: Leaving directory `/lbt/epics/alarmApp/src/O.linux-x86'
gmake[2]: Leaving directory `/lbt/epics/alarmApp/src'
gmake[1]: Leaving directory `/lbt/epics/alarmApp'
gmake -C ./iocBoot install
gmake[1]: Entering directory `/lbt/epics/iocBoot'
gmake -C ./iocalarmApp install
gmake[2]: Entering directory `/lbt/epics/iocBoot/iocalarmApp'
perl /lbt/epics/base/bin/linux-x86/convertRelease.pl -a linux-x86 -t /lbt/epics envPaths
gmake[2]: Leaving directory `/lbt/epics/iocBoot/iocalarmApp'
gmake[1]: Leaving directory `/lbt/epics/iocBoot'

[lbtscm@rm580f-1 epics]$ cd iocBoot
[lbtscm@rm580f-1 iocBoot]$ ll
total 8
drwxrwxr-x+ 2 lbtscm domain users  62 Jun  9 08:01 iocalarm
-rw-rw-r--+ 1 lbtscm domain users 121 Jun  9 07:51 Makefile
[lbtscm@rm580f-1 iocBoot]$ cd iocalarm
[lbtscm@rm580f-1 iocalarm]$ ll
total 16
-rw-rw-r--+ 1 lbtscm domain users 138 Jun  9 08:01 envPaths
-rw-rw-r--+ 1 lbtscm domain users 115 Jun  9 07:51 Makefile
-rw-rw-r--+ 1 lbtscm domain users 369 Jun  9 07:51 README
-rw-rw-r--+ 1 lbtscm domain users 588 Jun  9 07:51 st.cmd
[lbtscm@rm580f-1 iocalarm]$ chmod +x st.cmd

README:

I created the epics environment by the following basic recipe:
        I created a "<top>" directory called epics (used below).
        I downloaded/expanded tarballs for base, extensions, and alh.
           (note: download 32 bit or 64 bit as per your target architecture).
        I set environment vars in all my terminal sessions (builds and runtime).
        I did the source builds (base, extensions, alh, and an example ioc).
           (note:  ioc name can be anything...below it's called "your_ioc").
        I altered the resulting ioc build to load a modified db (our example).
        I altered the default alarm handler config file (for our example).
        I altered the ioc st.cmd startup script (to load our example db).
        I created an ioc init.cmd script (to init our example db vars).
        I then launched alh and played with caput to change vars and see effects.

Details:

Download tarballs:
    EPICS base:
        (http://www.aps.anl.gov/epics/extensions/configure/index.php):
        - baseR3.14.12.4.tar.gz  (do not use 3.15...not production ready)
    Extensions:
        http://www.aps.anl.gov/epics/extensions/index.php
        - extensionsTop_20120904.tar.gz
    Alarm Handler:
        http://www.aps.anl.gov/epics/extensions/alh/index.php
        - alh1_2_33.tar.gz

Environment vars:
   Builds and runtime need env vars.   I used the following (change
   home to your top level area. It's probably best to set these vars
   in a script or .bashrc but cut/paste in terminal sessions works too.)

   export HOME="/home/dsummers"
   export EPICS_BASE="${HOME}/src/epics/base-3.14.12.4"
   export EPICS_EXTENSIONS="${HOME}/src/epics/extensions"
   export EPICS_HOST_ARCH=`${EPICS_BASE}/startup/EpicsHostArch`
   export PATH="${PATH}:${EPICS_BASE}/bin/${EPICS_HOST_ARCH}"
   export PATH="${PATH}:${EPICS_EXTENSIONS}/bin/${EPICS_HOST_ARCH}"
   export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${EPICS_BASE}/lib/${EPICS_HOST_ARCH}"
   export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${EPICS_EXTENSIONS}/lib/${EPICS_HOST_ARCH}"
   export EPICS_CA_AUTO_ADDR_LIST=NO
   export EPICS_CA_ADDR_LIST=localhost

Build epics base: (http://www.aps.anl.gov/epics/base/R3-14/12-docs/README.html#0_0_8)
(in my case, I made an epics dir, and then made a base-3.14.12.4 dir, but base and
a symlink to base-3.14.12.4 would probably have been better...for when 3-15 becomes stable).
        - mkdir <top>
        - gunzip baseR3.14.14.4.tar.gz
        - tar xvf baseR3.14.12.4.tar
        - cd baseR3.14.12.4
        - gmake

Build epics extensions (in 2 parts).  
   first, the base structure for extensions:
        - cd <top>
        - gunzip extensionsTop_20120904.tar.gz
        - tar xvf extensionsTop_20120904.tar
        - cd extensions
        - gmake
   next, build the alarm handler
        - cd ./src (extensions/src dir)
        - cp -p alh1_2_33.tar.gz .
        - gunzip alh1_2_33.tar.gz
        - tar xvf alh1_2_33.tar
        - cd alh1_2_33
        - gmake
        - alh executable lives <top>/extensions/bin/linux-x86_64 (alh)

Build IOC
        - cd <top>
        - mkdir &lt;your_ioc&gt;
        - <top>/base-3.14.12.4/bin/linux-x86_64/makeBaseApp.pl -t example your_ioc
        - <top>/base-3.14.12.4/bin/linux-x86_64/makeBaseApp.pl -i -t example your_ioc
        - gmake
        - cd iocBoot;
        - chmod +x st.cmd
     Be careful after having made the IOC.  If you make again after altering the base build,
     you'll blow away any subsequent modifications you've made!  (I learned this the hard way).

You'll need some LBTO specific files.  I've created a very simple example:
        - <top>/your_ioc/db/tcs.db                                      (epics db definition for alarm vars)
        - <top>/your_ioc/iocBoot/your_ioc/init.cmd                      (vars init for the example db)
        - <top>/your_ioc/iocBoot/your_ioc/st.cmd                        (orig file modified to load the tcs.db)
        - <top>/extensions/bin/linux-x86_64/ALH-default.alhConfig       (alarm handler config file for example)

To run ioc (remember to load the EPICS environment vars first!):
        <top>/your_ioc/iocBoot/your_ioc/st.cmd
        <top>/your_ioc/iocBoot/your_ioc/init.cmd
        (optional...but helpful for exploration & setting/clearing vars)
           caput your_fav_var value     (to change the vars...works for all types)
           caget your_fav_var           (to see analog vals...doesn't work on binary vals....not sure why)

To run alh (and where the ALH-default.alhConfig file lives):
        <top>/extensions/bin/linux-x86_64/alh

dms - 4/9/2014


Topic revision: r23 - 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