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

2010-11-05 Thread Philip Lowman
On Thu, Nov 4, 2010 at 12:31 PM, Michael Jackson 
mike.jack...@bluequartz.net wrote:

 Clean out your build folder first.
 export BOOST_ROOT=/home/kknox/sdk/boost_1_44_0
 == that needs to be an actual installation, a staged area will probably
 NOT work to find boost as FindBoost is looking for a very specific path
 within BOOST_ROOT and if that path is NOT found then it will probably fall
 back on the system paths.


FindBoost.cmake in CMake 2.8.3 supports a new option to prevent searching
the system paths.  You should enable it if you are 100% sure that you will
never want to find something outside of BOOST_ROOT, CMAKE_PREFIX_PATH, etc.
Boost_NO_SYSTEM_PATHS

There was a bug related to not finding Boost libraries in a staging area.  I
believe this works now.

Also, take a moment and set this new variable appropriately (nearly all
users will want it to be OFF)
Boost_USE_STATIC_RUNTIME

-- 
Philip Lowman
___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

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

2010-11-04 Thread Adam J Richardson
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Thu, 04 Nov 2010 04:35:57 -0400
cmake-requ...@cmake.org wrote:
 Hi all~

Hi Kent.

 I have a project using Boost that should compile for both 64bit and
 32bit on a 64bit host.  This works fine for a 64bit target, but I
 can't get this to work for a 32bit target.

I'm having problems linking Boost too. But enough about me.

 In order to compile for 32bit on a 64bit host, I have a -D parameter
 called BUILD64.  Here is my logic to initialize this var:
 
 if( WIN32 )
   set( BUILD64 ${CMAKE_CL_64} )
 else()
   option( BUILD64 Build a 64-bit product OFF )
   if( BUILD64 )
   message( STATUS 64-bit build )
   endif( )
 endif()

Are you sure this logic is right? It looks very odd. Does CMake set
WIN32 for a 64-bit Windows toolchain? Didn't you say you were building
on Linux?

 The syntax for finding boost is thus:
 set( Boost_USE_MULTITHREADED ON )
 set( Boost_USE_STATIC_LIBS   ON )
 set( Boost_DETAILED_FAILURE_MSG   ON )
 # set( Boost_DEBUG ON )
 find_package( Boost 1.33.0 COMPONENTS program_options )

You don't set ADDITIONAL_VERSIONS. That's probably not the problem.
IIRC, it's:

set(Boost_ADDITIONAL_VERSIONS 1.44 1.44.0)

... if you wanted to try it anyway.

Regards,
Adam J Richardson
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAkzSgx0ACgkQSUH6dLOqvqmfKwCg6qttDVOXnpqHYoZwfjzUyHax
ubMAniQAF6EYxsIUYkqXPQiMwFxop6uB
=ngaQ
-END PGP SIGNATURE-
___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


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

2010-11-04 Thread Knox, Kent
Hi Adam~

[Adam]
Are you sure this logic is right? It looks very odd. Does CMake set WIN32 for a 
64-bit Windows toolchain? Didn't you say you were building on Linux?

[Kent]
My software compiles cross platform, and we support windows too.  WIN32 is set 
for 64bit platforms.  I do have the windows build compiling properly with 
boost.  I'm specifically having problems with linux.

[Adam]
You don't set ADDITIONAL_VERSIONS. That's probably not the problem.
IIRC, it's:
set(Boost_ADDITIONAL_VERSIONS 1.44 1.44.0)

[Kent]
I did not originally set Boost_ADDITIONAL_VERSIONS.  I did set it now, and ran 
a clean recompile, but no change.  My Boost_LIBRARIES still came out as:
-- Boost_LIBRARIES: /usr/lib/libboost_program_options-mt.a

Even though I've specified BOOST_LIBRARYDIR as:
BOOST_LIBRARYDIR = /home/kknox/sdk/boost_1_44_0/stage/lib

Kent

-Original Message-
From: Adam J Richardson [mailto:fat...@crackmonkey.us] 
Sent: Thursday, November 04, 2010 4:56 AM
To: Knox, Kent
Cc: cmake@cmake.org
Subject: Linking Boost on Linux on 64bit host and 32bit target

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Thu, 04 Nov 2010 04:35:57 -0400
cmake-requ...@cmake.org wrote:
 Hi all~

Hi Kent.

 I have a project using Boost that should compile for both 64bit and 
 32bit on a 64bit host.  This works fine for a 64bit target, but I 
 can't get this to work for a 32bit target.

I'm having problems linking Boost too. But enough about me.

 In order to compile for 32bit on a 64bit host, I have a -D parameter 
 called BUILD64.  Here is my logic to initialize this var:
 
 if( WIN32 )
   set( BUILD64 ${CMAKE_CL_64} )
 else()
   option( BUILD64 Build a 64-bit product OFF )
   if( BUILD64 )
   message( STATUS 64-bit build )
   endif( )
 endif()

