MantisBT - CMake
View Issue Details
0006352CMakeCMakepublic2008-02-15 11:052016-06-10 14:30
Ken Cox 
Brad King 
normalminoralways
closedmoved 
 
 
0006352: after cmake fails creating DLL on windows, 2nd execution succeeds
I apologize for creating a duplicate of bug 6308, but I can find no way to comment on that issue, and it isn't clear to me that the nature of the bug has been made clear.

The first time you run cmake, it fails the .exp file specifies a function that does not exist. Yet it creates a .dll anyway and no .lib file. You stated in bug 6308 that it is not an error to create a .dll with no exports. That may well be true, but is orthogonal to this issue. This issue is that it is an error to try to create a dll with exports that are not defined. It appears cmake correctly fails, the first time. The issue is that the second time you run cmake, the .dll file exists and cmake does not attempt to build it again.

One possible fix is to have cmake remove the .dll when it detects that the .dll creation step failed. This is a common idiom in hand-coded makefiles when a target generates two files but depends on only one.
No tags attached.
zip bug6352.zip (3,279) 2008-02-15 12:22
https://public.kitware.com/Bug/file/1314/bug6352.zip
Issue History
2008-02-15 11:05Ken CoxNew Issue
2008-02-15 11:09Bill HoffmanNote Added: 0010515
2008-02-15 11:09Bill HoffmanStatusnew => assigned
2008-02-15 11:09Bill HoffmanAssigned To => Bill Hoffman
2008-02-15 12:22Ken CoxFile Added: bug6352.zip
2008-02-15 12:24Ken CoxNote Added: 0010520
2008-02-15 13:44Bill HoffmanNote Added: 0010522
2008-02-15 13:45Bill HoffmanAssigned ToBill Hoffman => Brad King
2012-08-13 10:37Brad KingStatusassigned => backlog
2012-08-13 10:37Brad KingNote Added: 0030543
2016-06-10 14:27Kitware RobotNote Added: 0041409
2016-06-10 14:27Kitware RobotStatusbacklog => resolved
2016-06-10 14:27Kitware RobotResolutionopen => moved
2016-06-10 14:30Kitware RobotStatusresolved => closed

Notes
(0010515)
Bill Hoffman   
2008-02-15 11:09   
Pleas provide a small example that shows this problem.
(0010520)
Ken Cox   
2008-02-15 12:24   
To use the attached example:
1. run repro.cmd to create the Makefile
2. run nmake; nmake correctly fails due to the link error LNK2001: unresolved external symbol function_2
3. run nmake; nmake now skips the dll step and fails later due to link error LNK1104: cannot open file 'lib1.lib'
(0010522)
Bill Hoffman   
2008-02-15 13:44   
OK, I reproduced:

1. build one:
Scanning dependencies of target lib1
[ 50%] Building C object src/lib1/CMakeFiles/lib1.dir/lib1.obj
lib1.c
Linking C shared library ..\..\lib\lib1.dll
lib1.def : error LNK2001: unresolved external symbol function_2
..\..\lib\lib1.lib : fatal error LNK1120: 1 unresolved externals

2. build two:
[ 50%] Built target lib1
Scanning dependencies of target app
[100%] Building CXX object src/app/CMakeFiles/app.dir/main.obj
main.cpp
Linking CXX executable ..\..\bin\app.exe
LINK : fatal error LNK1104: cannot open file 'lib1.lib'
NMAKE : fatal error U1077: 'C:\PROGRA~1\MID05A~1\VC\bin\cl.exe' : return code '0x2'

Also the VSIDE project keeps trying to build the dll each time.
(0030543)
Brad King   
2012-08-13 10:37   
Sending issues I'm not actively working on to the backlog to await someone with time for them.

If an issue you care about is sent to the backlog when you feel it should have been addressed in a different manner, please bring it up on the CMake mailing list for discussion. Sign up for the mailing list here, if you're not already on it:

 http://www.cmake.org/mailman/listinfo/cmake [^]

It's easy to re-activate a bug here if you can find a CMake developer or contributor who has the bandwidth to take it on.
(0041409)
Kitware Robot   
2016-06-10 14:27   
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.