MantisBT - CMake
View Issue Details
0011192CMakeModulespublic2010-08-31 02:022010-11-09 22:56
Raymond Wan 
Philip Lowman 
normalminoralways
closedfixed 
CMake-2-8 
CMake 2.8.3CMake 2.8.3 
0011192: FindBoost expects hyphen in directory name when it should be an underscore
I can't seem to find this reported elsewhere, but the Boost libraries cannot be found under Linux (Debian). After specifying -D Boost_DEBUG=ON, I realized it is searching in these paths:

-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:500 ] _boost_PATH_SUFFIXES = boost-1_42;boost-1_42_0;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

However, if you download v1.42 (and also the current 1.44 -- I just checked) as a .tar.gz file, it gets installed in boost_1_42_0. i.e., the first dash should be an underscore.
I fixed the problem for myself by symlinking /usr/local/boost_1_42_0 to /usr/local/boost-1_42_0.

Unless Boost is inconsistent with its directory naming schemes, perhaps changing it to an underscore will solve this problem?

Running cmake 2.8.2 under Debian.

No tags attached.
? FindBoost.cmake (50,753) 2010-09-08 01:54
https://public.kitware.com/Bug/file/3363/FindBoost.cmake
? FindBoost.cmake.old (42,207) 2010-09-08 02:49
https://public.kitware.com/Bug/file/3364/FindBoost.cmake.old
? FindBoost.cmake.5 (52,357) 2010-09-08 22:33
https://public.kitware.com/Bug/file/3371/FindBoost.cmake.5
? FindBoost.cmake.7 (54,757) 2010-09-09 08:07
https://public.kitware.com/Bug/file/3375/FindBoost.cmake.7
Issue History
2010-08-31 02:02Raymond WanNew Issue
2010-09-01 00:29Philip LowmanStatusnew => assigned
2010-09-01 00:29Philip LowmanAssigned To => Philip Lowman
2010-09-01 00:34Philip LowmanNote Added: 0022050
2010-09-01 05:23Raymond WanNote Added: 0022053
2010-09-08 01:54Philip LowmanNote Added: 0022127
2010-09-08 01:54Philip LowmanFile Added: FindBoost.cmake
2010-09-08 02:49Raymond WanFile Added: FindBoost.cmake.old
2010-09-08 02:59Raymond WanNote Added: 0022129
2010-09-08 09:07Philip LowmanNote Added: 0022132
2010-09-08 10:39Raymond WanNote Added: 0022135
2010-09-08 22:32Philip LowmanNote Added: 0022149
2010-09-08 22:33Philip LowmanFile Added: FindBoost.cmake.5
2010-09-09 01:09Raymond WanNote Added: 0022158
2010-09-09 01:13Raymond WanNote Added: 0022159
2010-09-09 08:07Philip LowmanFile Added: FindBoost.cmake.7
2010-09-09 08:12Philip LowmanNote Added: 0022160
2010-09-10 03:39Raymond WanNote Added: 0022178
2010-09-10 08:39Philip LowmanETAnone => < 1 day
2010-09-10 08:39Philip LowmanTarget Version => CMake 2.8.3
2010-09-12 22:29Philip LowmanNote Added: 0022201
2010-09-12 22:29Philip LowmanStatusassigned => resolved
2010-09-12 22:29Philip LowmanFixed in Version => CMake 2.8.3
2010-09-12 22:29Philip LowmanResolutionopen => fixed
2010-11-09 22:56Philip LowmanStatusresolved => closed

Notes
(0022050)
Philip Lowman   
2010-09-01 00:34   
Can you provide the path to the 1.42 .tar.gz file you downloaded so I can look into how it was built?

I don't recall any reports from anyone having problems with FindBoost.cmake detecting 1.42-1.44 to my knowledge (excepting Boost_ADDITIONAL_VERSIONS).
(0022053)
Raymond Wan   
2010-09-01 05:23   
Sorry that I wasn't clear. I'm using Debian 6.0 (testing), but I didn't use the Debian package -- I prefer to download from source as it is more up-to-date.