Are you sure this logic is right? It looks very odd. Does CMake set
WIN32 for a 64-bit Windows toolchain? Didn't you say you were building on Linux?

 The syntax for finding boost is thus:
 set( Boost_USE_MULTITHREADED ON )
 set( Boost_USE_STATIC_LIBS   ON )
 set( Boost_DETAILED_FAILURE_MSG   ON )
 # set( Boost_DEBUG ON )
 find_package( Boost 1.33.0 COMPONENTS program_options )

You don't set ADDITIONAL_VERSIONS. That's probably not the problem.
IIRC, it's:

set(Boost_ADDITIONAL_VERSIONS 1.44 1.44.0)

... if you wanted to try it anyway.

Regards,
Adam J Richardson
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAkzSgx0ACgkQSUH6dLOqvqmfKwCg6qttDVOXnpqHYoZwfjzUyHax
ubMAniQAF6EYxsIUYkqXPQiMwFxop6uB
=ngaQ
-END PGP SIGNATURE-

___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


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

2010-11-03 Thread Knox, Kent
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.

This is my output when I run 'make VERBOSE=1':

-- [ 
/home/kknox/bin/cmake-2.8.2-Linux-i386/share/cmake-2.8/Modules/FindBoost.cmake:373
 ] Boost not in cache
-- [ 
/home/kknox/bin/cmake-2.8.2-Linux-i386/share/cmake-2.8/Modules/FindBoost.cmake:376
 ] _boost_TEST_VERSIONS = 
1.41.0;1.41;1.40.0;1.40;1.39.0;1.39;1.38.0;1.38;1.37.0;1.37;1.36.1;1.36.0;1.36;1.35.1;1.35.0;1.35;1.34.1;1.34.0;1.34;1.33.1;1.33.0;1.33
-- [ 
/home/kknox/bin/cmake-2.8.2-Linux-i386/share/cmake-2.8/Modules/FindBoost.cmake:378
 ] Boost_USE_MULTITHREADED = ON
-- [ 
/home/kknox/bin/cmake-2.8.2-Linux-i386/share/cmake-2.8/Modules/FindBoost.cmake:380
 ] Boost_USE_STATIC_LIBS = ON
-- [ 
/home/kknox/bin/cmake-2.8.2-Linux-i386/share/cmake-2.8/Modules/FindBoost.cmake:439
 ] Declared as CMake or Environmental Variables:
-- [ 
/home/kknox/bin/cmake-2.8.2-Linux-i386/share/cmake-2.8/Modules/FindBoost.cmake:441
 ]   BOOST_ROOT = /home/kknox/sdk/boost_1_44_0
-- [ 
/home/kknox/bin/cmake-2.8.2-Linux-i386/share/cmake-2.8/Modules/FindBoost.cmake:443
 ]   BOOST_INCLUDEDIR =
-- [ 
/home/kknox/bin/cmake-2.8.2-Linux-i386/share/cmake-2.8/Modules/FindBoost.cmake:445
 ]   BOOST_LIBRARYDIR = /home/kknox/sdk/boost_1_44_0/stage/lib
-- [ 
/home/kknox/bin/cmake-2.8.2-Linux-i386/share/cmake-2.8/Modules/FindBoost.cmake:447
 ] _boost_TEST_VERSIONS = 
1.41.0;1.41;1.40.0;1.40;1.39.0;1.39;1.38.0;1.38;1.37.0;1.37;1.36.1;1.36.0;1.36;1.35.1;1.35.0;1.35;1.34.1;1.34.0;1.34;1.33.1;1.33.0;1.33
-- [ 
/home/kknox/bin/cmake-2.8.2-Linux-i386/share/cmake-2.8/Modules/FindBoost.cmake:496
 ] Include debugging info:
-- [ 
/home/kknox/bin/cmake-2.8.2-Linux-i386/share/cmake-2.8/Modules/FindBoost.cmake:498
 ]   _boost_INCLUDE_SEARCH_DIRS = 
/home/kknox/sdk/boost_1_44_0/include;/home/kknox/sdk/boost_1_44_0;C:/boost/include;C:/boost;/boost/include;/boost;/sw/local/include
-- [ 
/home/kknox/bin/cmake-2.8.2-Linux-i386/share/cmake-2.8/Modules/FindBoost.cmake:500
 ]   _boost_PATH_SUFFIXES = 
