[CMake] Linking Boost on Linux on 64bit host and 32bit

Knox, Kent Kent.Knox at amd.com
Thu Nov 4 14:41:39 EDT 2010


Hi Michael~

[Michael]
Clean out your build folder first.

[Kent]
kknox at ux2 ~/code/clAMD/trunk/bin/linux32
528 > rm -rf *
I nuke the whole directory

[Michael] export BOOST_ROOT=/home/kknox/sdk/boost_1_44_0

[Kent] Instead of setting an environment variable, I have a bash script that executes the following and sets BOOST_ROOT and BOOST_LIBRARYDIR with -D, I hope that's the same thing:
 ~/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

[Michael] Also put the following in your CMakeLists.txt file after you try to find  boost:

[Kent] My output:
-- Boost version: 1.44.0
-- Found the following Boost libraries:
--   program_options
-- Boost_PROGRAM_OPTIONS_LIBRARY: /usr/lib/libboost_program_options-mt.a

It's definitely picking up the wrong boost, since my BOOST_ROOT is =~/sdk/boost_1_44_0 and I'm pointing BOOST_LIBRARYDIR to the exact path to the library I want to use, which is in stage, but I don't see why that matters.  I don't want to install boost on this system; I just wanted to compile my own copy and use it.  The funny thing is that it is reading the correct version from version.hpp in my personal Boost (it is printing 1.44), because the version installed by Ubuntu is 1.40.  So it has the correct header path, it's just messing up my library path.

I actually tested this out with a 64bit compile (with all the new echo messages), and I'm linking in the wrong version there too.  I just didn't notice before because it didn't error.  So my problem is actually agnostic to the bitness of my target.

Thanks for your time,
Kent




More information about the CMake mailing list