View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0011204 | CMake | Modules | public | 2010-09-03 10:31 | 2010-11-09 22:57 | ||||
Reporter | Shane Dixon | ||||||||
Assigned To | Philip Lowman | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | fixed | ||||||
Platform | OS | OS Version | |||||||
Product Version | CMake-2-8 | ||||||||
Target Version | CMake 2.8.3 | Fixed in Version | CMake 2.8.3 | ||||||
Summary | 0011204: FindBoost.cmake has trouble discovering libraries when both -sgd and -gd libraries are available | ||||||||
Description | When specifying the Boost_USE_STATIC_LIBS to ON, the module won't find the -sgd libraries if the -gd libraries are present. I fixed this by switching the order that they're searched for, looking for the more specific library first before the more general one, which seems to have fixed the issue. | ||||||||
Additional Information | Here is what I wrote to the mailing list: I found that when using the FindBoost.cmake and using the Boost_USE_STATIC_LIBS option, it wouldn’t find the static libs in my C:\Boost\libs folder. It kept coming back with files ending in –gd libs instead of –sgd libs even though the option Boost_USE_STATIC_LIBS was set. I found that it had to do with the order that the FIND_LIBRARY looks for the files. I had BOTH the –gd and the –sgd libraries installed so it found the –gd ones first and then ignores the next option. I fixed it by applying the following: 728,729c728,729 < NAMES ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}-${_boost_ABI_TAG}-${Boost_LIB_VERSION} < ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG}-${Boost_LIB_VERSION} --- > NAMES ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG}-${Boost_LIB_VERSION} > ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}-${_boost_ABI_TAG}-${Boost_LIB_VERSION} I just switched the order to look for the more specific lib before the more general one. If ${_boost_STATIC_TAG} is empty when Boost_USE_STATIC_LIBS is OFF, then maybe this could just be one line: ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG}-${Boost_LIB_VERSION} Which seems like it should find either –sgd or –gd files, but sould find –sgd files first if the option was provided. Any thoughts? I defer to anyone with more experience for the best way to do this. -- Shane | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | FindBoost.cmake [^] (48,989 bytes) 2010-09-08 00:11 FindBoost.cmake.4 [^] (53,196 bytes) 2010-09-08 21:53 CMakeLists.txt [^] (619 bytes) 2010-09-08 21:54 [Show Content] with_static_runtime.txt [^] (4,365 bytes) 2010-09-08 21:54 [Show Content] without_static_runtime.txt [^] (4,374 bytes) 2010-09-08 21:54 [Show Content] undefined_static_runtime.txt [^] (4,481 bytes) 2010-09-08 21:54 [Show Content] | ||||||||
Relationships | |
Relationships |
Notes | |
(0022123) Philip Lowman (developer) 2010-09-08 00:10 edited on: 2010-09-08 00:15 |
The 's' implies that boost was compiled against a static runtime library which isn't exactly the same thing as what Boost_USE_STATIC_LIBS means. Boost_USE_STATIC_LIBS just means that the Boost library itself should be static, it shouldn't imply at all whether that library is built against a shared or static libc (although it apparantly does leading to the ambiguous behavior you've pointed out) Here's a quick MSVC9 example of the possible permutations: Release boost_regex_vc90-mt-1_44.lib (Multithreaded DLL w/Dynamic Runtime) libboost_regex_vc90-mt-1_44.lib (Multithreaded Static Library w/Dynamic Runtime) libboost_regex_vc90-mt-s-1_44.lib (Multithreaded Static Library w/Static Runtime) libboost_regex_vc90-s-1_44.lib (Singlethreaded Static Library w/Static Runtime) Debug: (The same as above except with "gd" which basically means "Debug") boost_regex_vc90-mt-gd-1_44.lib (Multithreaded Debug DLL w/Dynamic Debug Runtime) libboost_regex_vc90-mt-gd-1_44.lib (Multithreaded Static Debug Library w/Dynamic Debug Runtime) libboost_regex_vc90-mt-sgd-1_44.lib (Multithreaded Static Debug Library w/Static Debug Runtime) libboost_regex_vc90-sgd-1_44.lib (Singlethreaded Static Debug Library w/Static Debug Runtime) Currently the behavior when Boost_USE_STATIC_LIBS is enabled is (apparantly): 1. Search for a static library built against a dynamic runtime (use it if found) 2. Search for a static library built against a static runtime (use it if found) So here's what I've done. I've added a Boost_USE_STATIC_RUNTIME option which if enabled will search for Number 2 only. If it's not enabled, however, we will continue to search for Number 1 and then Number 2 for backwards compatibility (prevent breaking people's builds). I also added a Boost_COMPAT_STATIC_RUNTIME which you can define setting it to OFF which will disable the chained search and fix the ambiguity. Try it out and let me know if this works OK for you. I've rewritten a bunch of other stuff too so no guarantees. |
(0022137) Shane Dixon (reporter) 2010-09-08 10:59 |
Here is how I made the call: set (Boost_DETAILED_FAILURE_MSG ON) set (Boost_DEBUG ON) set (Boost_USE_STATIC_LIBS ON) set (Boost_USE_MULTITHREADED ON) set (Boost_USE_STATIC_RUNTIME ON) set (Boost_COMPAT_STATIC_RUNTIME OFF) find_package (Boost 1.44.0 COMPONENTS system REQUIRED) Here is what I get: [ C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:404 ] Boost not in cache [ C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:407 ] _boost_TEST_VERSIONS = 1.44.0;1.44 [ C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:409 ] Boost_USE_MULTITHREADED = ON [ C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:411 ] Boost_USE_STATIC_LIBS = ON [ C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:470 ] Declared as CMake or Environmental Variables: [ C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:472 ] BOOST_ROOT = [ C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:474 ] BOOST_INCLUDEDIR = [ C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:476 ] BOOST_LIBRARYDIR = [ C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:478 ] _boost_TEST_VERSIONS = 1.44.0;1.44 [ C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:527 ] Include debugging info: [ C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:529 ] _boost_INCLUDE_SEARCH_DIRS = C:/boost/include;C:/boost;C:\Program Files/boost/include;C:\Program Files/boost;/sw/local/include [ C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:531 ] _boost_PATH_SUFFIXES = boost-1_44_0;boost_1_44_0;boost-1_44;boost_1_44 [ C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:555 ] location of version.hpp: C:/Boost/include/boost-1_44/boost/version.hpp [ C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:574 ] version.hpp reveals boost 1.44.0 [ C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:665 ] guessed _boost_COMPILER = -vc90 [ C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:675 ] _boost_MULTITHREADED = -mt [ C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:718 ] _boost_RELEASE_ABI_TAG = -s [ C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:720 ] _boost_DEBUG_ABI_TAG = -sgd [ C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:772 ] _boost_LIBRARIES_SEARCH_DIRS = C:/Boost/include/boost-1_44/lib;C:/Boost/include/boost-1_44/../lib;C:/boost/lib;C:/boost;C:\Program Files/boost/boost_1_44_0/lib;C:\Program Files/boost/boost_1_44/lib;C:\Program Files/boost/lib;C:\Program Files/boost;/sw/local/lib [ C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:961 ] Boost_FOUND = FALSE CMake Error at C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:1041 (message): Unable to find the requested Boost libraries. Boost version: 1.44.0 Boost include path: C:/Boost/include/boost-1_44 The following Boost libraries could not be found: boost_system 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:95 (find_package) |
(0022148) Philip Lowman (developer) 2010-09-08 21:53 |
Shane, Attached is a new version that I've tested against the Boost 1.44 that comes distributed from BoostPro (against Visual Studio Express 9). I've also added some additional Debug output which should allow us to figure out what is going on if this doesn't work (and help in general with future users). FindBoost.cmake.4 <= Rename it to FindBoost.cmake CMakeLists.txt <= My test example with_static_runtime.txt <= output with static runtime explicitly enabled without_static_runtime.txt <= output with static runtime explicitly disabled undefined_static_runtime.txt <= default behavior (disabled but search both) If it doesn't give you the right results, please include the debug output again and a directory listing of your \boost\lib folders. |
(0022196) Philip Lowman (developer) 2010-09-12 22:28 |
Fix will be in CMake 2.8.3 RC1 |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2010-09-03 10:31 | Shane Dixon | New Issue | |
2010-09-07 23:58 | Philip Lowman | Status | new => assigned |
2010-09-07 23:58 | Philip Lowman | Assigned To | => Philip Lowman |
2010-09-08 00:10 | Philip Lowman | Note Added: 0022123 | |
2010-09-08 00:11 | Philip Lowman | File Added: FindBoost.cmake | |
2010-09-08 00:15 | Philip Lowman | Note Edited: 0022123 | |
2010-09-08 10:42 | Shane Dixon | Note Added: 0022136 | |
2010-09-08 10:54 | Shane Dixon | Note Deleted: 0022136 | |
2010-09-08 10:59 | Shane Dixon | Note Added: 0022137 | |
2010-09-08 21:53 | Philip Lowman | Note Added: 0022148 | |
2010-09-08 21:53 | Philip Lowman | File Added: FindBoost.cmake.4 | |
2010-09-08 21:54 | Philip Lowman | File Added: CMakeLists.txt | |
2010-09-08 21:54 | Philip Lowman | File Added: with_static_runtime.txt | |
2010-09-08 21:54 | Philip Lowman | File Added: without_static_runtime.txt | |
2010-09-08 21:54 | Philip Lowman | File Added: undefined_static_runtime.txt | |
2010-09-10 08:42 | Philip Lowman | ETA | none => < 1 day |
2010-09-10 08:42 | Philip Lowman | Target Version | => CMake 2.8.3 |
2010-09-12 22:28 | Philip Lowman | Note Added: 0022196 | |
2010-09-12 22:28 | Philip Lowman | Status | assigned => resolved |
2010-09-12 22:28 | Philip Lowman | Fixed in Version | => CMake 2.8.3 |
2010-09-12 22:28 | Philip Lowman | Resolution | open => fixed |
2010-11-09 22:57 | Philip Lowman | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |