- IOC Deployment and Troubleshooting
- 4 Deploy the motorVMC (Virtual Motor Controller) module
- 4.1 Clone motorVMC
- 4.2 Confirm directories exist
- 4.3 Build motorVMC (Attempt #1)
- 4.4 Resolve build error #1
- 4.5 Build motorVMC (Attempt #2)
- 4.6 Resolve build error #2
- 4.7 Build motorVMC
- 4.8 Confirm build products exist
- 5 Add virtual motors to the IOC
IOC Deployment and Troubleshooting
4 Deploy the motorVMC (Virtual Motor Controller) module
A Virtual Motor Controller (VMC) has a number of advantages over simulated motors for EPICS trainings:
- It isn't included in xxx-based IOCs by default (motorVMC is not included in the motor module)
- The Virtual Motor Controller can be started/stopped independently of the IOC
- The IOC talks to the Virtual Motor Controller via ethernet
4.1 Clone motorVMC
$ cd ${SUPPORT_DIR}
$ git clone https://git.aps.anl.gov/practical_beamline_controls_training/session_2/motorVMC.git
output
Cloning into 'motorVMC'...
remote: Enumerating objects: 69, done.
remote: Counting objects: 100% (69/69), done.
remote: Compressing objects: 100% (58/58), done.
remote: Total 69 (delta 7), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (69/69), 27.55 KiB | 972.00 KiB/s, done.
Resolving deltas: 100% (7/7), done.
4.2 Confirm directories exist
$ cd motorVMC
$ tree -d .
output
.
├── configure
├── iocs
│ └── vmcIOC
│ ├── configure
│ ├── iocBoot
│ │ └── iocvmc
│ └── vmcApp
│ ├── Db
│ └── src
├── python
└── vmcApp
├── Db
└── src
13 directories
4.3 Build motorVMC (Attempt #1)
$ make
output
configure/RULES_TOP:2: /configure/RULES_TOP: No such file or directory
make: *** No rule to make target '/configure/RULES_TOP'. Stop.
4.4 Resolve build error #1
This build error occurs for the same reason the build error occurred in step 2.4: EPICS_BASE
isn't defined.
The error was much more helpful in step 2.4 because xxx's CONFIG file prints the user friendly error message. The motorVMC developer should add a similar check to the motorVMC module.
hint
The motorVMC/configure/RELEASE file doesn't contain any definitions, but it does include other files if they exist.
solution
$ cp -p configure/EXAMPLE_RELEASE.local configure/RELEASE.local
The RELEASE.local file contains two variables that need be defined: MOTOR
and MOTOR_VMC
MOTOR
should be set to the same path that is in the envPaths file:
$ grep MOTOR ${IOC_DIR}/xxx/iocBoot/iocxxx/envPaths
epicsEnvSet("MOTOR","/APSshare/epics/synApps_6_2_1/support/motor-R7-2-2")
epicsEnvSet("MOTOR_ACSMOTION","/APSshare/epics/synApps_6_2_1/support/motorAcsMotion-R2-0-bugfix")
MOTOR_VMC
should be set to the present working directory
$ pwd
/home/beams/USERNAME/PET-S2/epics/synApps/support/motorVMC
The result should look like this:
$ cat configure/RELEASE.local
MOTOR=/APSshare/epics/synApps_6_2_1/support/motor-R7-2-2
-include $(MOTOR)/modules/RELEASE.$(EPICS_HOST_ARCH).local
# path to motorVMC is needed to build the IOC inside motorVMC, but outside motor
MOTOR_VMC=/home/beams/USERNAME/PET-S2/epics/synApps/support/motorVMC
4.5 Build motorVMC (Attempt #2)
If the following build succeeds, proceed to step 4.8.
$ make
output
make -C ./configure install
make[1]: Entering directory '/home/beams/USERNAME/PET-S2/epics/synApps/support/motorVMC/configure'
perl -CSD /APSshare/epics/base-7.0.4.1/bin/rhel8-x86_64/makeMakefile.pl O.rhel8-x86_64 ../..
mkdir -p O.Common
make -C O.rhel8-x86_64 -f ../Makefile TOP=../.. \
T_A=rhel8-x86_64 install
make[2]: Entering directory '/home/beams/USERNAME/PET-S2/epics/synApps/support/motorVMC/configure/O.rhel8-x86_64'
perl -CSD /APSshare/epics/base-7.0.4.1/bin/rhel8-x86_64/convertRelease.pl checkRelease
Definition of MOTOR conflicts with SUPPORT support.
In this application or module, a RELEASE file
conflicts with SUPPORT at /APSshare/epics/synApps_6_2_1/support
Here: MOTOR = /net/aquila/export/APSmaster/gateway/epics/synApps_6_2_1/support/motor-R7-2-2
SUPPORT: MOTOR = /APSshare/epics/synApps_6_2_1/support/motor-R7-2-2
make[2]: *** [/APSshare/epics/base-7.0.4.1/configure/RULES_BUILD:190: checkRelease] Error 1
make[2]: Leaving directory '/home/beams/USERNAME/PET-S2/epics/synApps/support/motorVMC/configure/O.rhel8-x86_64'
make[1]: *** [/APSshare/epics/base-7.0.4.1/configure/RULES_ARCHS:58: install.rhel8-x86_64] Error 2
make[1]: Leaving directory '/home/beams/USERNAME/PET-S2/epics/synApps/support/motorVMC/configure'
make: *** [/APSshare/epics/base-7.0.4.1/configure/RULES_DIRS:85: configure.install] Error 2
Note: this build error occurs when there is a mismatch (hard mount vs soft link) between the /APSshare mount on the computer that built the support on /APSshare and the computer building the IOC. The two MOTOR
paths actually point to the same directory.
4.6 Resolve build error #2
The configure/CONFIG_SITE is where the checkRelease behavior is defined. The CHECK_RELEASE
variable can be overridden to ignore this error.
hint
$ grep RELEASE configure/CONFIG_SITE
# CHECK_RELEASE controls the consistency checking of the support
# applications pointed to by the RELEASE* files.
# Normally CHECK_RELEASE should be set to YES.
# Set CHECK_RELEASE to NO to disable checking completely.
# Set CHECK_RELEASE to WARN to perform consistency checking but
CHECK_RELEASE = YES
$ tail -n 6 configure/CONFIG_SITE
# These allow developers to override the CONFIG_SITE variable
# settings without having to modify the configure/CONFIG_SITE
# file itself.
-include $(TOP)/../CONFIG_SITE.local
-include $(TOP)/configure/CONFIG_SITE.local
solution
$ echo "CHECK_RELEASE = NO" > configure/CONFIG_SITE.local
4.7 Build motorVMC
$ make
output
make -C ./configure install
make[1]: Entering directory '/home/beams/USERNAME/PET-S2/epics/synApps_6_2_1/support/motorVMC/configure'
perl -CSD /APSshare/epics/base-7.0.4.1/bin/rhel8-x86_64/makeMakefile.pl O.rhel8-x86_64 ../..
mkdir -p O.Common
make -C O.rhel8-x86_64 -f ../Makefile TOP=../.. \
T_A=rhel8-x86_64 install
make[2]: Entering directory '/home/beams/USERNAME/PET-S2/epics/synApps_6_2_1/support/motorVMC/configure/O.rhel8-x86_64'
Warning: RELEASE file consistency checks have been disabled
make[2]: Nothing to be done for 'install'.
make[2]: Leaving directory '/home/beams/USERNAME/PET-S2/epics/synApps_6_2_1/support/motorVMC/configure/O.rhel8-x86_64'
make[1]: Leaving directory '/home/beams/USERNAME/PET-S2/epics/synApps_6_2_1/support/motorVMC/configure'
make -C ./vmcApp install
make[1]: Entering directory '/home/beams/USERNAME/PET-S2/epics/synApps_6_2_1/support/motorVMC/vmcApp'
make -C ./src install
make[2]: Entering directory '/home/beams/USERNAME/PET-S2/epics/synApps_6_2_1/support/motorVMC/vmcApp/src'
perl -CSD /APSshare/epics/base-7.0.4.1/bin/rhel8-x86_64/makeMakefile.pl O.rhel8-x86_64 ../../..
mkdir -p O.Common
make -C O.rhel8-x86_64 -f ../Makefile TOP=../../.. \
T_A=rhel8-x86_64 install
make[3]: Entering directory '/home/beams/USERNAME/PET-S2/epics/synApps_6_2_1/support/motorVMC/vmcApp/src/O.rhel8-x86_64'
/usr/bin/g++ -D_GNU_SOURCE -D_DEFAULT_SOURCE -D_X86_64_ -DUNIX -Dlinux -O3 -Wall -mtune=generic -m64 -fPIC -I. -I../O.Common -I. -I. -I.. -I../../../include/compiler/gcc -I../../../include/os/Linux -I../../../include -I/net/aquila/export/APSmaster/gateway/epics/synApps_6_2_1/support/motor-R7-2-2/include -I/APSshare/epics/synApps_6_2_1/support/asyn-R4-42/include -I/APSshare/epics/synApps_6_2_1/support/seq-2-2-9/include -I/APSshare/epics/synApps_6_2_1/support/busy-R1-7-3/include -I/APSshare/epics/synApps_6_2_1/support/ipac-2-16/include -I/APSshare/epics/synApps_6_2_1/support/lua-R3-0-2/include -I/APSshare/epics/base-7.0.4.1/include/compiler/gcc -I/APSshare/epics/base-7.0.4.1/include/os/Linux -I/APSshare/epics/base-7.0.4.1/include -MM -MF vmcDriver.d ../vmcDriver.cpp
Creating dbd file vmcSupport.dbd
perl -CSD /APSshare/epics/base-7.0.4.1/bin/rhel8-x86_64/dbdExpand.pl -I. -I.. -I../O.Common -I../../../dbd -I/net/aquila/export/APSmaster/gateway/epics/synApps_6_2_1/support/motor-R7-2-2/dbd -I/APSshare/epics/synApps_6_2_1/support/asyn-R4-42/dbd -I/APSshare/epics/synApps_6_2_1/support/seq-2-2-9/dbd -I/APSshare/epics/synApps_6_2_1/support/busy-R1-7-3/dbd -I/APSshare/epics/synApps_6_2_1/support/ipac-2-16/dbd -I/APSshare/epics/synApps_6_2_1/support/lua-R3-0-2/dbd -I/APSshare/epics/base-7.0.4.1/dbd -o vmcSupport.dbd vmc.dbd
Installing created dbd file ../../../dbd/vmcSupport.dbd
mkdir ../../../dbd
/usr/bin/g++ -D_GNU_SOURCE -D_DEFAULT_SOURCE -D_X86_64_ -DUNIX -Dlinux -O3 -Wall -mtune=generic -m64 -fPIC -I. -I../O.Common -I. -I. -I.. -I../../../include/compiler/gcc -I../../../include/os/Linux -I../../../include -I/net/aquila/export/APSmaster/gateway/epics/synApps_6_2_1/support/motor-R7-2-2/include -I/APSshare/epics/synApps_6_2_1/support/asyn-R4-42/include -I/APSshare/epics/synApps_6_2_1/support/seq-2-2-9/include -I/APSshare/epics/synApps_6_2_1/support/busy-R1-7-3/include -I/APSshare/epics/synApps_6_2_1/support/ipac-2-16/include -I/APSshare/epics/synApps_6_2_1/support/lua-R3-0-2/include -I/APSshare/epics/base-7.0.4.1/include/compiler/gcc -I/APSshare/epics/base-7.0.4.1/include/os/Linux -I/APSshare/epics/base-7.0.4.1/include -c ../vmcDriver.cpp
../vmcDriver.cpp: In constructor ‘VirtualMotorController::VirtualMotorController(const char*, const char*, int, double, double)’:
../vmcDriver.cpp:52:21: warning: variable ‘pAxis’ set but not used [-Wunused-but-set-variable]
VirtualMotorAxis *pAxis;
^~~~~
../vmcDriver.cpp: In function ‘int VirtualMotorCreateController(const char*, const char*, int, int, int)’:
../vmcDriver.cpp:88:27: warning: variable ‘pVirtualMotorController’ set but not used [-Wunused-but-set-variable]
VirtualMotorController *pVirtualMotorController
^~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ar -rc libvmc.a vmcDriver.o
/usr/bin/ranlib libvmc.a
/usr/bin/g++ -o libvmc.so -shared -fPIC -Wl,-hlibvmc.so -L/home/beams/USERNAME/PET-S2/epics/synApps_6_2_1/support/motorVMC/lib/rhel8-x86_64 -L/net/s100dserv/APSshare/epics/base-7.0.4.1/lib/rhel8-x86_64 -L/net/s100dserv/APSshare/epics/synApps_6_2_1/support/asyn-R4-42/lib/rhel8-x86_64 -L/net/aquila/export/APSmaster/gateway/epics/synApps_6_2_1/support/motor-R7-2-2/lib/rhel8-x86_64 -L/APSshare/epics/base-7.0.4.1/lib/rhel8-x86_64 -Wl,-rpath,/home/beams/USERNAME/PET-S2/epics/synApps_6_2_1/support/motorVMC/lib/rhel8-x86_64 -Wl,-rpath,/net/s100dserv/APSshare/epics/base-7.0.4.1/lib/rhel8-x86_64 -Wl,-rpath,/net/s100dserv/APSshare/epics/synApps_6_2_1/support/asyn-R4-42/lib/rhel8-x86_64 -Wl,-rpath,/net/aquila/export/APSmaster/gateway/epics/synApps_6_2_1/support/motor-R7-2-2/lib/rhel8-x86_64 -Wl,-rpath,/APSshare/epics/base-7.0.4.1/lib/rhel8-x86_64 -rdynamic -m64 vmcDriver.o -lmotor -lasyn -ldbRecStd -ldbCore -lca -lCom -lpthread -lreadline -lm -lrt -ldl -lgcc
Installing shared library ../../../lib/rhel8-x86_64/libvmc.so
Installing library ../../../lib/rhel8-x86_64/libvmc.a
make[3]: Leaving directory '/home/beams/USERNAME/PET-S2/epics/synApps_6_2_1/support/motorVMC/vmcApp/src/O.rhel8-x86_64'
make[2]: Leaving directory '/home/beams/USERNAME/PET-S2/epics/synApps_6_2_1/support/motorVMC/vmcApp/src'
make -C ./Db install
make[2]: Entering directory '/home/beams/USERNAME/PET-S2/epics/synApps_6_2_1/support/motorVMC/vmcApp/Db'
perl -CSD /APSshare/epics/base-7.0.4.1/bin/rhel8-x86_64/makeMakefile.pl O.rhel8-x86_64 ../../..
mkdir -p O.Common
make -C O.rhel8-x86_64 -f ../Makefile TOP=../../.. \
T_A=rhel8-x86_64 install
make[3]: Entering directory '/home/beams/USERNAME/PET-S2/epics/synApps_6_2_1/support/motorVMC/vmcApp/Db/O.rhel8-x86_64'
make[3]: Nothing to be done for 'install'.
make[3]: Leaving directory '/home/beams/USERNAME/PET-S2/epics/synApps_6_2_1/support/motorVMC/vmcApp/Db/O.rhel8-x86_64'
make[2]: Leaving directory '/home/beams/USERNAME/PET-S2/epics/synApps_6_2_1/support/motorVMC/vmcApp/Db'
make[1]: Leaving directory '/home/beams/USERNAME/PET-S2/epics/synApps_6_2_1/support/motorVMC/vmcApp'
4.8 Confirm build products exist
When the build is successful there should be a database definitions file (.dbd) in the top level dbd dir, as well as a static library (.a) and a dynamic library (.so) in the arch-specific lib dir.
$ ls -l dbd lib/${EPICS_HOST_ARCH}
output
dbd:
total 0
-r--r--r-- 1 username group 32 Feb 2 15:44 vmcSupport.dbd
lib/rhel8-x86_64:
total 92
-r--r--r-- 1 username group 34518 Feb 2 15:44 libvmc.a
-r-xr-xr-x 1 username group 47696 Feb 2 15:44 libvmc.so*