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  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Problems getting the Python module to work
From: "Adam Kadzban" <[email protected]>
To: "Antonino Miceli" <[email protected]>
Cc: [email protected]
Date: Wed, 6 Aug 2008 14:50:15 -0500
That seems to have worked!  I just went into Python and did import EpicsCA, and it isn't complaining at all.  And ldd'ing the _epics.so files now says libca.so and libcom.so exist.  Thanks for all the help!

Here's what I did:
adam:/usr/local/EpicsCA-2.1.5$ echo $LD_LIBRARY_PATH $EPICS_BASE
/usr/local/lib/epics/base/lib/linux-x86_64 /usr/local/lib/epics/base
adam:/usr/local/EpicsCA-2.1.5$ sudo python setup.py install
  Warning: could not find environment variable EPICS_BASE
           will try:  /usr/local/lib/epics/base
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.5
creating build/lib.linux-x86_64-2.5/EpicsCA
copying lib/Motor.py -> build/lib.linux-x86_64-2.5/EpicsCA
copying lib/PV.py -> build/lib.linux-x86_64-2.5/EpicsCA
copying lib/__init__.py -> build/lib.linux-x86_64-2.5/EpicsCA
copying lib/alarm.py -> build/lib.linux-x86_64-2.5/EpicsCA
copying lib/closure.py -> build/lib.linux-x86_64-2.5/EpicsCA
creating build/lib.linux-x86_64-2.5/EpicsCA/wx
copying lib/wx/MotorPanel.py -> build/lib.linux-x86_64-2.5/EpicsCA/wx
copying lib/wx/__init__.py -> build/lib.linux-x86_64-2.5/EpicsCA/wx
copying lib/wx/wxlib.py -> build/lib.linux-x86_64-2.5/EpicsCA/wx
running build_ext
building '_epics' extension
creating build/temp.linux-x86_64-2.5
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I. -I/usr/local/lib/epics/base/include -I/usr/local/lib/epics/base/include/os/Linux -I/usr/include/python2.5 -c epics_wrap.c -o build/temp.linux-x86_64-2.5/epics_wrap.o
In file included from epics_wrap.c:2708:
/usr/local/lib/epics/base/include/cadef.h:878: warning: function declaration isn't a prototype
epics_wrap.c:2997: warning: function declaration isn't a prototype
epics_wrap.c:3044: warning: function declaration isn't a prototype
epics_wrap.c:3058: warning: function declaration isn't a prototype
epics_wrap.c:3071: warning: function declaration isn't a prototype
epics_wrap.c:3077: warning: function declaration isn't a prototype
epics_wrap.c:3703: warning: function declaration isn't a prototype
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions build/temp.linux-x86_64-2.5/epics_wrap.o -L. -L/usr/local/lib/epics/base/lib/linux-x86_64 -lca -lCom -lpthread -o build/lib.linux-x86_64-2.5/_epics.so
running install_lib
copying build/lib.linux-x86_64-2.5/_epics.so -> /usr/lib/python2.5/site-packages
byte-compiling /usr/lib/python2.5/site-packages/EpicsCA/__init__.py to __init__.pyc
running install_egg_info
Removing /usr/lib/python2.5/site-packages/EpicsCA-2.1.5.egg-info
Writing /usr/lib/python2.5/site-packages/EpicsCA-2.1.5.egg-info
adam:/usr/local/EpicsCA-2.1.5$ cd build/lib.linux-x86_64-2.5
adam:/usr/local/EpicsCA-2.1.5/build/lib.linux-x86_64-2.5$ ldd _epics.so
    linux-vdso.so.1 =>  (0x00007fff927fe000)
    libca.so => /usr/local/lib/epics/base/lib/linux-x86_64/libca.so (0x00007f568a178000)
    libCom.so => /usr/local/lib/epics/base/lib/linux-x86_64/libCom.so (0x00007f5689f25000)
    libpthread.so.0 => /lib/libpthread.so.0 (0x00007f5689cf4000)
    libc.so.6 => /lib/libc.so.6 (0x00007f5689992000)
    libreadline.so.5 => /lib/libreadline.so.5 (0x00007f5689752000)
    libncurses.so.5 => /lib/libncurses.so.5 (0x00007f5689516000)
    librt.so.1 => /lib/librt.so.1 (0x00007f568930d000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f5689002000)
    libm.so.6 => /lib/libm.so.6 (0x00007f5688d80000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f5688b72000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f568a5f7000)
    libdl.so.2 => /lib/libdl.so.2 (0x00007f568896e000)
