EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Problems with ioc app building with asyn
From: Mark Rivers via Tech-talk <[email protected]>
To: 黄佳伟 <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Tue, 16 Jul 2019 03:03:10 +0000
You need to run gdb on the resulting core file and use the backtrace command to see where it is crashing.

Mark


Sent from my iPhone

On Jul 15, 2019, at 10:35 PM, 黄佳伟 <[email protected]<mailto:[email protected]>> wrote:

Hi,
    I meet another problem. When I try to set parameters' value in constructor, the code can be compiled but segmentation fault (core dumped) is raised when running.

    Here is part of my source code:

asynTest::asynTest(const char *portName)
    : asynPortDriver(portName,
                     1, // maxAddr
                     asynInt32Mask | asynFloat64Mask | asynDrvUserMask, //Interface mask
                     asynInt32Mask | asynFloat64Mask, // Interrupt mask
                     0, // block and multi-device flags
                     1, // Autoconnect
                     0, // Default priority
                     0) // Default stack size
{
    createParam(P_Int32String, asynParamInt32, &P_Int32);
    createParam(P_Float64String, asynParamFloat64, &P_Float64);

    setIntegerParam(P_Int32, 1);
    setDoubleParam(P_Float64, 2.0);
}

    Here is the error message when i run `st.cmd`:

#!../../bin/linux-x86_64/asynTest
< envPaths
epicsEnvSet("IOC","iocasynTest")
epicsEnvSet("TOP","/home/jasper/asynTest")
epicsEnvSet("EPICS_BASE","/home/jasper/EPICS/epics-base")
epicsEnvSet("ASYN","/home/jasper/EPICS/synApps/support/asyn-R4-33")
cd "/home/jasper/asynTest"
## Register all support components
dbLoadDatabase "dbd/asynTest.dbd"
asynTest_registerRecordDeviceDriver pdbbase
testAsynConfigure("testASYN")
## Load record instances
dbLoadRecords("db/asynTest.db","P=asynTest:,R=TEST:,PORT=testASYN,ADDR=0")
cd "/home/jasper/asynTest/iocBoot/iocasynTest"
iocInit
Starting iocInit
############################################################################
## EPICS R3.16.2-DEV
## EPICS Base built Dec 27 2018
############################################################################
iocRun: All initialization complete
## Start any sequence programs
#seq sncxxx,"user=jasper"
[1]    13376 segmentation fault (core dumped)  ./st.cmd

Thanks,
Jiawei Huang
On 7/15/2019 20:09,Mark Rivers<[email protected]><mailto:[email protected]> wrote:
Hi,


asynTest_registerRecordDeviceDriver.o: In function `asynTest_registerRecordDeviceDriver':
/home/jasper/asynTest/asynTestApp/src/O.linux-x86_64/asynTest_registerRecordDeviceDriver.cpp:350: undefined reference to `pvar_func_testAsynConfigure'

The undefined symbol should be defined is an epicsExportRegisterRecordDeviceDriver statement like this one from testAsynPortDriver:

epicsExportRegistrar(testAsynPortDriverRegister);

That produces this symbol in libtestAsynPortDriverSupport.a

corvette:asyn/testAsynPortDriverApp/src>nm ../../lib/linux-x86_64/libtestAsynPortDriverSupport.a | grep pvar
0000000000000000 D pvar_func_testAsynPortDriverRegister

That is referenced in a dbd file like this:

registrar("testAsynPortDriverRegister")

I suspect you are not being consistent in the names between your .cpp file and your dbd file.

Mark



________________________________
From: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>> on behalf of 黄佳伟 via Tech-talk <[email protected]<mailto:[email protected]>>
Sent: Monday, July 15, 2019 6:15 AM
To: [email protected]<mailto:[email protected]>
Subject: Problems with ioc app building with asyn

