MantisBT - CMake  | ||||||||||||||||||||
| View Issue Details | ||||||||||||||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | |||||||||||||||
| 0014066 | CMake | CMake | public | 2013-04-08 16:19 | 2016-01-26 10:02 | |||||||||||||||
| Reporter | Alexandru Ciobanu | |||||||||||||||||||
| Assigned To | Brad King | |||||||||||||||||||
| Priority | normal | Severity | minor | Reproducibility | always | |||||||||||||||
| Status | closed | Resolution | fixed | |||||||||||||||||
| Platform | OS | Linux | OS Version | |||||||||||||||||
| Product Version | CMake 2.8.10.2 | |||||||||||||||||||
| Target Version | CMake 3.2 | Fixed in Version | CMake 3.2 | |||||||||||||||||
| Summary | 0014066: Provided CMAKE_*_LINKER_FLAGS ignored during configuration step | |||||||||||||||||||
| Description | It seems that if one provides -DCMAKE_C_FLAGS to cmake, these flags are used during the try-compile steps as part of configuration step, while the provided linker flags like CMAKE_EXE_LINKER_FLAGS are ignored during the try-compile steps. Interestingly, providing the flags via LDFLAGS environment variable, works. Using the attached tiny repro case: 1. cd build 2. CC=clang cmake -DCMAKE_C_FLAGS="-fsanitize=thread -fPIE" -DCMAKE_EXE_LINKER_FLAGS="-pie" .. results in the following error (full error log is attached): The C compiler "clang" is not able to compile a simple test program. [...] /home/builder/rogue_nightly_build/build_utils/llvm/llvm-relass-install/bin/clang -fsanitize=thread -fPIE CMakeFiles/cmTryCompileExec998602180.dir/testCCompiler.c.o -o cmTryCompileExec998602180 -rdynamic clang-3: error: invalid argument '-fsanitize=thread' only allowed with '-pie' [...] Alternatively, if one uses LDFLAGS for the same purpose, there is no error: 1. cd build 2. LDFLAGS="-pie" CC=clang cmake -DCMAKE_C_FLAGS="-fsanitize=thread -fPIE" .. results in a successful configuration. We found this case because we use clang's ThreadSanitizer, which is a tool that detects race condition with threads and has the following requirement: - compiler should use -fsanitize=thread -fPIE - linker should use -fsanitize=thread -pie  | |||||||||||||||||||
| Steps To Reproduce | ||||||||||||||||||||
| Additional Information |   1. cd build 2. CC=clang cmake -DCMAKE_C_FLAGS="-fsanitize=thread -fPIE" -DCMAKE_EXE_LINKER_FLAGS="-pie" ..  | |||||||||||||||||||
| Tags | No tags attached. | |||||||||||||||||||
| Relationships | 
  | |||||||||||||||||||
| Attached Files | https://public.kitware.com/Bug/file/4717/cmake.link.flags.repro.tar.gz https://public.kitware.com/Bug/file/4718/full.error.log  | |||||||||||||||||||
| Issue History | ||||||||||||||||||||
| Date Modified | Username | Field | Change | |||||||||||||||||
| 2013-04-08 16:19 | Alexandru Ciobanu | New Issue | ||||||||||||||||||
| 2013-04-08 16:19 | Alexandru Ciobanu | File Added: cmake.link.flags.repro.tar.gz | ||||||||||||||||||
| 2013-04-08 16:20 | Alexandru Ciobanu | File Added: full.error.log | ||||||||||||||||||
| 2013-04-08 16:47 | Brad King | Note Added: 0032782 | ||||||||||||||||||
| 2013-04-08 16:47 | Brad King | Status | new => backlog | |||||||||||||||||
| 2014-11-25 09:46 | Brad King | Note Added: 0037278 | ||||||||||||||||||
| 2014-11-25 09:46 | Brad King | Relationship added | has duplicate 0015264 | |||||||||||||||||
| 2014-11-25 09:50 | Brad King | Note Added: 0037279 | ||||||||||||||||||
| 2014-11-26 06:25 | Evgeniy Stepanov | Note Added: 0037290 | ||||||||||||||||||
| 2014-11-26 09:48 | Brad King | Note Added: 0037294 | ||||||||||||||||||
| 2014-12-01 08:36 | Brad King | Relationship added | related to 0015235 | |||||||||||||||||
| 2014-12-04 10:56 | Brad King | Assigned To | => Brad King | |||||||||||||||||
| 2014-12-04 10:56 | Brad King | Status | backlog => assigned | |||||||||||||||||
| 2014-12-04 10:56 | Brad King | Target Version | => CMake 3.2 | |||||||||||||||||
| 2014-12-04 10:57 | Brad King | Note Added: 0037379 | ||||||||||||||||||
| 2014-12-08 08:57 | Brad King | Status | assigned => resolved | |||||||||||||||||
| 2014-12-08 08:57 | Brad King | Resolution | open => fixed | |||||||||||||||||
| 2014-12-08 08:57 | Brad King | Fixed in Version | => CMake 3.2 | |||||||||||||||||
| 2014-12-09 10:53 | Brad King | Note Added: 0037426 | ||||||||||||||||||
| 2015-01-19 19:22 | Laurent Demailly | Note Added: 0037753 | ||||||||||||||||||
| 2015-03-18 10:01 | Alexander Frolov | Note Added: 0038235 | ||||||||||||||||||
| 2015-03-18 10:08 | Alexander Frolov | Note Deleted: 0038235 | ||||||||||||||||||
| 2015-11-02 09:13 | Robert Maynard | Note Added: 0039735 | ||||||||||||||||||
| 2015-11-02 09:13 | Robert Maynard | Status | resolved => closed | |||||||||||||||||
| 2016-01-26 10:02 | Brad King | Relationship added | related to 0015934 | |||||||||||||||||
| Notes | |||||
| 
		 | 
|||||
		
  | 
	
		
  | 
||||
| 
		 | 
|||||
		
  | 
	
		
  | 
||||
| 
		 | 
|||||
		
  | 
	
		
  | 
||||
| 
		 | 
|||||
		
  | 
	
		
  | 
||||
| 
		 | 
|||||
		
  | 
	
		
  | 
||||
| 
		 | 
|||||
		
  | 
	
		
  | 
||||
| 
		 | 
|||||
		
  | 
	
		
  | 
||||
| 
		 | 
|||||
		
  | 
	
		
  | 
||||
| 
		 | 
|||||
		
  | 
	
		
  | 
||||