So, it is the files from http://www.boost.org/users/download/ [^] . I have 1.42 installed and when I filed the bug report, I thought I should look at 1.44 (the current version) as well. That is why I skipped 1.43 in my report.

And yes, the FindBoost.cmake that I am using is valid up to 1.41. I had to use Boost_ADDITIONAL_VERSIONS to add 1.42. I tried to find a version number of FindBoost.cmake, but couldn't find it -- so I reported my cmake version instead in the hopes that it can give the FindBoost.cmake version unambigiously.

Oh, I untarred it and also compiled it as I need more than just the headers. But I think that is not relevant to the problem? Thanks!
(0022127)
Philip Lowman   
2010-09-08 01:54   
See if this new FindBoost fixes your issue (set the new Boost_NO_SYSTEM_PATHS variable in addition to BOOST_ROOT)

# FindBoost.cmake in current directory
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
set(BOOST_ROOT /home/lowman/myboost)
set(Boost_NO_SYSTEM_PATHS true)
set(Boost_ADDITIONAL_VERSIONS 1.44 1.44.0)
find_package(Boost REQUIRED regex)

I don't think it matters the directory name where you install Boost with bjam.
(0022129)
Raymond Wan   
2010-09-08 02:59   
Thanks for looking into the problem!

Unfortunately, the file that you sent did not work. This is the error that I got:

=====
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:414 ] Boost not in cache
-- _boost_TEST_VERSIONS = 1.44.0;1.44;1.43.0;1.43;1.42.0;1.42;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
-- Boost_USE_MULTITHREADED = ON
-- Boost_USE_STATIC_LIBS = ON
-- Boost_USE_STATIC_RUNTIME =
-- Boost_ADDITIONAL_VERSIONS =
-- Boost_NO_SYSTEM_PATHS = true
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:480 ] Declared as CMake or Environmental Variables:
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:482 ] BOOST_ROOT = /usr/local
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:484 ] BOOST_INCLUDEDIR =
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:486 ] BOOST_LIBRARYDIR =
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:488 ] _boost_TEST_VERSIONS = 1.44.0;1.44;1.43.0;1.43;1.42.0;1.42;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
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:542 ] Include debugging info:
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:544 ] _boost_INCLUDE_SEARCH_DIRS = /usr/local/include;/usr/local
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:546 ] _boost_PATH_SUFFIXES = boost-1_44_0;boost-1_44;boost-1_43_0;boost-1_43;boost-1_42_0;boost-1_42;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
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:681 ] guessed _boost_COMPILER = -gcc
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:691 ] _boost_MULTITHREADED = -mt
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:734 ] _boost_RELEASE_ABI_TAG = -
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:736 ] _boost_DEBUG_ABI_TAG = -d
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:793 ] _boost_LIBRARIES_SEARCH_DIRS = /usr/local/lib;/usr/local/stage/lib
CMake Warning (dev) at /usr/share/cmake-2.8/Modules/FindBoost.cmake:814 (if):
  given arguments:

    "STREQUAL" "-"

  Unknown arguments specified
Call Stack (most recent call first):
  CMakeLists.txt:54 (FIND_PACKAGE)
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Error at /usr/share/cmake-2.8/Modules/FindBoost.cmake:1079 (message):
  Unable to find the requested Boost libraries.

  Unable to find the Boost header files. Please set BOOST_ROOT to the root
  directory containing Boost or BOOST_INCLUDEDIR to the directory containing
  Boost's headers.
Call Stack (most recent call first):
  CMakeLists.txt:54 (FIND_PACKAGE)


-- Configuring incomplete, errors occurred!
=====

Since I use different Boost components and installed your file into the system directory, my CMakeLists.txt is a little different:

set (BOOST_ROOT /usr/local)
set (Boost_NO_SYSTEM_PATHS true)
set (Boost_LIBRARYDIR /usr/local)
SET (Boost_USE_STATIC_LIBS ON)
SET (Boost_USE_MULTITHREADED ON)
FIND_PACKAGE (Boost REQUIRED COMPONENTS mpi program_options)

I took a look at FindBoost.cmake and though I can't understand the syntax, I took a guess and changed line 533 from:

list(APPEND _boost_PATH_SUFFIXES "boost-${_boost_BOOSTIFIED_VERSION}")

to

list(APPEND _boost_PATH_SUFFIXES "boost_${_boost_BOOSTIFIED_VERSION}")

This worked "better" [*], but makes no sense to me. Does this mean Boost has changed their default directory naming scheme so that the hyphen is not used? Or even worse -- is Boost inconsistent between versions??

I said "better" because I got an error which my older version did not give me (either through symlinking as I originally reported, or by changing the hyphen). This is what I get with your newer version:

=====
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:793 ] _boost_LIBRARIES_SEARCH_DIRS = /usr/local/lib;/usr/local/stage/lib
CMake Warning (dev) at /usr/share/cmake-2.8/Modules/FindBoost.cmake:814 (if):
  given arguments:

    "STREQUAL" "-"

  Unknown arguments specified
Call Stack (most recent call first):
  CMakeLists.txt:55 (FIND_PACKAGE)
This warning is for project developers. Use -Wno-dev to suppress it.

-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:999 ] Boost_FOUND = FALSE
CMake Error at /usr/share/cmake-2.8/Modules/FindBoost.cmake:1079 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.42.0

  Boost include path: /usr/local/boost_1_42_0

  The following Boost libraries could not be found:

          boost_mpi
          boost_program_options

  No Boost libraries were found. You may need to set Boost_LIBRARYDIR to the
  directory containing Boost libraries or BOOST_ROOT to the location of
  Boost.
Call Stack (most recent call first):
  CMakeLists.txt:55 (FIND_PACKAGE)


-- Configuring incomplete, errors occurred!
=====

But with the older version, it worked:

-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:696 ] _boost_LIBRARIES_SEARCH_DIRS = /usr/local/lib;/usr/local/stage/lib;/usr/local/boost_1_42_0/lib;/usr/local/boost_1_42_0/../lib;C:/boost/lib;C:/boost;/boost/boost_1_42_0/lib;/boost/boost_1_42/lib;/boost/lib;/boost;/sw/local/lib
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:830 ] Boost_FOUND = TRUE
-- Boost version: 1.42.0
-- Found the following Boost libraries:
-- mpi
-- program_options
-- Configuring done


I realize that you must have the old version in a repository somewhere, but I've uploaded it in case you want to do a quick comparison.

Thank you -- and let me know if I'm just doing something wrong...that's always possible...

Attached file: FindBoost.cmake.old
(0022132)
Philip Lowman   
2010-09-08 09:07   
I will look into the STREQUAL issue with the new version tonight after work.

I did an install with bjam last night of Boost 1.44 and I don't see any "boost_x_y_z" or "boost-x_y_z" in the install prefix. Maybe they disabled this?
(0022135)
Raymond Wan   
2010-09-08 10:39   
Sorry, for not being clearer, but I think it is unrelated to bjam [NB: I'm only a Boost user, so I don't know how things are organized...]. This is because boost can be used without compiling or running bjam (for the "header only" libraries) [*].

This is related to how the boost developers decided to archive boost. For example,

-----
debian:/tmp/test# ls -al
total 46308
drwxr-xr-x 2 root root 4096 Sep 8 23:30 .
drwxrwxrwt 9 root root 12288 Sep 8 23:30 ..
-rw-r--r-- 1 root root 47345940 Sep 8 23:24 boost_1_44_0.tar.gz
debian:/tmp/test# md5sum boost_1_44_0.tar.gz
085fce4ff2089375105d72475d730e15 boost_1_44_0.tar.gz
debian:/tmp/test# tar -zxvf boost_1_44_0.tar.gz 1>out.txt 2>&1
debian:/tmp/test# ls
boost_1_44_0 boost_1_44_0.tar.gz out.txt
debian:/tmp/test# head -n 5 out.txt
boost_1_44_0/
boost_1_44_0/boost/
boost_1_44_0/boost/accumulators/
boost_1_44_0/boost/accumulators/accumulators.hpp
boost_1_44_0/boost/accumulators/accumulators_fwd.hpp
-----

