Build AreaDetector for EPICS from source


This will be a long post, but by the end of it you should have a working installation of AreaDetector ready to use with your EPICS projects.  Since this post follows on from my previous how-to, I will be using Linux Mint 18.2 and EPICS 15.5.

Dependencies

Before building and using AreaDetector, its dependencies have to be installed.

System Libraries

A bunch of libraries need to be installed via apt.  There are probably a lot more dependencies that aren’t listed here, but that already come with Linux Mint.

sudo apt install re2c xml2 libxml2 git zlib1g-dev libnetcdf-devlibxml2-dev

EPICS dependencies

The following synApps modules need to be installed prior to installation of AreaDetector.  In several cases, the modules depend on the existence of some other modules on the system, so it is important to install the modules in the following order.
  1. autosave
  2. busy
  3. seq
  4. sscan
  5. calc

Get the source

cd ~/Downloads
wget https://github.com/epics-modules/autosave/archive/R5-7-1.tar.gz
mv R5-7-1.tar.gz autosave-R5-7-1.tar.gz
wget https://www3.aps.anl.gov/bcda/synApps/tar/busy_R1-6-1.tar.gz
wget http://www-csr.bessy.de/control/SoftDist/sequencer/releases/seq-2.2.5.tar.gz
wget https://github.com/epics-modules/calc/archive/R3-6-1.tar.gz
mv R3-6-1.tar.gz calc-R3-6-1.tar.gz
wget https://www3.aps.anl.gov/bcda/synApps/tar/sscan_R2-10.tar.gz

Expand the source files.

tar -zxvf ~/Downloads/autosave-R5-7-1.tar.gz -C ~/Apps/epics/modules/
tar -zxvf ~/Downloads/busy_R1-6-1.tar.gz -C ~/Apps/epics/modules/
tar -zxvf ~/Downloads/seq-2.2.5.tar.gz -C ~/Apps/epics/modules/
tar -zxvf ~/Downloads/sscan_R2-10.tar.gz -C ~/Apps/epics/modules/
tar -zxvf ~/Downloads/calc-R3-6-1.tar.gz -C ~/Apps/epics/modules/
Create some links to make life easier for us.
cd ~/Apps/epics/modules
ln -s autosave-R5-7-1 autosave
ln -s busy-1-6-1 busy
ln -s seq-2.2.5 set
ln -s sscan-2-10 scan
ln -s calc-R3-6-1 calc
Now start compiling the source.  In each case we will have to alter a configuration file for each of the packages before compiling, and in each case this is the file “configure/RELEASE”.
For each of the packages, we will change to the top-level directory for that package, alter the configure/RELEASE file appropriately, and then run “make”.  Make sure to run “make” from the package’s top-level directory in all cases.

Autosave

cd ~/Apps/epics/modules/autosave
Edit configure/RELEASE to give the location of EPICS_BASE as /usr/local/epics/base.
make

Busy

cd ~/Apps/epics/modules/busy
Edit configure/RELEASE to fix SUPPORT (to /home/smolloy/Apps/epics/modules) and EPICS_BASE (to /usr/local/epics/base).  In the same file, change the reference to asyn-4-17 to asyn (the softlink we made earlier).
make

Seq

cd ~/Apps/epics/modules/seq
Edit configure/RELEASE to fix the location of EPICS_BASE (to /usr/local/epics/base).
make

Sscan

cd ~/Apps/epics/modules/sscan
Edit configure/RELEASE and fix SUPPORT (to /home/smolloy/Apps/epics/modules) and EPICS_BASE (to /usr/local/epics/base).  Change the seq-2-2-0-2 reference to seq.
make

Calc

cd ~/Apps/epics/modules/calc
Edit configure/RELEASE and fix SUPPORT (as before), SSCAN, SNCSEQ, and EPICS_BASE (as before).  Alter the sscan and seq references to point at the softlinks we created earlier (that is, remove the version numbers).
make

Install AreaDetector

We’ll get the AreaDetector source from Github.  Note that this is a recursive fetch, and downloads ~1.1 GB of data.

cd ~/Apps/epics/modules
git clone --recursive https://github.com/areaDetector/areaDetector.git

Configure the installation

cd ~/Apps/epics/modules/areaDetector/configure
cp EXAMPLE_RELEASE.local       RELEASE.local
cp EXAMPLE_RELEASE_PATHS.local RELEASE_PATHS.local
cp EXAMPLE_RELEASE_LIBS.local  RELEASE_LIBS.local
cp EXAMPLE_RELEASE_PRODS.local RELEASE_PRODS.local
cp EXAMPLE_CONFIG_SITE.local   CONFIG_SITE.local
We have to edit three of these files.

RELEASE_PATHS.local

Fix SUPPORT and EPICS_BASE as before, and change the AREA_DETECTOR variable as before (remove the version number).

RELEASE_LIBS.local

Alter the ASYN line to remove the version number.

RELEASE_PRODS.local

Alter the references to autosave, busy, calc, sncseq, and sscan to (as usual) remove the version numbers.

Comment out the deviostats line.

CONFIG_SITE.local

Change the WITH_EPICS_V4 line to WITH_EPICS_V4 = NO

Build

cd ~/Apps/epics/modules/areaDetector/
make

Test the installation

Assuming that your system is set up properly to use EPICS — that is, it has the right environment variables set, a working EPICS installation, etc. — then you should be able to compile and run the AreaDetector simulation IOC.

cd ~/Apps/epics/modules/areaDetector/ADSimDetector/
make
cd iocs/simDetectorIOC/iocBoot/iocSimDetector/

Now alter ADCore.

cd ~/Apps/epics/modules/areaDetector/ADCore/iocBoot
cp EXAMPLE_commonPlugins.cmd commonPlugins.cmd
cp EXAMPLE_commonPlugin_settings.req commonPlugin_settings.req
cd ~/Apps/epics/modules/areaDetector/ADSimDetector/iocs/simDetectorIOC/iocBoot/iocSimDetector/

Edit the file start_epics to remove the “.linux” from the st.cmd filename.  Then run the IOC.

./start_epics

Hopefully this works, and you’re now serving EPICS PV’s.

Congratulations!

Leave a comment