[NeXus-code-tickets] [NeXusCode] #347: napi.py may fail to find libNeXus.so.0 although it was installed with it
NeXus Data Format Library and Applications
noreply at nexusformat.org
Thu Apr 11 19:13:55 BST 2013
#347: napi.py may fail to find libNeXus.so.0 although it was installed with it
-----------------------------+------------------------
Reporter: Tobias Richter | Owner: Unassigned
Type: defect | Status: new
Priority: major | Milestone:
Component: python bindings | Version: 4.3.0
Keywords: |
-----------------------------+------------------------
Rolf Krahl reports:
====================================================
Symptom
-------
Even trivial Python programs using the NeXus API fail with an error
message that libNeXus.so.0 cannot be found:
$ python -c "import nxs"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib64/python2.7/site-packages/nxs/__init__.py", line 20, in
<module>
from nxs.napi import *
File "/usr/lib64/python2.7/site-packages/nxs/napi.py", line 268, in
<module>
nxlib = _init()
File "/usr/lib64/python2.7/site-packages/nxs/napi.py", line 263, in
_init
lib = _libnexus()
File "/usr/lib64/python2.7/site-packages/nxs/napi.py", line 260, in
_libnexus
raise OSError, "Set NEXUSLIB or move NeXus to one of: %s"%(",
".join(files))
OSError: Set NEXUSLIB or move NeXus to one of: /usr/lib64/python2.7/site-
packages/nxs/libNeXus.so.0, /usr/lib/libNeXus.so.0,
/usr/local/lib/libNeXus.so.0, /usr/lib/libNeXus.so.0
Analysis
--------
The NeXus API searches its lib in the following places in order:
- os.environ['NEXUSLIB']
- directory containing napi.py
- os.environ['LD_LIBRARY_PATH']
- PREFIX/lib
- /usr/local/lib
- /usr/lib
where PREFIX is set by configure during install, /usr in my case. The
directory containing napi.py was /usr/lib64/python2.7/site-packages/nxs
here. The environment variables NEXUSLIB and LD_LIBRARY_PATH have not
been set. This boils the search patch down to
/usr/lib64/python2.7/site-packages/nxs, /usr/lib, /usr/local/lib,
/usr/lib.
But the lib has been installed as /usr/lib64/libNeXus.so.0 by make
install and that is exactly the place where it should be on a 64 bit
system. So napi.py should have looked in /usr/lib64.
Suggested fix
-------------
Rather then in PREFIX/lib, /usr/local/lib, /usr/lib, napi.py should
look in LIBDIR as set by configure. That is the directory where it
gets installed by make install. See the attached patch.
====================================================
That attached patch didn't apply correctly for me. So I'll commit it to
this ticket.
--
Ticket URL: <http://trac.nexusformat.org/code/ticket/347>
NeXus Data Format Library and Applications <http://www.nexusformat.org/>
NeXus Data Format Library and Applications
More information about the NeXus-code-tickets
mailing list