MantisBT - CMake | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0015775 | CMake | CMake | public | 2015-10-07 18:34 | 2016-03-07 09:12 |
Reporter | James Johnston | ||||
Assigned To | James Johnston | ||||
Priority | normal | Severity | text | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | Windows | OS | OS Version | ||
Product Version | CMake 3.4 | ||||
Target Version | CMake 3.4 | Fixed in Version | CMake 3.4 | ||
Summary | 0015775: Document that SHARED libraries must export at least one symbol | ||||
Description | This is very similar to the issue reported by Nils Gladitz: 0015666: Ninja may unnecessarily relink on windows http://public.kitware.com/Bug/view.php?id=15666 [^] However, my test case does not work on CMake 3.4.0-rc1 either. In this situation, the issue arises when the library exports no symbols. My test case is almost identical to the one from Nils, except notice that test.cpp is now a blank file: I don't export any symbols. If the project does not export any symbols, the linker *will not emit a LIB file at all.* It initially sounds non-sensical, but not exporting any symbols is not as uncommon as one might think; some examples: * It is common that a .NET C++/CLR project will not export unmanaged symbols, as it is exporting directly through the DLL (i.e. no LIB file). * A DLL being used for the purpose of storing Win32 resources would not export any symbols. * Some 3rd-party libraries (e.g. FLANN) happily seem to link an empty library... | ||||
Steps To Reproduce | My test case, as you can see it's basically the same as Nils in 0015666 except no symbols: CMakeLists.txt -------------- # Using CMake 3.4.0-rc1 here: cmake_minimum_required(VERSION 3.4) project(Foo CXX) if(NOT EXISTS test.cpp) # Unlike Nils, I emit no symbols at all here: file(WRITE test.cpp "") endif() add_custom_target(touch COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_SOURCE_DIR}/test.cpp ) add_library(foo SHARED test.cpp) Procedure: ---------- 1. Configure with Ninja from a Visual C++ 2008 command prompt. (Other VC++ versions will likely exhibit the same issue). 2. ninja # builds as expected 3. ninja # continues to build 4. ninja -d explain ninja explain: output foo.lib doesn't exist ninja explain: foo.dll is dirty [1/1] Linking CXX shared library foo.dll | ||||
Additional Information | |||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | |||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2015-10-07 18:34 | James Johnston | New Issue | |||
2015-10-08 02:53 | Nils Gladitz | Note Added: 0039530 | |||
2015-10-08 10:44 | Brad King | Note Added: 0039537 | |||
2015-10-08 12:49 | James Johnston | Note Added: 0039542 | |||
2015-10-08 13:03 | Brad King | Note Added: 0039543 | |||
2015-10-08 13:20 | James Johnston | Note Added: 0039545 | |||
2015-10-08 13:30 | Brad King | Assigned To | => James Johnston | ||
2015-10-08 13:30 | Brad King | Severity | minor => text | ||
2015-10-08 13:30 | Brad King | Status | new => assigned | ||
2015-10-08 13:30 | Brad King | Summary | Ninja will unnecessarily relink on windows if a library exports no symbols => Document that SHARED libraries must export at least one symbol | ||
2015-10-08 13:59 | Brad King | Note Added: 0039546 | |||
2015-10-08 13:59 | Brad King | Note Added: 0039547 | |||
2015-10-08 13:59 | Brad King | Status | assigned => resolved | ||
2015-10-08 13:59 | Brad King | Resolution | open => fixed | ||
2015-10-08 13:59 | Brad King | Fixed in Version | => CMake 3.4 | ||
2015-10-08 13:59 | Brad King | Target Version | => CMake 3.4 | ||
2016-03-07 09:12 | Robert Maynard | Note Added: 0040609 | |||
2016-03-07 09:12 | Robert Maynard | Status | resolved => closed |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|