Ubuntu 10.04 64bit Error

Asked by Alberto

Hi, I am getting the following error when I try to call pymqi.

ImportError: libmqic_r.so: wrong ELF class: ELFCLASS32

this is on a 64bit ubuntu 10.04 machine. Python is looking for libmqic_r.so in the /opt/mqm/lib instead of /opt/mqm/lib64. I don't know how to get it to look into lib64 and not the lib directory.

Any and all help will be greatly appreciated.

Question information

Language:
English Edit question
Status:
Solved
For:
PyMQI Edit question
Assignee:
No assignee Edit question
Solved by:
Alberto
Solved:
Last query:
Last reply:
Revision history for this message
Dariusz Suchojad (dsuch) said :
#1

Hi Alberto,

first thing is, how did you install PyMQI? Using pip? Downloaded the package and installed it manually? If the latter, which package was it exactly? What's its name?

Here's how the installation process looks like on a Ubuntu 10.04 box of mine. Note that uname tells me it's a 64bit system, the installer says "Building PyMQI client 64bits" and gcc is then linking to /opt/mqm/lib64. I'd be curious to see the log from your end.

Note that if you already have PyMQI installed you need to hand delete it by removing the following files and directories (obviously, substitute /usr/local/lib/python2.6/dist-packages for the correct directory if using VirtualEnv or a similar tool)

/usr/local/lib/python2.6/dist-packages/pymqe.so
/usr/local/lib/python2.6/dist-packages/pymqi-1.1.egg-info
/usr/local/lib/python2.6/dist-packages/pymqi.py
/usr/local/lib/python2.6/dist-packages/pymqi.pyc
/usr/local/lib/python2.6/dist-packages/CMQC.py
/usr/local/lib/python2.6/dist-packages/CMQC.pyc
/usr/local/lib/python2.6/dist-packages/CMQCFC.py
/usr/local/lib/python2.6/dist-packages/CMQCFC.pyc
/usr/local/lib/python2.6/dist-packages/CMQXC.py
/usr/local/lib/python2.6/dist-packages/CMQXC.pyc

$ uname -m
x86_64
$

$ sudo pip install pymqi
Downloading/unpacking pymqi
  Downloading pymqi-1.1.tar.gz (54Kb): 54Kb downloaded
  Running setup.py egg_info for package pymqi
    Building PyMQI client 64bits
Installing collected packages: pymqi
  Running setup.py install for pymqi
    Building PyMQI client 64bits
    building 'pymqe' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -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 -Wl,-O1 -Wl,-Bsymbolic-functions build/temp.linux-x86_64-2.6/pymqe.o -L/opt/mqm/lib64 -lmqic_r -o build/lib.linux-x86_64-2.6/pymqe.so
    changing mode of build/scripts-2.6/mqmess.py from 644 to 755
    changing mode of build/scripts-2.6/browse.py from 644 to 755
    changing mode of build/scripts-2.6/inq.py from 644 to 755
    changing mode of /usr/local/bin/browse.py to 755
    changing mode of /usr/local/bin/mqmess.py to 755
    changing mode of /usr/local/bin/inq.py to 755
Successfully installed pymqi
Cleaning up...
$

import pymqi
import CMQC, CMQCFC, CMQXC

queue_manager = "QM01"
channel = "SVRCONN.1"
host = "192.168.1.126"
port = "1418"
conn_info = "%s(%s)" % (host, port)

qmgr = pymqi.QueueManager(None)
qmgr.connectTCPClient(queue_manager, pymqi.cd(), channel, conn_info)

pcf = pymqi.PCFExecute(qmgr)

pcf.MQCMD_PING_Q_MGR()

qmgr.disconnect()

Revision history for this message
Dariusz Suchojad (dsuch) said :
#2

Hi Alberto,

first thing is, how did you install PyMQI? Using pip? Downloaded the package and installed it manually? If the latter, which package was it exactly? What's its name?

