View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0015678 | CMake | CMake | public | 2015-08-03 17:08 | 2016-01-04 11:52 | ||||
Reporter | Chris | ||||||||
Assigned To | |||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | won't fix | ||||||
Platform | Apple Mac | OS | OS X | OS Version | 10.10.4 | ||||
Product Version | CMake 3.3 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0015678: CMakeCache.txt can't be passed into cmake's -C flag | ||||||||
Description | I'm probably trying to be too clever, but I'm trying to setup a cmake build target for clang to do a "bootstrap" build where you build clang, then use the built clang to rebuild clang. I had this "genius" idea that I could try and pass through the CMake options used to configure the first clang using the CMakeCache.txt and the -C flag. It unfortunately doesn't work. I see the following errors: [2/5] Performing configure step for 'bootstrap' FAILED: cd /Users/cbieneman/dev/open-source/llvm-build-rel/tools/clang/bootstrap/src/bootstrap-build && /Users/cbieneman/dev/open-source/cmake-bins/bin/cmake -C /Users/cbieneman/dev/open-source/llvm-build-rel/CMakeCache.txt -DCMAKE_CXX_COMPILER=/Users/cbieneman/dev/open-source/llvm-build-rel/bin/clang++ -DCMAKE_CXX_COMPILER=/Users/cbieneman/dev/open-source/llvm-build-rel/bin/clang "-GSublime Text 2 - Ninja" /Users/cbieneman/dev/open-source/llvm && /Users/cbieneman/dev/open-source/cmake-bins/bin/cmake -E touch /Users/cbieneman/dev/open-source/llvm-build-rel/tools/clang/bootstrap/src/bootstrap-stamp/bootstrap-configure loading initial cache file /Users/cbieneman/dev/open-source/llvm-build-rel/CMakeCache.txt CMake Error: Error in cmake code at /Users/cbieneman/dev/open-source/llvm-build-rel/CMakeCache.txt:17: Parse error. Expected a command name, got unquoted argument with text "//Default". CMake Error: Error processing file: /Users/cbieneman/dev/open-source/llvm-build-rel/CMakeCache.txt | ||||||||
Steps To Reproduce | Apply the diffs below to clang, and configure with CMake setting -DCLANG_ENABLE_BOOTSTRAP=On, and run <buildtool> bootstrap. | ||||||||
Additional Information | diff --git a/CMakeLists.txt b/CMakeLists.txt index ab70f1d..6974b6e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,6 +96,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR ) option(LLVM_FORCE_USE_OLD_HOST_TOOLCHAIN "Set to ON to force using an old, unsupported host toolchain." OFF) + option(CLANG_ENABLE_BOOTSTRAP "Generate the clang bootstrap target" OFF) include(AddLLVM) include(TableGen) @@ -551,3 +552,31 @@ if (CLANG_BUILT_STANDALONE) ${CLANG_BINARY_DIR}/share/clang/cmake/ClangConfig.cmake COPYONLY) endif () + +if (CLANG_ENABLE_BOOTSTRAP) + include(ExternalProject) + + ExternalProject_Add(bootstrap + DEPENDS clang + PREFIX bootstrap + SOURCE_DIR ${CMAKE_SOURCE_DIR} + CMAKE_ARGS -C ${CMAKE_BINARY_DIR}/CMakeCache.txt + ${CLANG_BOOTSTRAP_CMAKE_ARGS} + -DCMAKE_CXX_COMPILER=${CMAKE_BINARY_DIR}/bin/clang++ + -DCMAKE_CXX_COMPILER=${CMAKE_BINARY_DIR}/bin/clang + STEP_TARGETS configure build + ) + + ExternalProject_Add_Step(bootstrap force-reconfigure + DEPENDERS configure + ALWAYS 1 + ) + + ExternalProject_Add_Step(bootstrap clobber + COMMAND ${CMAKE_COMMAND} -E remove_directory <BINARY_DIR> + COMMAND ${CMAKE_COMMAND} -E make_directory <BINARY_DIR> + COMMENT "Clobberring compiler-rt build directory..." + DEPENDERS configure + DEPENDS ${LLVM_RUNTIME_OUTPUT_INTDIR}/bootstrap + ) +endif() | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | |
Relationships |
Notes | |
(0039225) Brad King (manager) 2015-08-04 08:50 |
The -C option is not intended to load a CMakeCache.txt file. From the docs: http://www.cmake.org/cmake/help/v3.3/manual/cmake.1.html [^] -C ... "The given file should be a CMake script containing SET commands that use the CACHE option, not a cache-format file." CMakeCache.txt stores much more than just user-selected options and is not appropriate for loading into another build tree. You could investigate other mechanisms for sharing the settings, like having the bootstrapping build write out a .cmake file for later use with -C to propagate the relevant settings. |
(0039228) Chris (reporter) 2015-08-04 12:11 |
Ok. Thanks for the information. Is there any way to get the list of arguments set via the command line without anything else? I know get_cmake_property can be used to get the cached variables, but as you point out that includes more than just the user-selected options. |
(0039229) Brad King (manager) 2015-08-04 12:56 |
Re 0015678:0039228: No access to the command line is available because after the first configuration then re-configuration can occur with no command since everything is cached. Also cmake-gui and ccmake allow options to be customized without a command-line. |
(0040105) Robert Maynard (manager) 2016-01-04 11:52 |
Closing resolved issues that have not been updated in more than 4 months. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2015-08-03 17:08 | Chris | New Issue | |
2015-08-04 08:50 | Brad King | Note Added: 0039225 | |
2015-08-04 08:50 | Brad King | Status | new => resolved |
2015-08-04 08:50 | Brad King | Resolution | open => won't fix |
2015-08-04 12:11 | Chris | Note Added: 0039228 | |
2015-08-04 12:56 | Brad King | Note Added: 0039229 | |
2016-01-04 11:52 | Robert Maynard | Note Added: 0040105 | |
2016-01-04 11:52 | Robert Maynard | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |