I'm dealing with the following problem for quite sometime. I have a project that is using CMake and its being built for both 32bit and 64bit on Ubuntu. The project had dependencies to Boost library.
For 64 bit the build is working and I'm getting the .so generated. But for 32bit I have the following linking error:
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_locale.so.1.71.0: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
CMake code:
if("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Linux")
set_property(TARGET ${PROJECT_NAME} PROPERTY POSITION_INDEPENDENT_CODE ON)
set(Boost_USE_MULTITHREADED ON)
find_package(Boost 1.69 REQUIRED COMPONENTS locale)
link_directories(${Boost_LIBRARY_DIRS})
include_directories(${Boost_INCLUDE_DIRS})
endif()
I do have boost installed for 32bit also, in usr/lib/i386-linux-gnu but I cannot manage to tell CMake to look into that folder when building for 32bit.
I tried to set the Boost_Library_DIRS using:
set (Boost_LIBRARY_DIRS "/usr/lib/i386-linux-gnu/")
But this also didn't work.
Any help is appreciated. Thanks!