Hello,
I'm new to EPICS and EPICS asyn module. Now I'm writing an IOC app in imitation of the `testAsynPortDriver` to be familiar with asyn module. But I get some make error when I make in my <top>:
make -C ./configure install
make[1]: Entering directory '/home/jasper/asynTest/configure'
perl -CSD /home/jasper/EPICS/epics-base/bin/linux-x86_64/makeMakefile.pl O.linux-x86_64 ../..
mkdir -p O.Common
make -C O.linux-x86_64 -f ../Makefile TOP=../.. \
T_A=linux-x86_64 install
make[2]: Entering directory '/home/jasper/asynTest/configure/O.linux-x86_64'
perl -CSD /home/jasper/EPICS/epics-base/bin/linux-x86_64/convertRelease.pl checkRelease
make[2]: Leaving directory '/home/jasper/asynTest/configure/O.linux-x86_64'
make[1]: Leaving directory '/home/jasper/asynTest/configure'
make -C ./asynTestApp install
make[1]: Entering directory '/home/jasper/asynTest/asynTestApp'
make -C ./src install
make[2]: Entering directory '/home/jasper/asynTest/asynTestApp/src'
perl -CSD /home/jasper/EPICS/epics-base/bin/linux-x86_64/makeMakefile.pl O.linux-x86_64 ../../..
mkdir -p O.Common
make -C O.linux-x86_64 -f ../Makefile TOP=../../.. \
T_A=linux-x86_64 install
make[3]: Entering directory '/home/jasper/asynTest/asynTestApp/src/O.linux-x86_64'
/usr/bin/g++ -D_GNU_SOURCE -D_DEFAULT_SOURCE -D_X86_64_ -DUNIX -Dlinux -O3 -g -Wall -mtune=generic -m64 -fPIC -I. -I../O.Common -I. -I. -I.. -I../../../include/compiler/gcc -I../../../include/os/Linux -I../../../include -I/home/jasper/EPICS/epics-base/include/compiler/gcc -I/home/jasper/EPICS/epics-base/include/os/Linux -I/home/jasper/EPICS/epics-base/include -I/home/jasper/EPICS/synApps/support/asyn-R4-33/include -MM -MF asynTest.d ../asynTest.cpp
/usr/bin/g++ -D_GNU_SOURCE -D_DEFAULT_SOURCE -D_X86_64_ -DUNIX -Dlinux -O3 -g -Wall -mtune=generic -m64 -I. -I../O.Common -I. -I. -I.. -I../../../include/compiler/gcc -I../../../include/os/Linux -I../../../include -I/home/jasper/EPICS/epics-base/include/compiler/gcc -I/home/jasper/EPICS/epics-base/include/os/Linux -I/home/jasper/EPICS/epics-base/include -I/home/jasper/EPICS/synApps/support/asyn-R4-33/include -MM -MF asynTestMain.d ../asynTestMain.cpp
Expanding dbd file ../asynTestInclude.dbd
perl -CSD /home/jasper/EPICS/epics-base/bin/linux-x86_64/dbdExpand.pl -I. -I.. -I../O.Common -I../../../dbd -I/home/jasper/EPICS/epics-base/dbd -I/home/jasper/EPICS/synApps/support/asyn-R4-33/dbd -o asynTest.dbd ../asynTestInclude.dbd
perl -CSD /home/jasper/EPICS/epics-base/bin/linux-x86_64/registerRecordDeviceDriver.pl -I. -I.. -I../O.Common -I../../../dbd -I/home/jasper/EPICS/epics-base/dbd -I/home/jasper/EPICS/synApps/support/asyn-R4-33/dbd -o asynTest_registerRecordDeviceDriver.cpp ../O.Common/asynTest.dbd asynTest_registerRecordDeviceDriver /home/jasper/asynTest
/usr/bin/g++ -D_GNU_SOURCE -D_DEFAULT_SOURCE -D_X86_64_ -DUNIX -Dlinux -O3 -g -Wall -mtune=generic -m64 -I. -I../O.Common -I. -I. -I.. -I../../../include/compiler/gcc -I../../../include/os/Linux -I../../../include -I/home/jasper/EPICS/epics-base/include/compiler/gcc -I/home/jasper/EPICS/epics-base/include/os/Linux -I/home/jasper/EPICS/epics-base/include -I/home/jasper/EPICS/synApps/support/asyn-R4-33/include -MM -MF asynTest_registerRecordDeviceDriver.d asynTest_registerRecordDeviceDriver.cpp
Installing created dbd file ../../../dbd/asynTest.dbd
/usr/bin/g++ -D_GNU_SOURCE -D_DEFAULT_SOURCE -D_X86_64_ -DUNIX -Dlinux -O3 -g -Wall -mtune=generic -m64 -fPIC -I. -I../O.Common -I. -I. -I.. -I../../../include/compiler/gcc -I../../../include/os/Linux -I../../../include -I/home/jasper/EPICS/epics-base/include/compiler/gcc -I/home/jasper/EPICS/epics-base/include/os/Linux -I/home/jasper/EPICS/epics-base/include -I/home/jasper/EPICS/synApps/support/asyn-R4-33/include -c ../asynTest.cpp
/usr/bin/ar -rc libasynTestSupport.a asynTest.o
/usr/bin/ranlib libasynTestSupport.a
/usr/bin/g++ -o libasynTestSupport.so -shared -fPIC -Wl,-hlibasynTestSupport.so -L/home/jasper/asynTest/lib/linux-x86_64 -L/home/jasper/EPICS/epics-base/lib/linux-x86_64 -L/home/jasper/EPICS/synApps/support/asyn-R4-33/lib/linux-x86_64 -Wl,-rpath,/home/jasper/asynTest/lib/linux-x86_64 -Wl,-rpath,/home/jasper/EPICS/epics-base/lib/linux-x86_64 -Wl,-rpath,/home/jasper/EPICS/synApps/support/asyn-R4-33/lib/linux-x86_64 -rdynamic -m64 asynTest.o -lasyn -ldbRecStd -ldbCore -lca -lCom -lpthread -lreadline -lm -lrt -ldl -lgcc
Installing shared library ../../../lib/linux-x86_64/libasynTestSupport.so
Installing library ../../../lib/linux-x86_64/libasynTestSupport.a
/usr/bin/g++ -D_GNU_SOURCE -D_DEFAULT_SOURCE -D_X86_64_ -DUNIX -Dlinux -O3 -g -Wall -mtune=generic -m64 -I. -I../O.Common -I. -I. -I.. -I../../../include/compiler/gcc -I../../../include/os/Linux -I../../../include -I/home/jasper/EPICS/epics-base/include/compiler/gcc -I/home/jasper/EPICS/epics-base/include/os/Linux -I/home/jasper/EPICS/epics-base/include -I/home/jasper/EPICS/synApps/support/asyn-R4-33/include -c asynTest_registerRecordDeviceDriver.cpp
/usr/bin/g++ -D_GNU_SOURCE -D_DEFAULT_SOURCE -D_X86_64_ -DUNIX -Dlinux -O3 -g -Wall -mtune=generic -m64 -I. -I../O.Common -I. -I. -I.. -I../../../include/compiler/gcc -I../../../include/os/Linux -I../../../include -I/home/jasper/EPICS/epics-base/include/compiler/gcc -I/home/jasper/EPICS/epics-base/include/os/Linux -I/home/jasper/EPICS/epics-base/include -I/home/jasper/EPICS/synApps/support/asyn-R4-33/include -c ../asynTestMain.cpp
/usr/bin/g++ -o asynTest -L/home/jasper/asynTest/lib/linux-x86_64 -L/home/jasper/EPICS/epics-base/lib/linux-x86_64 -L/home/jasper/EPICS/synApps/support/asyn-R4-33/lib/linux-x86_64 -Wl,-rpath,/home/jasper/asynTest/lib/linux-x86_64 -Wl,-rpath,/home/jasper/EPICS/epics-base/lib/linux-x86_64 -Wl,-rpath,/home/jasper/EPICS/synApps/support/asyn-R4-33/lib/linux-x86_64 -rdynamic -m64 asynTest_registerRecordDeviceDriver.o asynTestMain.o -lasynTestSupport -lasyn -ldbRecStd -ldbCore -lca -lCom
asynTest_registerRecordDeviceDriver.o: In function `asynTest_registerRecordDeviceDriver':
/home/jasper/asynTest/asynTestApp/src/O.linux-x86_64/asynTest_registerRecordDeviceDriver.cpp:350: undefined reference to `pvar_func_testAsynConfigure'
collect2: error: ld returned 1 exit status
/home/jasper/EPICS/epics-base/configure/RULES_BUILD:206: recipe for target 'asynTest' failed
make[3]: *** [asynTest] Error 1
make[3]: Leaving directory '/home/jasper/asynTest/asynTestApp/src/O.linux-x86_64'
/home/jasper/EPICS/epics-base/configure/RULES_ARCHS:58: recipe for target 'install.linux-x86_64' failed
make[2]: *** [install.linux-x86_64] Error 2
make[2]: Leaving directory '/home/jasper/asynTest/asynTestApp/src'
/home/jasper/EPICS/epics-base/configure/RULES_DIRS:84: recipe for target 'src.install' failed
make[1]: *** [src.install] Error 2
make[1]: Leaving directory '/home/jasper/asynTest/asynTestApp'
/home/jasper/EPICS/epics-base/configure/RULES_DIRS:84: recipe for target 'asynTestApp.install' failed
make: *** [asynTestApp.install] Error 2

Here is my directory tree:
.
├── asynTestApp
│   ├── Db
│   │   ├── asynTest.db
│   │   └── Makefile
│   ├── Makefile
│   └── src
│       ├── asynTest.cpp
│       ├── asynTest.h
│       ├── asynTestInclude.dbd
│       ├── asynTestMain.cpp
│       └── Makefile
├── configure
│   ├── CONFIG
│   ├── CONFIG_SITE
│   ├── Makefile
│   ├── RELEASE
│   ├── RULES
│   ├── RULES_DIRS
│   ├── RULES.ioc
│   └── RULES_TOP
├── iocBoot
│   ├── iocasynTest
│   │   ├── asynTest.substitution
│   │   ├── Makefile
│   │   └── st.cmd
│   └── Makefile
└── Makefile

Here is my Makefile in `./asynTestApp/src/Makefile`:
TOP=../..

include $(TOP)/configure/CONFIG
#----------------------------------------
#  ADD MACRO DEFINITIONS AFTER THIS LINE
#=============================

#=============================

# Asyn Support

LIBRARY_IOC += asynTestSupport
asynTestSupport_SRCS += asynTest.cpp
asynTestSupport_LIBS += asyn
asynTestSupport_LIBS += $(EPICS_BASE_IOC_LIBS)

# Build the IOC application

PROD_IOC = asynTest

# asynTest.dbd will be created and installed
DBD += asynTest.dbd

# asynTest.dbd will be made up from these files:
# asynTest_DBD += base.dbd

# Include dbd files from all support applications:
# asynTest_DBD += asyn.dbd

# Add all the support libraries needed by this IOC
asynTest_LIBS += asynTestSupport asyn

# asynTest_registerRecordDeviceDriver.cpp derives from asynTest.dbd
asynTest_SRCS += asynTest_registerRecordDeviceDriver.cpp

# Build the main IOC entry point on workstation OSs.
asynTest_SRCS_DEFAULT += asynTestMain.cpp
asynTest_SRCS_vxWorks += -nil-

# Add support from base/src/vxWorks if needed
#asynTest_OBJS_vxWorks += $(EPICS_BASE_BIN)/vxComLibrary

# Finally link to the EPICS Base libraries
asynTest_LIBS += $(EPICS_BASE_IOC_LIBS)

#===========================

include $(TOP)/configure/RULES
#----------------------------------------
#  ADD RULES AFTER THIS LINE

My version of EPICS base is 3.16.2 and asyn is from synApps 6.0.

Could someone tell me where's the bug? Thank you.


Jiawei Huang

References:
Problems with ioc app building with asyn 黄佳伟 via Tech-talk
Re: Problems with ioc app building with asyn 黄佳伟 via Tech-talk

Navigate by Date:
Prev: Re: Problems with ioc app building with asyn 黄佳伟 via Tech-talk
Next: Re: updating ADAndor from RHEL6 to RHEL7 ben.bradnick--- via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Problems with ioc app building with asyn 黄佳伟 via Tech-talk
Next: pvGet in Sequence does not work with incorrect size Simon Reiter via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
ANJ, 16 Jul 2019 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·