[CMake] Linking Boost on Linux on 64bit host and 32bit target
Andreas Pakulat
apaku at gmx.de
Wed Nov 3 19:54:33 EDT 2010
On 03.11.10 17:57:10, Knox, Kent wrote:
> Hello all~
>
> I'm going to follow up on my email from last week with more information. I don't believe that find_package( Boost ) is behaving properly in my case, and I need help with either a proper solution or a workaround.
>
> I'm using Cmake 2.8.2, on a 64bit Ubuntu linux host, trying to compile a 32bit package with boost.
>
> I have manually downloaded and compiled boost 1.44 into my home directory, ~/sdk/boost_1_44_0. The system also has boost 1.40 installed using a package manager into /usr/lib.
>
> I manually invoke cmake with this command line:
> ~/bin/cmake-2.8.2-Linux-i386/bin/cmake -G "Unix Makefiles" -D BOOST_ROOT=~/sdk/boost_1_44_0 -D BOOST_LIBRARYDIR=~/sdk/boost_1_44_0/stage/lib -D ATISTREAMSDKROOT=/usr/src/ati/ati-stream-sdk-v2.2-lnx64 -D BUILD64=OFF -D CMAKE_BUILD_TYPE=Debug ../../code
>
> Notice that I explicitly set BOOST_ROOT and BOOST_LIBRARYDIR, and the debug output seems to confirm my settings.
> At my link step, I get:
>
> /usr/bin/c++ -m32 -g CMakeFiles/clAmd.Client.dir/clAmd.client.cpp.o CMakeFiles/clAmd.Client.dir/clAmd.openCL.cpp.o CMakeFiles/clAmd.Client.dir/clAmd.statisticalTimer.cpp.o CMakeFiles/clAmd.Client.dir/stdafx.cpp.o -o clAmd.Client-0.5.1 -rdynamic -L/usr/src/ati/ati-stream-sdk-v2.2-lnx64/lib/x86 ../library/libclAmd.Runtime.so.0.5.1 -Wl,-Bstatic -lboost_program_options-mt -Wl,-Bdynamic -lOpenCL -Wl,-rpath,/usr/src/ati/ati-stream-sdk-v2.2-lnx64/lib/x86:/home/kknox/code/clTest/trunk/clFFT/bin/linux32/library:
> /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../libboost_program_options-mt.a when searching for -lboost_program_options-mt
> /usr/bin/ld: skipping incompatible /usr/lib/libboost_program_options-mt.a when searching for -lboost_program_options-mt
> /usr/bin/ld: cannot find -lboost_program_options-mt
>
> Notice, that the link step does NOT use the paths that I specified, but instead uses '-Wl,-Bstatic -lboost_program_options-mt', which is using the boost that is installed in /usr/lib. This is a problem because it is the wrong bitness.
Did you try to print out the value of Boost_LIBRARIES? Does that contain
the proper absolute path to the boost library? Are you actually using
that variable for your target_link_libraries call? The make-output looks
like either the variable doesn't get the right value which shouldn't
happen as its set using find_library or you're not using the variable
but instead simply pass "program_options" to the target_link_libraries
call. Oh and whats the value of Boost_program_options_LIBRARY?
Andreas
--
You never know how many friends you have until you rent a house on the beach.
More information about the CMake
mailing list