View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015457CMake(No Category)public2015-03-18 14:372015-11-02 09:13
ReporterReid Kleckner 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusclosedResolutionno change required 
PlatformOSWindowsOS Version7
Product VersionCMake 3.2.1 
Target VersionFixed in Version 
Summary0015457: ninja generator relinks all executables after incremental build in LLVM due to extra .lib output file
DescriptionOld versions of cmake would generate this ninja target:
build bin\opt.exe: CXX_EXECUTABLE_LINKER ...

Recent versions (3.2+) generate this target:
build bin\opt.exe lib\opt.lib: CXX_EXECUTABLE_LINKER_RSP_FILE

Since this is an executable, no .lib file should be generated, right? Why does the linker build rule even list the /implib flag? Maybe this is some functionality I'm unaware of, but so far as I can tell it is extraneous.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0038240)
Reid Kleckner (reporter)
2015-03-18 14:48

Locally reverting ef42e57d470db499a41c8bca695391c3e3e5cb86 fixes my problem, FWIW.
(0038241)
Brad King (manager)
2015-03-18 15:07

Commit ef42e57d4 switched to using proper ninja build rule syntax for rules with multiple outputs. The import library is added for DLLs but also for executables with the ENABLE_EXPORTS property set. See use of cmTarget::HasImportLibrary:

 http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmNinjaNormalTargetGenerator.cxx;hb=v3.2.1#l532 [^]
 http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmTarget.cxx;hb=v3.2.1#l585 [^]

Executable targets may set ENABLE_EXPORTS in order to really dllexport some symbols and provide an import library that plugins can link.

In llvm:

$ git grep ENABLE_EXPORTS -- tools
tools/bugpoint/CMakeLists.txt:set_target_properties(bugpoint PROPERTIES ENABLE_EXPORTS 1)
tools/llc/CMakeLists.txt:set_target_properties(llc PROPERTIES ENABLE_EXPORTS 1)
tools/lli/CMakeLists.txt:set_target_properties(lli PROPERTIES ENABLE_EXPORTS 1)
tools/llvm-stress/CMakeLists.txt:set_target_properties(llvm-stress PROPERTIES ENABLE_EXPORTS 1)
tools/opt/CMakeLists.txt:set_target_properties(opt PROPERTIES ENABLE_EXPORTS 1)
(0038244)
Reid Kleckner (reporter)
2015-03-18 15:38

Huh, seems reasonable, but it seems like the linker command isn't generating any .lib anywhere.
(0038245)
Brad King (manager)
2015-03-18 15:45

Re 0015457:0038244: In order to produce the .lib then some of the executable's object files must have dllexport markup or a module definition file (.def) must be among the sources. It is the project's responsibility to do this or to not set ENABLE_EXPORTS (at least on Windows).
(0038246)
Reid Kleckner (reporter)
2015-03-18 15:51

Sounds right. I have a feeling this stuff was hacked up to work with binutils ld –-export-all-symbols, and not MSVC. We can fix this in LLVM then.
(0038247)
Brad King (manager)
2015-03-18 15:56

Okay, thanks.
(0039737)
Robert Maynard (manager)
2015-11-02 09:13

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2015-03-18 14:37 Reid Kleckner New Issue
2015-03-18 14:48 Reid Kleckner Note Added: 0038240
2015-03-18 15:01 Brad King Assigned To => Brad King
2015-03-18 15:01 Brad King Status new => assigned
2015-03-18 15:01 Brad King Target Version => CMake 3.3
2015-03-18 15:07 Brad King Note Added: 0038241
2015-03-18 15:38 Reid Kleckner Note Added: 0038244
2015-03-18 15:45 Brad King Note Added: 0038245
2015-03-18 15:51 Reid Kleckner Note Added: 0038246
2015-03-18 15:56 Brad King Note Added: 0038247
2015-03-18 15:56 Brad King Status assigned => resolved
2015-03-18 15:56 Brad King Resolution open => no change required
2015-03-18 15:56 Brad King Target Version CMake 3.3 =>
2015-11-02 09:13 Robert Maynard Note Added: 0039737
2015-11-02 09:13 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team