adam:/usr/local/EpicsCA-2.1.5/build/lib.linux-x86_64-2.5$ cd /usr/lib/python2.5/site-packages/
adam:/usr/lib/python2.5/site-packages$ ldd _epics.so
    linux-vdso.so.1 =>  (0x00007fff7bbfe000)
    libca.so => /usr/local/lib/epics/base/lib/linux-x86_64/libca.so (0x00007f13736a8000)
    libCom.so => /usr/local/lib/epics/base/lib/linux-x86_64/libCom.so (0x00007f1373455000)
    libpthread.so.0 => /lib/libpthread.so.0 (0x00007f1373224000)
    libc.so.6 => /lib/libc.so.6 (0x00007f1372ec2000)
    libreadline.so.5 => /lib/libreadline.so.5 (0x00007f1372c82000)
    libncurses.so.5 => /lib/libncurses.so.5 (0x00007f1372a46000)
    librt.so.1 => /lib/librt.so.1 (0x00007f137283d000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f1372532000)
    libm.so.6 => /lib/libm.so.6 (0x00007f13722b0000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f13720a2000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f1373b27000)
    libdl.so.2 => /lib/libdl.so.2 (0x00007f1371e9e000)


-Adam

On Wed, Aug 6, 2008 at 2:21 PM, Antonino Miceli <[email protected]> wrote:
OK. So, the problem is that when EpicsCA was built it did not find the libca nor libCom and so they are not linked. Setting LD_LIBRARY_PATH now won't help since EpicsCA has already been compiled (right?)

/usr/local/EpicsFA2.1.5/build/lib.linux-x86_64-2.5 is where it is initially built and then it is copied over to /usr/lib/python2.5/site-packages

I would try to re-build EpicsCA...

First, remove the "build" directory.  Next make sure LD_LIBRARY_PATH like was mentioned in the previous emails. Make sure the EPICS_BASE environment variable set as in the instructions.
Run python setup.py install.  Then run ldd on the _epics.so files. Make sure that they are the new ones (check the date and time of the files "ls -l").
If the python install works the one in the build and site-packages directory should be identical.

See of this works. If ldd _epics.so still shows that it can't find libca and libCom, it won't work.

Save all the output to a file and send it to us.

Nino

Adam Kadzban wrote
It doesn't seem to be LD_LIBRARY_PATH. I tried setting it with export, and also putting it in the /etc/environment file.

There are two _epics.so files that 'locate' brings up, one in /usr/lib/python2.5/site-packages and one in /usr/local/EpicsFA2.1.5/biuld/lib.linux-x86_64-2.5.  When I call 'ldd' on them, both say that libca.so and libCom.so are "not found".  The other files they're linked to come up with hex addresses.  I can't just stick "/usr/local/lib/epics/base/lib/linux-x86_64/libca.so" in there, so how do I link those in?

"When you built it, there should have been a gcc line that includes something like -lca and -lCom... try using the direct path to  libca and libCom, i.e.,
/usr/local/lib/epics/base/lib/linux-x86_64/libca.so. It's the gcc line that build  _epics.so, I believe."

I remember seeing -lca and -lCom come up when I was installing the epics base.  Should I dig around the epics base files and try to find that line?  I'm not sure where in there to look...

-Adam


