Illegal boost_timer COMPONENT?

Asked by Nico Schlömer

In dolfin/CMakeLists.txt, we find

# Boost timer was not a separate Boost component until version 1.48
if ("${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}" VERSION_GREATER "1.47")
  find_package(Boost 1.36 COMPONENTS timer REQUIRED)
endif()

This creates the configure error

================== *snip* ==================
-- Found the following Boost libraries:
-- filesystem
-- program_options
-- system
-- thread
-- iostreams
-- math_tr1
-- mpi
-- serialization
CMake Error at /usr/share/cmake-2.8/Modules/FindBoost.cmake:1194 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.49.0

  Boost include path: /usr/include

  The following Boost libraries could not be found:

          boost_timer

  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.
================== *snip* ==================

for me although I have Boost 1.49.0 with timer installed (default Ubuntu 12.10).

boost_timer is a header-only component of Boost, and /usr/share/cmake-2.8/Modules/FindBoost.cmake I take:

# The components list needs to contain actual names of boost libraries only,
# such as "date_time" for "libboost_date_time". If you're using parts of
# Boost that contain header files only (e.g. foreach) you do not need to
# specify COMPONENTS.

This is with CMake 2.8.9.

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Nico Schlömer
Solved:
Last query:
Last reply:
Revision history for this message
Nico Schlömer (nschloe) said :
#1

And indeed, Dolfin compiles perfectly fine without

# Boost timer was not a separate Boost component until version 1.48
if ("${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}" VERSION_GREATER "1.47")
  find_package(Boost 1.36 COMPONENTS timer REQUIRED)
endif()

Revision history for this message
Anders Logg (logg) said :
#2

We use boost::timer only on Windows (see dolfin/common/timing.cpp) so
that's the only place we need it. So that test could be refined.

I think Johannes can have closer look at this.

--
Anders

On Sat, Oct 06, 2012 at 05:20:55PM -0000, Nico Schlömer wrote:
> Question #210535 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/210535
>
> Nico Schlömer gave more information on the question:
> And indeed, Dolfin compiles perfectly fine without
>
> # Boost timer was not a separate Boost component until version 1.48
> if ("${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}" VERSION_GREATER "1.47")
> find_package(Boost 1.36 COMPONENTS timer REQUIRED)
> endif()
>

Revision history for this message
Johannes Ring (johannr) said :
#3

Garth added the boost_timer component in revision 6853 and I made some modifications in 6854 to make it work with older versions of Boost (< 1.48, when boost::timer was header only). If boost::timer is used only on Windows, I can modify the test for that.

@Nico: To me, boost::timer does not look to be header only. On Ubuntu 12.10 I have:

$ dpkg -L libboost-timer1.49-dev
/.
/usr
/usr/lib
/usr/lib/libboost_timer.a
/usr/share
/usr/share/doc
/usr/share/doc/libboost-timer1.49-dev
/usr/share/doc/libboost-timer1.49-dev/copyright
/usr/lib/libboost_timer-mt.a
/usr/lib/libboost_timer.so
/usr/lib/libboost_timer-mt.so
/usr/share/doc/libboost-timer1.49-dev/NEWS.Debian.gz
/usr/share/doc/libboost-timer1.49-dev/README.Debian.gz
/usr/share/doc/libboost-timer1.49-dev/changelog.Debian.gz

Revision history for this message
Nico Schlömer (nschloe) said :
#4

Now that's funny. I get

$ ls /usr/lib/libboost_timer*
ls: cannot access /usr/lib/libboost_timer*: No such file or directory

This will be the reason why cmake bails out for me and for you runs fine.
Ignoring whatever the reason for this could be, enabling timer for Windows only would get this problem off our backs for now.

Revision history for this message
Johannes Ring (johannr) said :
#5

Have you installed the package libboost-timer-dev?

Revision history for this message
Johannes Ring (johannr) said :
#6

The test for Boost timer is now only activated on Windows.

Revision history for this message
Nico Schlömer (nschloe) said :
#7

I didn't have libboost-timer-dev installed, only libboost-dev.
libboost-timer-dev indeed pulls in the timer libraries which do away with the configure error. Removing timer from the Unix build will avoid people stumbling into the same issue though. Thanks!

Revision history for this message
Johannes Ring (johannr) said :
#8

libboost-dev is not enough. In Dorsal we assume that libboost-{filesystem,iostreams,mpi,program-options,thread,math}-dev is installed and libboost-timer-dev was missing from that list (but is no longer needed). Installing libboost-all-dev should give you everything.