Here's how the installation process looks like on a Ubuntu 10.04 box of mine. Note that uname tells me it's a 64bit system, the installer says "Building PyMQI client 64bits" and gcc is then linking to /opt/mqm/lib64. I'd be curious to see the log from your end.

Note that if you already have PyMQI installed you need to hand delete it by removing the following files and directories (obviously, substitute /usr/local/lib/python2.6/dist-packages for the correct directory if using VirtualEnv or a similar tool)

/usr/local/lib/python2.6/dist-packages/pymqe.so
/usr/local/lib/python2.6/dist-packages/pymqi-1.1.egg-info
/usr/local/lib/python2.6/dist-packages/pymqi.py
/usr/local/lib/python2.6/dist-packages/pymqi.pyc
/usr/local/lib/python2.6/dist-packages/CMQC.py
/usr/local/lib/python2.6/dist-packages/CMQC.pyc
/usr/local/lib/python2.6/dist-packages/CMQCFC.py
/usr/local/lib/python2.6/dist-packages/CMQCFC.pyc
/usr/local/lib/python2.6/dist-packages/CMQXC.py
/usr/local/lib/python2.6/dist-packages/CMQXC.pyc

$ uname -m
x86_64
$

$ sudo pip install pymqi
Downloading/unpacking pymqi
  Downloading pymqi-1.1.tar.gz (54Kb): 54Kb downloaded
  Running setup.py egg_info for package pymqi
    Building PyMQI client 64bits
Installing collected packages: pymqi
  Running setup.py install for pymqi
    Building PyMQI client 64bits
    building 'pymqe' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -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 -Wl,-O1 -Wl,-Bsymbolic-functions build/temp.linux-x86_64-2.6/pymqe.o -L/opt/mqm/lib64 -lmqic_r -o build/lib.linux-x86_64-2.6/pymqe.so
    changing mode of build/scripts-2.6/mqmess.py from 644 to 755
    changing mode of build/scripts-2.6/browse.py from 644 to 755
    changing mode of build/scripts-2.6/inq.py from 644 to 755
    changing mode of /usr/local/bin/browse.py to 755
    changing mode of /usr/local/bin/mqmess.py to 755
    changing mode of /usr/local/bin/inq.py to 755
Successfully installed pymqi
Cleaning up...
$

import pymqi
import CMQC, CMQCFC, CMQXC

queue_manager = "QM01"
channel = "SVRCONN.1"
host = "192.168.1.126"
port = "1418"
conn_info = "%s(%s)" % (host, port)

qmgr = pymqi.QueueManager(None)
qmgr.connectTCPClient(queue_manager, pymqi.cd(), channel, conn_info)

pcf = pymqi.PCFExecute(qmgr)

pcf.MQCMD_PING_Q_MGR()

qmgr.disconnect()

Revision history for this message
Alberto (apedraza) said :
#3

Dariusz,

I used the package from launchpad (tar.gz) 1.1

Here is the log:

# python setup.py install
Building PyMQI client 64bits
running install
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
running build_ext
building 'pymqe' extension
creating build/temp.linux-x86_64-2.6
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -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 -Wl,-O1 -Wl,-Bsymbolic-functions build/temp.linux-x86_64-2.6/pymqe.o -L/opt/mqm/lib64 -lmqic_r -o build/lib.linux-x86_64-2.6/pymqe.so
running build_scripts
creating build/scripts-2.6
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
changing mode of build/scripts-2.6/mqmess.py from 644 to 755
changing mode of build/scripts-2.6/browse.py from 644 to 755
changing mode of build/scripts-2.6/inq.py from 644 to 755
running install_lib
creating /usr/local/lib/python2.6/dist-packages
copying build/lib.linux-x86_64-2.6/CMQCFC.py -> /usr/local/lib/python2.6/dist-packages
copying build/lib.linux-x86_64-2.6/pymqi.py -> /usr/local/lib/python2.6/dist-packages
copying build/lib.linux-x86_64-2.6/CMQC.py -> /usr/local/lib/python2.6/dist-packages
copying build/lib.linux-x86_64-2.6/pymqe.so -> /usr/local/lib/python2.6/dist-packages
copying build/lib.linux-x86_64-2.6/CMQXC.py -> /usr/local/lib/python2.6/dist-packages
byte-compiling /usr/local/lib/python2.6/dist-packages/CMQCFC.py to CMQCFC.pyc
byte-compiling /usr/local/lib/python2.6/dist-packages/pymqi.py to pymqi.pyc
byte-compiling /usr/local/lib/python2.6/dist-packages/CMQC.py to CMQC.pyc
byte-compiling /usr/local/lib/python2.6/dist-packages/CMQXC.py to CMQXC.pyc
running install_scripts
copying build/scripts-2.6/browse.py -> /usr/local/bin
copying build/scripts-2.6/inq.py -> /usr/local/bin
copying build/scripts-2.6/mqmess.py -> /usr/local/bin
changing mode of /usr/local/bin/browse.py to 755
changing mode of /usr/local/bin/inq.py to 755
changing mode of /usr/local/bin/mqmess.py to 755
running install_egg_info
Writing /usr/local/lib/python2.6/dist-packages/pymqi-1.1.egg-info

Thank you for your help.

Revision history for this message
Dariusz Suchojad (dsuch) said :
#4

Hm hm hm.. frankly, I have no idea why it would happen, I've never seen it on any of my 64 bit systems so it seems unlikely it has anything to do with PyMQI. Sorry for asking the obvious, but are you 200% sure it's a 64bit MQ installation? What was the MQ package name?

Revision history for this message
Alberto (apedraza) said :
#5

I don't know either. One workaround was to copy libmqic_r.so to the /lib directory. This works but it bothers me that I had to do this. I am almost positive that the rpm that I used is MQSeriesServer-7.0.0-1.x86_64.rpm but I installed this a while back and since I also have the 32 bit rpms. Who knows? Maybe I installed the 64 bit and on top of that the 32 bit... I remember that I had to do some gymnastics to the system because the MQ eclipse graphical manager would not come up... I had to install ia32libs for it to come up.

I really don't want to re-install MQ. My uname -m command result is: x86_64.

This is just my developing machine. After I am done with building the program I am working on, I will test it on our production server which is also running Ubuntu 10.04 x64 and see what happens...

Since MQ is not officially supported on Ubuntu, how did you install it in yours?

Thank you for your help.

Revision history for this message
Dariusz Suchojad (dsuch) said :
#6

I've just found http://rubyforge.org/pipermail/rubywmq-misc/2008-April/000014.html which deals with Ruby but well, it's the same C MQ API underneath. Can you try the export LD_LIBRARY_PATH=/opt/mqm/lib64 trick they're proposing?

> I will test it on our production server which is also running Ubuntu 10.04 x64 and see what happens...

OK, just take the note of what MQ package it is then. I can't be certain of course but it really sounds like you have a 64 bit system and a 32 bit MQ. In which case the LD_LIBRARY_PATH workaround won't work around anything. And if it doesn't, that will in fact prove that MQ is 32 but and you have no choice but to reinstall MQ - PyMQI doesn't support that configuration, I simply have no environment to test it on.

> Since MQ is not officially supported on Ubuntu, how did you install it in yours?

Well, I've just followed my own blog post :-) http://www.gefira.pl/blog/2010/07/03/websphere-mq-and-ubuntu-howto/

Revision history for this message
Alberto (apedraza) said :
#7

I've just fixed the problem on my system by adding the path /opt/mqm/lib64 to a file. I named the file mqlib64.conf and put it in the /etc/ld.so.conf.d directory. Afterwards, ran sudo ldconfig. All is well now. Setting the LD_LIBRARY_PATH also worked but its not the recommended way according to some experts.

Again, Thank you for all your help.