Given this, I'm somewhat surprised that no one else has said anything about this problem. Either the switch from "-" to "_" was recent, or I've done something unconventional...I have no idea what it may be since I've just followed the instructions in [*] (below).

I hope this helps and thanks so much for looking into it!

[*] http://www.boost.org/doc/libs/1_44_0/more/getting_started/unix-variants.html#the-boost-distribution [^]
(0022149)
Philip Lowman   
2010-09-08 22:32   
I understand what you mean now. Sorry for the confusion and thanks for reporting this.

Could you test the new version I've attached? I also fixed it so it finds libraries in lib/stage because it looks like we supported this at one point or another.

set(BOOST_ROOT /home/lowman/src)
set(Boost_DEBUG ON)
set(Boost_NO_SYSTEM_PATHS TRUE)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_STATIC_RUNTIME OFF)
set(Boost_ADDITIONAL_VERSIONS 1.44 1.44.0)
find_package(Boost)
# or with libraries...
#find_package(Boost REQUIRED system)
(0022158)
Raymond Wan   
2010-09-09 01:09   
Thanks! Yes, it all works -- both finding /usr/local/boost_1_44_0/ and finding the compiled Boost systems are ok.

There is still that STREQUAL warning, but that didn't prevent it from successful compilation.

Thanks a lot for fixing it and also for maintaining this module. From using several version of Boost, I know there are a lot of cases to worry about. This doesn't look like an easy module to maintain... Thank you!!
(0022159)
Raymond Wan   
2010-09-09 01:13   
Oh, and just in case you can't generate the same warning as me, I've copied some of the output below. It's now on line 835:

...
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:751 ] _boost_RELEASE_ABI_TAG = -
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:753 ] _boost_DEBUG_ABI_TAG = -d
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:814 ] _boost_LIBRARY_SEARCH_DIRS = /usr/local/boost_1_42_0/lib;/usr/local/boost_1_42_0/../lib;/usr/local/boost_1_42_0/stage/lib;/usr/local/lib;/usr/local/stage/lib
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:869 ] Searching for MPI_LIBRARY_RELEASE: boost_mpi-gcc44-mt-1_42;boost_mpi-mt-1_42;boost_mpi-mt;boost_mpi
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:891 ] Searching for MPI_LIBRARY_DEBUG: boost_mpi-gcc44-mt-d-1_42;boost_mpi-mt-d-1_42;boost_mpi-mt;boost_mpi
CMake Warning (dev) at /usr/share/cmake-2.8/Modules/FindBoost.cmake:835 (if):
  given arguments:

    "STREQUAL" "-"

  Unknown arguments specified
Call Stack (most recent call first):
  CMakeLists.txt:54 (FIND_PACKAGE)
This warning is for project developers. Use -Wno-dev to suppress it.

-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:869 ] Searching for PROGRAM_OPTIONS_LIBRARY_RELEASE: boost_program_options-gcc44-mt-1_42;boost_program_options-mt-1_42;boost_program_options-mt;boost_program_options
...
(0022160)
Philip Lowman   
2010-09-09 08:12   
Fixed that warning last night as well but I had forgotten which ticket it affected (I worked on like 8 FindBoost tickets last night).

The fix to eliminate the warning is in the version I just attached (along with fixes to two other issues) (FindBoost.cmake.7). I was clearing _boost_RELEASE_ABI_TAG in a loop and the second pass (if you used more than one Boost component) would do a STREQUAL on it but by then it would no longer expand to a string.

Thanks for the continued testing!
(0022178)
Raymond Wan   
2010-09-10 03:39   
No warnings and no errors -- all ok! :-)

Thanks a lot!
(0022201)
Philip Lowman   
2010-09-12 22:29   
Fix will be in CMake 2.8.3 RC1