On Wed, Aug 6, 2008 at 1:50 PM, John Hammonds <[email protected] <mailto:[email protected]>> wrote:

   This should be LD_LIBRARY_PATH.  You were able to find epicsCA
   which is the Python part of things.  libca is the epics library
   which does not have anything to do with Python.
   Also, for what it is worth, I have also been working to update
   Geoff Savage's CaPython.  This does not provide quite as slick an
   interface as Matt's but it is  a pretty full implementation of the
   Channel Access Libraries.  I have most of this working using a
   newer version of SWIG and python.  I have not yet added the 3.14
   CA calls but it can do things like deal with larger arrays.  I am
   trying to coordinate with Geoff before releasing this.

   John


   Tim Mooney wrote:

       Adam,  The first thing I'd try is setting either the
       LD_LIBRARY_PATH,
       or the PYTHONPATH, environment variable to the directory
       containing the
       needed .so file.  E.g.:

       setenv LD_LIBRARY_PATH /usr/local/lib/epics/base/lib/linux-x86_64
         or, if you're using bash,
       export LD_LIBRARY_PATH=/usr/local/lib/epics/base/lib/linux-x86_64


       Adam Kadzban wrote:

           Hey all, I'm a relative newcomer to both Linux, Python,
           and Epics, so sorry if this has an easy solution.  I guess
           I'm not even sure if it's a problem with Epics itself, or
           Python, or something else.  I'm having some problems
           getting Python to import the EpicsCA module.  I'm running
           Ubuntu 8.04 (Hardy), and it's an x86_64 system.  The epics
           base seems to have installed fine, I put it in
           /usr/local/lib/epics/base.  I got the epics module here
           <http://cars9.uchicago.edu/%7Enewville/Epics/Python/>
           (http://cars9.uchicago.edu/~newville/Epics/Python/
           <http://cars9.uchicago.edu/%7Enewville/Epics/Python/>),

           and again it looked like it installed fine to
           /usr/local/EpicsCA-2.1.5.

           The problem is, whenever I try to do anything with EpicsCA
           in Python, it dies on me because it can't find libca.so.
            Here's what it shows when I try to import EpicsCA:

            >>> import EpicsCA
           Traceback (most recent call last):
            File "<stdin>", line 1, in <module>
            File
           "/usr/lib/python2.5/site-packages/EpicsCA/__init__.py",
           line 116, in <module>
              import _epics
           ImportError: libca.so: cannot open shared object file: No
           such file or directory

           (it does the same if I try "from EpicsCA import *")

           However, I know libca.so exists, it's here:

           adam:$ locate libca.so
           /usr/local/lib/epics/base/lib/linux-x86_64/libca.so
           /usr/local/lib/epics/base/lib/linux-x86_64/libca.so.3.14
           /usr/local/lib/epics/base/src/ca/O.linux-x86_64/libca.so.3.14

           So there it is, in the epics base folder.  Why can't
           Python find it?  I was digging around online, and found
           how to add places for Python looks for modules to import
           them (though I don't think that's the problem, because it
           can't find libca.so, not a module), and I added a bunch of
           places, to no avail.  Anyone have any ideas?


           Not sure if it's relevant, but when I ran the setup.py
           script to install EpicsCA, I had to edit the environment
           variable manually.  I added
           "EPICS_BASE=/usr/local/lib/epics/base" to
           /etc/environment, but for some reason
           os.environ['EPICS_BASE'] wasn't finding
           /usr/local/lib/epics/base.  I had to change the setup
           script to look there.  Though if I opened a Python
           interpreter and printed os.environ['EPICS_BASE'], it came
           out as /usr/local/lib/epics/base.  So something fishy was
           going on there, not sure if it's related though.


           Thanks,
           Adam Kadzban



   --    John Hammonds
   Beamline and Data Acquisition Group
   APS Engineering Support Division

   Argonne National Laboratory
   [email protected] <mailto:[email protected]>
   <mailto:[email protected] <mailto:[email protected]>>
   (630)252-5317






Replies:
Re: Problems getting the Python module to work J. Lewis Muir
References:
Problems getting the Python module to work Adam Kadzban
Re: Problems getting the Python module to work Tim Mooney
Re: Problems getting the Python module to work John Hammonds
Re: Problems getting the Python module to work Adam Kadzban
Re: Problems getting the Python module to work Antonino Miceli

Navigate by Date:
Prev: Re: Problems getting the Python module to work Antonino Miceli
Next: Re: Problems getting the Python module to work J. Lewis Muir
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Problems getting the Python module to work Antonino Miceli
Next: Re: Problems getting the Python module to work J. Lewis Muir
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·