View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0015547 | CMake | CMake | public | 2015-04-29 19:45 | 2016-06-10 14:31 | ||||
Reporter | Daniel Schepler | ||||||||
Assigned To | Kitware Robot | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | moved | ||||||
Platform | Debian | OS | Linux | OS Version | stretch | ||||
Product Version | CMake 3.2.2 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0015547: Changing CMAKE_AR isn't reflected on regenerating build system | ||||||||
Description | In our project, I ran into an issue that switching from non-LTO mode to LTO mode by adding -flto to CMAKE_C_FLAGS_RELEASE, and updating CMAKE_AR and CMAKE_RANLIB to the gcc lto wrappers, isn't successful. On running "make VERBOSE=1", it appears that the Makefiles are still running /usr/bin/ar to generate the intermediate static libraries. | ||||||||
Steps To Reproduce | dschepler@deb-dschepler:~/scalable-dev/cmake-flto$ tail -n +1 * ==> a.c <== int a(int n) { return n*n + 3; } ==> CMakeLists.txt <== cmake_minimum_required(VERSION 3.2) project(flto) add_library(a STATIC a.c) add_executable(main main.c) target_link_libraries(main a) ==> main.c <== #include <stdio.h> int a(int n); int main() { printf("a(5) = %d\n", a(5)); return 0; } dschepler@deb-dschepler:~/scalable-dev/cmake-flto$ mkdir build; cd build dschepler@deb-dschepler:~/scalable-dev/cmake-flto/build$ CC=gcc-5 cmake -DCMAKE_BUILD_TYPE:STRING=Release .. -- The C compiler identification is GNU 5.1.1 -- The CXX compiler identification is GNU 4.9.2 -- Check for working C compiler: /usr/bin/gcc-5 -- Check for working C compiler: /usr/bin/gcc-5 -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: /home/dschepler/scalable-dev/cmake-flto/build dschepler@deb-dschepler:~/scalable-dev/cmake-flto/build$ make Scanning dependencies of target a [ 50%] Building C object CMakeFiles/a.dir/a.c.o Linking C static library liba.a [ 50%] Built target a Scanning dependencies of target main [100%] Building C object CMakeFiles/main.dir/main.c.o Linking C executable main [100%] Built target main dschepler@deb-dschepler:~/scalable-dev/cmake-flto/build$ cmake -DCMAKE_AR:PATH=/usr/bin/gcc-ar-5 -DCMAKE_RANLIB:PATH=/usr/bin/gcc-ranlib-5 -DCMAKE_C_FLAGS_RELEASE:STRING="-O3 -DNDEBUG -flto" . -- Configuring done -- Generating done -- Build files have been written to: /home/dschepler/scalable-dev/cmake-flto/build dschepler@deb-dschepler:~/scalable-dev/cmake-flto/build$ make [ 50%] Building C object CMakeFiles/a.dir/a.c.o Linking C static library liba.a BFD: CMakeFiles/a.dir/a.c.o: plugin needed to handle lto object BFD: a.c.o: plugin needed to handle lto object [ 50%] Built target a [100%] Building C object CMakeFiles/main.dir/main.c.o Linking C executable main /tmp/cc9dAt8D.ltrans0.ltrans.o: In function `main': <artificial>:(.text.startup+0xa): undefined reference to `a' collect2: error: ld returned 1 exit status CMakeFiles/main.dir/build.make:86: recipe for target 'main' failed make[2]: *** [main] Error 1 CMakeFiles/Makefile2:95: recipe for target 'CMakeFiles/main.dir/all' failed make[1]: *** [CMakeFiles/main.dir/all] Error 2 Makefile:75: recipe for target 'all' failed make: *** [all] Error 2 | ||||||||
Additional Information | If the first configure includes the CMAKE_AR and CMAKE_RANLIB settings, then the build goes through successfully, and "make VERBOSE=1" shows about what I'd expect. It would be somewhat inconvenient to require completely wiping out the build directory to do the switch, though, as that would lose any other cache settings. | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | |
Relationships |
Notes | |
(0038654) Brad King (manager) 2015-04-30 09:46 |
CMAKE_AR is actually stored in "CMakeFiles/${version}/CMake${lang}Compiler.cmake" and is merely initialized by the cache entry of the same name. Some refactoring would be needed to make it changeable later. |
(0042769) Kitware Robot (administrator) 2016-06-10 14:29 |
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. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2015-04-29 19:45 | Daniel Schepler | New Issue | |
2015-04-30 09:46 | Brad King | Note Added: 0038654 | |
2016-06-10 14:29 | Kitware Robot | Note Added: 0042769 | |
2016-06-10 14:29 | Kitware Robot | Status | new => resolved |
2016-06-10 14:29 | Kitware Robot | Resolution | open => moved |
2016-06-10 14:29 | Kitware Robot | Assigned To | => Kitware Robot |
2016-06-10 14:31 | Kitware Robot | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |