2vision2
2vision2

Reputation: 5023

opencv compiled in 64 bit run in 32 bit ubuntu

I have createa a sample Opencv C++ ".so" file which will simply display the images passed by opencv Python script (ie., My python script will call the C++ ".so" file and pass a image to it ). The communication between python and C++ is done with Boost library.

I did all this in 64-bit ubuntu machine.Now I need to run my python script which call the ".so" in 32 bit ubuntu machine, where I am getting the below error.

cv2.so: wrong ELF class: ELFCLASS64

This is because of opencv "cv2.so" is expected to be 32 bit? How can I create a 32 bit "cv2.so" in ubuntu 64 bit machine? Also do I need to create my own ".so" file ( which displays the images) as 32 bit?

Upvotes: 2

Views: 1194

Answers (1)

lolando
lolando

Reputation: 1751

You are correct. On your 32-bit Ubuntu machine, you need to make sure that your executable and all its dependencies are 32-bit. Meaning that you need to re-compile your .so in 32-bit (or get it from a 3rd party).
To compile 32-bit libraries, you need to indicate this to your compiler and linker, most likely with a flag (for instance -m32 in case of gcc)

Upvotes: 3

Related Questions