LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Importing 32 bit swig library from python2.4 on 64 bit machine (https://www.linuxquestions.org/questions/linux-software-2/importing-32-bit-swig-library-from-python2-4-on-64-bit-machine-879830/)

veerals123 05-10-2011 09:45 AM

Importing 32 bit swig library from python2.4 on 64 bit machine
 
Hi,
I am using swig framework to invoke certain C APIs in a C Library from a python program. Unfortunately the python software needs to run on a 64 bit virtualization platform, whereas the C library is 32 bit (its a 3rd party library whose 64 bit version is not available). Lets say the name of the swig generated shared library is _my_swig.so. When the python wrapper makes "import _my_swig" call, i see the following error
ImportError: -snipsnip-/_my_swig.so: wrong ELF class: ELFCLASS32

which probably means I am trying to import a 32 bit library from 64 bit python. Can anybody suggest any workaround?

thanks
veerals123

vikas027 05-10-2011 07:00 PM

Have you tried installing the 64 bit package for python or any other package which is giving such error.

Try downloading the specified RPM from below sites
http://rpm.pbone.net
http://www.rpmlinux.org

On the other hand, if your machine is connected to internet you can use yum to install it.
Which distro are you using ?

veerals123 05-10-2011 10:57 PM

Hi Vikas, Thanks for your kind response. I think I didnt understand your comment. I already have a 64 bit python 2.4 running on my OS. My OS is centOS-5(x86_64) based and runs a hypervisor. Problem occurs because the 64 bit python is trying to import a 32 bit .so library - needed by swig framework. This results in "wrong ELF class: ELFCLASS32" error. If my library was 64 bit, this problem would not occur. But this 3rd party library doesnt have a 64 bit equivalent. Hence I am looking for suggestions on possible workarounds. Hope this makes sense.

Regards
veerals123

vikas027 05-11-2011 05:26 AM

Quote:

Originally Posted by veerals123 (Post 4352692)
Hi Vikas, Thanks for your kind response. I think I didnt understand your comment. I already have a 64 bit python 2.4 running on my OS. My OS is centOS-5(x86_64) based and runs a hypervisor. Problem occurs because the 64 bit python is trying to import a 32 bit .so library - needed by swig framework. This results in "wrong ELF class: ELFCLASS32" error. If my library was 64 bit, this problem would not occur. But this 3rd party library doesnt have a 64 bit equivalent. Hence I am looking for suggestions on possible workarounds. Hope this makes sense.

Regards
veerals123

Hi Veerals,

Please locate that ".so" file, run below commands on it and paste output here.

Code:

rpm -qf  /path/to/your/so/file
rpm -q --qf '%{ARCH}\n' `rpm -qf  /path/to/your/so/file`



All times are GMT -5. The time now is 12:06 PM.