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:
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(xeneth_test)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULES_PATH} /home/sam/Documents/common/CMakeModules)
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
SET(CMAKE_CXX_FLAGS "-m32")
FIND_PACKAGE(Xeneth REQUIRED)
INCLUDE_DIRECTORIES(${LIBXENETH_INCLUDE_DIRS})
FIND_PACKAGE(OpenCV REQUIRED)
#GENERATE EXECUTABLES
ADD_EXECUTABLE(myXenethTest src/myXenethTest.cpp)
TARGET_LINK_LIBRARIES(myXenethTest ${XENETH_LIBRARIES} ${OpenCV_LIBS})
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.
-Sam