boost-1_41_0;boost-1_41;boost-1_40_0;boost-1_40;boost-1_39_0;boost-1_39;boost-1_38_0;boost-1_38;boost-1_37_0;boost-1_37;boost-1_36_1;boost-1_36_0;boost-1_36;boost-1_35_1;boost-1_35_0;boost-1_35;boost-1_34_1;boost-1_34_0;boost-1_34;boost-1_33_1;boost-1_33_0;boost-1_33
-- [ 
/home/kknox/bin/cmake-2.8.2-Linux-i386/share/cmake-2.8/Modules/FindBoost.cmake:524
 ] location of version.hpp: /home/kknox/sdk/boost_1_44_0/boost/version.hpp
-- [ 
/home/kknox/bin/cmake-2.8.2-Linux-i386/share/cmake-2.8/Modules/FindBoost.cmake:543
 ] version.hpp reveals boost 1.44.0
-- [ 
/home/kknox/bin/cmake-2.8.2-Linux-i386/share/cmake-2.8/Modules/FindBoost.cmake:634
 ] guessed _boost_COMPILER = -gcc44
-- [ 
/home/kknox/bin/cmake-2.8.2-Linux-i386/share/cmake-2.8/Modules/FindBoost.cmake:644
 ] _boost_MULTITHREADED = -mt
-- [ 
/home/kknox/bin/cmake-2.8.2-Linux-i386/share/cmake-2.8/Modules/FindBoost.cmake:661
 ] _boost_STATIC_TAG =
-- [ 
/home/kknox/bin/cmake-2.8.2-Linux-i386/share/cmake-2.8/Modules/FindBoost.cmake:663
 ] _boost_ABI_TAG = d
-- [ 
/home/kknox/bin/cmake-2.8.2-Linux-i386/share/cmake-2.8/Modules/FindBoost.cmake:696
 ] _boost_LIBRARIES_SEARCH_DIRS = 
/home/kknox/sdk/boost_1_44_0/stage/lib;/home/kknox/sdk/boost_1_44_0/lib;/home/kknox/sdk/boost_1_44_0/stage/lib;/home/kknox/sdk/boost_1_44_0/lib;/home/kknox/sdk/boost_1_44_0/../lib;C:/boost/lib;C:/boost;/boost/boost_1_44_0/lib;/boost/boost_1_44/lib;/boost/lib;/boost;/sw/local/lib
-- [ 
/home/kknox/bin/cmake-2.8.2-Linux-i386/share/cmake-2.8/Modules/FindBoost.cmake:830
 ] Boost_FOUND = TRUE
-- Boost version: 1.44.0
-- Found the following Boost libraries:
--   program_options

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 

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

2010-11-03 Thread Andreas Pakulat
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.
___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


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

2010-10-29 Thread Knox, Kent
Hi all~

I have a project using Boost that should compile for both 64bit and 32bit on a 
64bit host.  This works fine for a 64bit target, but I can't get this to work 
for a 32bit target.  I've done a fair share of googling to find this answer, 
but have not stumbled across anything that helps.  In fact, the only flag that 
I can find to distinguish between 32bit build and 64bit builds only applies to 
windows with ${CMAKE_CL_64}.

In order to compile for 32bit on a 64bit host, I have a -D parameter called 
BUILD64.  Here is my logic to initialize this var:

if( WIN32 )
set( BUILD64 ${CMAKE_CL_64} )
else()
option( BUILD64 Build a 64-bit product OFF )
if( BUILD64 )
message( STATUS 64-bit build )
endif( )
endif()

The syntax for finding boost is thus:
set( Boost_USE_MULTITHREADED ON )
set( Boost_USE_STATIC_LIBS   ON )
set( Boost_DETAILED_FAILURE_MSG   ON )
# set( Boost_DEBUG ON )
find_package( Boost 1.33.0 COMPONENTS program_options )

The boost find package module doesn't appear at a glance to distinguish between 
64bit and 32bit builds;  I don't understand how it is supposed to work.  I have 
a feeling that it is expected that find_library is supposed to distinguish the 
path behavior, but I don't have it set up right.

When I compile and link for 32bit, I get:

Scanning dependencies of target Foo
[ 72%] Building CXX object client/CMakeFiles/Foo.dir/Foo.cpp.o
[ 81%] Building CXX object client/CMakeFiles/Foo.dir/openCL.cpp.o
[ 90%] Building CXX object client/CMakeFiles/Foo.dir/StatisticalTimer.cpp.o
[100%] Building CXX object client/CMakeFiles/Foo.dir/stdafx.cpp.o
Linking CXX executable Foo
/usr/bin/ld: warning: i386:x86-64 architecture of input file 
`/usr/local/boost_1_44_0/lib64/libboost_program_options.a(cmdline.o)' is 
incompatible with i386 output
/usr/bin/ld: warning: i386:x86-64 architecture of input file 
`/usr/local/boost_1_44_0/lib64/libboost_program_options.a(options_description.o)'
 is incompatible with i386 output

As you can see, it is looking in lib64 instead of lib.  How do I change that 
behavior?

Thanks for any help,
Kent

___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake