EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

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

Subject: Re: Python/CA
From: Noboru Yamamoto <[email protected]>
To: [email protected]
Cc: "[email protected]" <[email protected]>
Date: Tue, 25 Jan 2000 09:55:32 +0900
Janousch Markus wrote:
> 
>   Sorry, for bothering you, but I have some problems compiling/running
> CaPython.
> 
> 1. It seems that you are running on a HP-machine because you are linking
> against      -lCompat in Epics. We are running Linux (Red Hat 5.2) here,
> so I don't need this library. I don't think this is the source of my
> problems.
On Linux platform,  lines in Setup.local looks like the following:


EPICS_BASE=/proj/epics/R313/base # you need to change this anyway.
#
_ca _ca.c -DUNIX -I/proj/local/$(ARCH)/include -I$(EPICS_BASE)/include -L$(EPICS_BASE\
)/lib/Linux  -lca -lAs -lCom -lDb

You need to change /proj/local/$(ARCH)/include appropriately.
> 
> 2. When linking I get an unresolved symbol
> > /home/local/janousch/Python-1.5.2/Modules/./_ca.c:1105: undefined reference to `ca_sock_id'
> I couldn't find any reference to the function ca_sock_id() in one of the
> Epics libraries. We are using Epics 3.13.0.beta12; can it be that you
> are using a more recent version of Epics/CA that has this function
> defined?
>
ca_sock_id() is itroduced to define Py_ca_fileno(). It is not a part of
the standard EPICS 
distribution.
You need to add the following two lines to $(EPICS)/base/src/cadef.h

#define ca_sock_id(CHID)                ca_sock_id_function(CHID)
epicsShareFunc READONLY int epicsShareAPI ca_sock_id_function ( chid channel);

and add the following definitions in $(EPICS)/base/src/caaccess.c

READONLY int epicsShareAPI ca_sock_id_function(chid chix)
{
        IIU     *piiu;

        piiu = chix->piiu;

        if(!piiu){
                return NULL;
        }
        return piiu->sock_chan;
}
> 
> Anyhow, I replaced the return value of the function by a fixed integer
> value, since I presume that the function Py_ca_fileno() that calls
> ca_sock_id() is not needed for a small test.
>

You need ca_sock_id/Py_ca_fileno when you wants write you own event loop
using 
select function call in a Python program. Otherwise you can commentout
this function. 

It may be better idea to register fd_manager after importing ca module. 

	def fdreg(uarg, fd, opend):
		if opened:
			print "fd %d was opened"%fd
		else:
			print "fd %d was closed"%fd
	uarg="any data for fdreg"

	import ca	
	ca.add_fd_registration(fdreg, uarg)


ca.add_fd_registation  will register a wrpper fd_registration fucntion using

ca_add_fd_registraion(wrap_fdreg,uarg);

where uarg will be a pointer to the PyObject which includes (fdreg,
uarg) pair.

wrap_fdreg() will evaluate Python object passed as  uarg. And evaluate
fdreg in
Python interpreter with file_descriptor, open/close flag and user argument.

If you have better idea, please let me know.

> 
> 3. Thus, when running ca_test.py with the newly built Python and I do
> not give a channel name as an argument a small window with a
> 'Quit'-button appears; looks fine for me. But giving a valid channel as
> an argument results in a core dump (segmentation fault). Before that
> happens a message is printed:
> > Acquire Lock No1
> and then the application dies.
I believe you build python build with "thread" support. 
Check Setup.thread in your Python/Modules directory.

Currently Python/CA does not work with Python-thread.
I'm very sorry about it. We are working on that without much success.

> 
>  Do you have any idea what I could be doing wrong? I built and tested on
> a Linux-PC running Red Hat 5.2. The compilation was done with gcc
> 2.7.2.3 and the Epics version used was 3.13.0.beta12. The Python version
> is 1.5.2 and it seems to run with the existing python-code I have.
>
We runs Python CA on 

HP-UX 10.20
OSF1 v4.0
Red Hat Linux release 6.1 , Kernel 2.2.12-20 on an i686

without Python-thead support.
> 
>   Thanks for any help,
>                       Markus
>
I'm very sorry about my poor documentation and source code preparation.
I greatly appriciate your comments.

Thanks.

Noboru


Navigate by Date:
Prev: RE: using vxWorks td() to shutdown CA clients and sequence tasks Jeff Hill
Next: locking and VxWorks global variable device support William Lupton
Index: 1994  1995  1996  1997  1998  1999  <20002001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Python/CA Noboru Yamamoto
Next: Re: Python/CA Noboru Yamamoto
Index: 1994  1995  1996  1997  1998  1999  <20002001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·