0

I have IBM MQ Installed in /opt/mqm/. This has all the Header files and libraries and specifically the libmqic_r.so file.

[aa@aa packages]# find /opt/mqm/ -name 'libmqic_r.so'
/opt/mqm/lib64/compat/libmqic_r.so
/opt/mqm/lib64/libmqic_r.so
/opt/mqm/lib/compat/libmqic_r.so
/opt/mqm/lib/libmqic_r.so

To Install PYMQI using the build and the build_ext, i have specified all the paths as below -

[aa@aa pymqi-1.4]# python setup.py config --verbose --include-dirs /opt/mqm/ --libraries /opt/mqm/ --library-dirs /opt/mqm/ --noisy
Building PyMQI client 64bits
running config
[aa@aa pymqi-1.4]#  python setup.py build build_ext -I /opt/mqm/
Building PyMQI client 64bits
running build
running build_py
running build_ext

Also on the /opt/mqm directory all permissions are RWXR_XR_X giving Read and Execute to all users. /opt/mqm in the default PATH environment variables too.

Installed Packages -

[aa@aajars]# yum list installed | grep MQ
MQSeriesClient.x86_64               7.5.0-5                           @/MQSeriesClient-7.5.0-5.x86_64
MQSeriesJRE.x86_64                  7.5.0-5                           @/MQSeriesJRE-7.5.0-5.x86_64
MQSeriesJava.x86_64                 7.5.0-5                           @/MQSeriesJava-7.5.0-5.x86_64
MQSeriesMan.x86_64                  7.5.0-5                           @/MQSeriesMan-7.5.0-5.x86_64
MQSeriesRuntime.x86_64              7.5.0-5                           @/MQSeriesRuntime-7.5.0-5.x86_64
MQSeriesSDK.x86_64                  7.5.0-5                           @/MQSeriesSDK-7.5.0-5.x86_64
MQSeriesSamples.x86_64              7.5.0-5                           @/MQSeriesSamples-7.5.0-5.x86_64
MQSeriesXRClients.x86_64            7.5.0-5                           @/MQSeriesXRClients-7.5.0-5.x86_64

[aa@aajars]# yum list installed | grep python-dev
python-devel.x86_64                 2.6.6-51.el6                      @localrepo

However after all this is still get the below -

Python 2.6.6 (r266:84292, Oct 15 2013, 07:32:41)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymqi
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.linux-x86_64/egg/pymqi.py", line 109, in <module>
  File "build/bdist.linux-x86_64/egg/pymqe.py", line 7, in <module>
  File "build/bdist.linux-x86_64/egg/pymqe.py", line 6, in __bootstrap__
ImportError: libmqic_r.so: cannot open shared object file: No such file or directory
>>>

Any ideas why is this happening?

Edit - Rebuild Log -

