I am compiling some source that is linked to two packages. One is OpenCV and the other is a driver library for an infrared camera. The company only provides a 32-bit version of the library via an rpm package. I compiled OpenCV from source and it's libraries are installed in /usr/local/lib64. I am running Fedora 18 64-bit version. Here is my CMakeLists.txt:


SET(CMAKE_MODULE_PATH ${CMAKE_MODULES_PATH} /home/sam/Documents/common/CMakeModules) 



ADD_EXECUTABLE(myXenethTest src/myXenethTest.cpp) 

When I run make I get:

Scanning dependencies of target myXenethTest
[100%] Building CXX object CMakeFiles/myXenethTest.dir/src/myXenethTest.cpp.o
Linking CXX executable bin/myXenethTest
/usr/local/lib64/libopencv_calib3d.so: could not read symbols: File in wrong format
collect2: error: ld returned 1 exit status
make[2]: *** [bin/myXenethTest] Error 1
make[1]: *** [CMakeFiles/myXenethTest.dir/all] Error 2
make: *** [all] Error 2

This is probably because I am trying to link my target against a 64-bit compiled OpenCV and the 32-bit Xeneth libraries. I have to inlude the -m32 compiler flag, otherwise the libxeneth library won't be used. I just started recently with this whole 64-bit computing and after some time trying to find a solution, I am quite lost. Looking forward to any input/suggestions/answers to my problem. Thanks for your time.


Recommended Answers

All 2 Replies

32-bit binaries cannot be mixed with 64-bit binaries, period. There is no (easy) way to create an application that would link to some 32-bit libraries and some 64-bit libraries at the same time. Basically, if the program is 32-bit, then all its libraries (include shared-objects (.so files)) must also be 32-bit, and the same for 64-bit. The two cannot mix. In other words, x86-64 platforms can run either processes that are either 32bit or 64bit, but not a process that has a mix of both.

The solution is to compile OpenCV in 32bit too. (or get a 32bit version (i686) from a ppa repository).

Thanks for the reply. I had a feeling there was nothing else to do. I'll probably just have the 32-bit driver run as a seperate program and read the data from it through a shared memory buffer.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.