MantisBT - CMake
View Issue Details
0009511CMakeModulespublic2009-09-09 11:312016-06-10 14:30
dataangel 
Philip Lowman 
normalminoralways
closedmoved 
CMake-2-6 
 
0009511: FindBoost.cmake won't work with static linking boost_thread on Solaris
Any compiles will fail at the link stage, complaining about missing symbols provided by the "implicit dependency librt.so". When dynamically linking, boost_thread will have been compiled to dynamically link against librt already. But when statically linking, you have to also pull in the dependencies of the library you're statically linking against, and on Solaris boost_thread needs librt.

Basically, FindBoost should have a simple platform check, if Boost_USE_STATIC_LIBS is true, and boost_thread is a requested component, try to compile a test program that just creates a boost thread. If the compile fails, try adding -lrt, and see if that works. If so, add that to the libraries to link.
No tags attached.
? FindBoost.cmake (52,930) 2011-06-10 00:59
https://public.kitware.com/Bug/file/3927/*
Issue History
2009-09-09 11:32dataangelNew Issue
2009-09-11 17:19Bill HoffmanStatusnew => assigned
2009-09-11 17:19Bill HoffmanAssigned To => Douglas Gregor
2010-05-09 04:50Alex NeundorfCategoryCMake => Modules
2010-09-10 23:50Philip LowmanAssigned ToDouglas Gregor => Philip Lowman
2011-06-10 00:59Philip LowmanNote Added: 0026814
2011-06-10 00:59Philip LowmanFile Added: FindBoost.cmake
2011-06-15 09:06Philip LowmanSeveritymajor => minor
2012-10-04 01:49Philip LowmanNote Added: 0031174
2012-10-04 01:49Philip LowmanStatusassigned => backlog
2016-06-10 14:27Kitware RobotNote Added: 0041591
2016-06-10 14:27Kitware RobotStatusbacklog => resolved
2016-06-10 14:27Kitware RobotResolutionopen => moved
2016-06-10 14:30Kitware RobotStatusresolved => closed

Notes
(0026814)
Philip Lowman   
2011-06-10 00:59   
Hi, I'm considering a fix for issue 0010692 and I'm wondering if I can get some testing on resolving this bug on Solaris..

The attached FindBoost.cmake (beta) contains the following function... Can you insert the code necessary to make this work on Solaris and test it? Rather than performing a test compilation/linking, would it be OK just to perform a find_library call on librt and also link against that? So long as this library is used during both a static & shared link this seems safe.

You might be able to use CMAKE_SYSTEM_NAME...
E.g.
if(CMAKE_SYSTEM_NAME STREQUAL "Solaris") (not sure on the "Solaris" part)
  perform find_library() search for library
  if found add to list after pthread...
endif()


function(_Boost_consider_adding_pthreads _outvar)
  # On Unix platforms (excluding cygwin) add pthreads to Boost_LIBRARIES
  # if the user is searching for the boost-thread component.
  if(UNIX AND NOT CYGWIN)
    list(FIND Boost_FIND_COMPONENTS thread _using_boost_thread)
    if(_using_boost_thread GREATER -1)
      find_library(BOOST_THREAD_LIBRARY NAMES pthread
                   DOC "The threading library used by boost-thread"
      )
      if(BOOST_THREAD_LIBRARY)
        set(${_outvar} ${ARGN} ${BOOST_THREAD_LIBRARY} PARENT_SCOPE)
      endif()
    endif()
  endif()
endfunction()
(0031174)
Philip Lowman   
2012-10-04 01:49   
Don't have time to work on this issue although I'd consider merging a patch if someone developed one, although I wouldn't really be able to do any testing on it.
(0041591)
Kitware Robot   
2016-06-10 14:27   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.