[aa@aa pymqi-1.4]# python setup.py config --verbose --include-dirs /opt/mqm/ --libraries /opt/mqm/ --library-dirs /opt/mqm/ --noisy
Building PyMQI client 64bits
running config
[aa@aa pymqi-1.4]# python setup.py build build_ext -I /opt/mqm/
Building PyMQI client 64bits
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.6
copying pymqi.py -> build/lib.linux-x86_64-2.6
copying CMQC.py -> build/lib.linux-x86_64-2.6
copying CMQCFC.py -> build/lib.linux-x86_64-2.6
copying CMQXC.py -> build/lib.linux-x86_64-2.6
copying CMQZC.py -> build/lib.linux-x86_64-2.6
running build_ext
building 'pymqe' extension
creating build/temp.linux-x86_64-2.6
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPYQMI_SERVERBUILD=0 -I/opt/mqm/inc -I/opt/mqm/ -I/usr/include/python2.6 -c pymqe.c -o build/temp.linux-x86_64-2.6/pymqe.o
gcc -pthread -shared build/temp.linux-x86_64-2.6/pymqe.o -L/opt/mqm/lib64 -L/usr/lib64 -lmqic_r -lpython2.6 -o build/lib.linux-x86_64-2.6/pymqe.so
[aa@aa pymqi-1.4]# python setup.py install  --record files.txt
Building PyMQI client 64bits
running install
running bdist_egg
running egg_info
writing pymqi.egg-info/PKG-INFO
writing top-level names to pymqi.egg-info/top_level.txt
writing dependency_links to pymqi.egg-info/dependency_links.txt
writing pymqi.egg-info/PKG-INFO
writing top-level names to pymqi.egg-info/top_level.txt
writing dependency_links to pymqi.egg-info/dependency_links.txt
reading manifest file 'pymqi.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'scripts/*.py'
writing manifest file 'pymqi.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
running build_ext
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-2.6/CMQZC.py -> build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-2.6/CMQC.py -> build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-2.6/CMQCFC.py -> build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-2.6/CMQXC.py -> build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-2.6/pymqe.so -> build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-2.6/pymqi.py -> build/bdist.linux-x86_64/egg
byte-compiling build/bdist.linux-x86_64/egg/CMQZC.py to CMQZC.pyc
byte-compiling build/bdist.linux-x86_64/egg/CMQC.py to CMQC.pyc
byte-compiling build/bdist.linux-x86_64/egg/CMQCFC.py to CMQCFC.pyc
byte-compiling build/bdist.linux-x86_64/egg/CMQXC.py to CMQXC.pyc
byte-compiling build/bdist.linux-x86_64/egg/pymqi.py to pymqi.pyc
creating stub loader for pymqe.so
byte-compiling build/bdist.linux-x86_64/egg/pymqe.py to pymqe.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying pymqi.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pymqi.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pymqi.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pymqi.egg-info/pbr.json -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pymqi.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/pymqi-1.4-py2.6-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing pymqi-1.4-py2.6-linux-x86_64.egg
Copying pymqi-1.4-py2.6-linux-x86_64.egg to /usr/lib64/python2.6/site-packages
Adding pymqi 1.4 to easy-install.pth file

Installed /usr/lib64/python2.6/site-packages/pymqi-1.4-py2.6-linux-x86_64.egg
Processing dependencies for pymqi==1.4
Finished processing dependencies for pymqi==1.4
writing list of installed files to 'files.txt'
[aa@aa pymqi-1.4]# cat files.txt
/usr/lib64/python2.6/site-packages/pymqi-1.4-py2.6-linux-x86_64.egg

[aa@aamanishm]# find /usr/lib64/python2.6/ -name '*pymqe*'
[aa@aamanishm]#

Still no pymqe created :-(

Edit 2 - I got the pymqe.so file in /root/.python-eggs/pymqi-1.4-py2.6-linux-x86_64.egg-tmp/. I copied it to the /usr/lib64/python2.6/site-packages/ folder. After that too when I import pymqi, I still get the same same error.

JoshMc
  • 10,239
  • 2
  • 19
  • 38
myloginid
  • 1,463
  • 2
  • 22
  • 37

2 Answers2

1

You have to add the mqm libraries to your library PATH:

On AIX/LINUX edit $HOME/.profile file and add somewhere (usually at the bottom) the path to the mq libs

for Ubuntu:

export LD_LIBRARY_PATH=/opt/mqm/lib64:/opt/mqm/lib

in order to find where the library is:

ionut@N552VX:~$ locate libmqic_r.so
/opt/mqm/lib/libmqic_r.so
/opt/mqm/lib/compat/libmqic_r.so
/opt/mqm/lib64/libmqic_r.so
/opt/mqm/lib64/compat/libmqic_r.so

AIX:

export LIBPATH=$LIBPATH:/usr/mqm/lib64:/usr/mqm/lib

extracted from here:

    dspmqver
[..]
    InstPath:    /usr/mqm
[..]

more info the link below:

http://www.ibm.com/support/knowledgecenter/SSS28S_8.2.1/API/api_configuring_unix_path.html

Ionut Ilie
  • 111
  • 5
0

During the build stage, it should also build the 'pymqe' extension which is missing in your output. The build step includes the libmqic_r and adds the library path /opt/mqm/lib64.

$ python setup.py build build_ext -I /opt/mqm/
  Building PyMQI client 64bits
  running build
  running build_py
  running build_ext
  building 'pymqe' extension
  gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPYQMI_SERVERBUILD=0 -I/opt/mqm/inc -I/opt/mqm/ -I/usr/include/python2.6 -c pymqe.c -o build/temp.linux-x86_64-2.6/pymqe.o
  gcc -pthread -shared build/temp.linux-x86_64-2.6/pymqe.o -L/opt/mqm/lib64 -L/usr/lib64 -lmqic_r -lpython2.6 -o build/lib.linux-x86_64-2.6/pymqe.so
  running build_scripts
  copying and adjusting scripts/mqmess.py -> build/scripts-2.6
  copying and adjusting scripts/browse.py -> build/scripts-2.6
  copying and adjusting scripts/inq.py -> build/scripts-2.6

Did you install after building the package? (should be done as root for a system wide python package update)

python setup.py install

Try to build it from scratch. It should build a pymqe.so shared object and install should put it in the site-packages. Make sure you have MQ client packages (especially SDK) and python-dev package installed. These are the pre-requisites.

Download PyMQI (1.4 is the latest) source

$python setup.py build client
Building PyMQI client 64bits
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.6
copying pymqi.py -> build/lib.linux-x86_64-2.6
copying CMQC.py -> build/lib.linux-x86_64-2.6
copying CMQCFC.py -> build/lib.linux-x86_64-2.6
copying CMQXC.py -> build/lib.linux-x86_64-2.6
copying CMQZC.py -> build/lib.linux-x86_64-2.6
running build_ext
building 'pymqe' extension
creating build/temp.linux-x86_64-2.6
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPYQMI_SERVERBUILD=0 -I/opt/mqm/inc -I/usr/include/python2.6 -c pymqe.c -o build/temp.linux-x86_64-2.6/pymqe.o
gcc -pthread -shared build/temp.linux-x86_64-2.6/pymqe.o -L/opt/mqm/lib64 -L/usr/lib64 -lmqic_r -lpython2.6 -o build/lib.linux-x86_64-2.6/pymqe.so
Umapathy
  • 772
  • 8
  • 21