MantisBT - CMake
View Issue Details
0013992CMake(No Category)public2013-03-08 17:142016-06-10 14:31
toby_toby_toby 
Kitware Robot 
normalminoralways
closedmoved 
CMake 2.8.10.2 
 
0013992: Source files with same name not building for VS 2010
Project has 2 files with the same name, but different directories.

VS2010 project unbuildable in that case.
1. configure and generate attached archive for VS2010


2. try build source.cpp - you should get this:
    badmake\subdirectory\source.cpp : fatal error C1083: Cannot open compiler generated file: 'project.dir\Debug\/subdirectory/source.cpp.obj': No such file or directory



3. now open generated vsproj in text editor and remove <ObjectFileName> from this:

<ItemGroup>
    <ClCompile Include="..\badmake\source.cpp" >
      <ObjectFileName>$(IntDir)/source.cpp.obj</ObjectFileName>
    </ClCompile>
    <ClCompile Include="..\badmake\subdirectory\source.cpp" >
      <ObjectFileName>$(IntDir)/subdirectory/source.cpp.obj</ObjectFileName>
    </ClCompile>
  </ItemGroup>

and you will get this

    <ClCompile Include="..\badmake\source.cpp" />
    <ClCompile Include="..\badmake\subdirectory\source.cpp" />




4. reload project is VS, it's buildable now!
No tags attached.
zip badmake.zip (738) 2013-03-08 17:14
https://public.kitware.com/Bug/file/4668/badmake.zip
zip badmake2.zip (67,252) 2013-03-11 11:34
https://public.kitware.com/Bug/file/4677/badmake2.zip
zip badmake3.zip (66,830) 2013-03-11 12:09
https://public.kitware.com/Bug/file/4678/badmake3.zip
Issue History
2013-03-08 17:14toby_toby_tobyNew Issue
2013-03-08 17:14toby_toby_tobyFile Added: badmake.zip
2013-03-08 17:23toby_toby_tobyNote Added: 0032541
2013-03-11 10:08Brad KingNote Added: 0032573
2013-03-11 11:34toby_toby_tobyFile Added: badmake2.zip
2013-03-11 11:35toby_toby_tobyNote Added: 0032576
2013-03-11 11:38toby_toby_tobyNote Edited: 0032576bug_revision_view_page.php?bugnote_id=32576#r1058
2013-03-11 11:38toby_toby_tobyNote Edited: 0032576bug_revision_view_page.php?bugnote_id=32576#r1059
2013-03-11 11:56Brad KingNote Added: 0032577
2013-03-11 12:09toby_toby_tobyFile Added: badmake3.zip
2013-03-11 12:10toby_toby_tobyNote Added: 0032579
2013-03-11 12:36Brad KingNote Added: 0032580
2013-03-11 12:42toby_toby_tobyNote Added: 0032581
2013-03-11 12:43toby_toby_tobyNote Edited: 0032581bug_revision_view_page.php?bugnote_id=32581#r1061
2013-03-11 13:07toby_toby_tobyNote Edited: 0032581bug_revision_view_page.php?bugnote_id=32581#r1062
2013-03-11 13:10toby_toby_tobyNote Edited: 0032581bug_revision_view_page.php?bugnote_id=32581#r1063
2013-03-11 14:07toby_toby_tobyNote Edited: 0032581bug_revision_view_page.php?bugnote_id=32581#r1064
2013-03-13 20:40Brad KingNote Added: 0032619
2013-03-14 07:03toby_toby_tobyNote Added: 0032627
2013-03-14 07:17toby_toby_tobyNote Added: 0032628
2013-03-14 07:23toby_toby_tobyNote Added: 0032629
2013-03-14 07:33toby_toby_tobyNote Edited: 0032628bug_revision_view_page.php?bugnote_id=32628#r1069
2013-03-14 10:07Brad KingNote Added: 0032630
2013-03-14 17:03toby_toby_tobyNote Added: 0032633
2013-03-14 17:03toby_toby_tobyNote Edited: 0032633bug_revision_view_page.php?bugnote_id=32633#r1071
2013-03-15 06:31toby_toby_tobyNote Added: 0032634
2013-03-15 08:07toby_toby_tobyNote Added: 0032635
2013-03-15 08:08toby_toby_tobyNote Edited: 0032635bug_revision_view_page.php?bugnote_id=32635#r1073
2016-06-10 14:28Kitware RobotNote Added: 0042244
2016-06-10 14:28Kitware RobotStatusnew => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:28Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0032541)
toby_toby_toby   
2013-03-08 17:23   
Also found out that if I create folder 'subdirectory' in 'project.dir\Debug', then VS would build fine.
(0032573)
Brad King   
2013-03-11 10:08   
I cannot reproduce this with VS 10 (2010) or 11 (2012) professional versions. The source tree extracted from "badmake.zip" builds without error.

What version are you using?
(0032576)
toby_toby_toby   
2013-03-11 11:35   
(edited on: 2013-03-11 11:38)
badmake.zip is working, my bad.

badmake2.zip IS BAD EXAMPLE ALSO, SORRY.

I'm making new example.

(0032577)
Brad King   
2013-03-11 11:56   
With badmake2.zip I get:

src\connection.cpp(1): fatal error C1083: Cannot open include file: 'common.hpp': No such file or directory

which is not related. If I change common.hpp to connection.hpp in both .cpp files then it builds.
(0032579)
toby_toby_toby   
2013-03-11 12:10   
Yes, error is unrelated.

Real error was lost in precess =)

Check out 3rd attempt.
(0032580)
Brad King   
2013-03-11 12:36   
Hmm. badmake3.zip also works for me. The build automatically creates the specified object output directory when needed.

Do you have VS 10 Express or a commercial version?
(0032581)
toby_toby_toby   
2013-03-11 12:42   
(edited on: 2013-03-11 14:07)
Express, installed 5 days ago. 10.0.30319.1
I will try different VS.

Edit: It will take some time to install new virtual machine for that...
Looks like problem in VS:

http://stackoverflow.com/questions/3729515/visual-studio-2010-2008-cant-handle-source-files-with-identical-names-in-diff [^]

Edit2: previous link just says that VS can't have files with same name, CMake solves this, but VS does not creates dirs for that... Strange.

Edit3: I can't install VS 2012, because I have Windows XP, so I can't check that today, maybe next days... Workaround: rename source files, includes work OK.

(0032619)
Brad King   
2013-03-13 20:40   
badmake3.zip works for me in VS 2010 Express too.

Microsoft Visual Studio 2010
Version 10.0.40219.1 SP1Rel
Microsoft .NET Framework
Version 4.5.50709 SP1Rel

Installed Version: VC Express

Microsoft Visual C++ 2010 01013-169-2610014-70153
Hotfix for Microsoft Visual C++ 2010 Express - ENU (KB2542054) KB2542054
Hotfix for Microsoft Visual C++ 2010 Express - ENU (KB2635973) KB2635973
Microsoft Visual C++ 2010 Express - ENU Service Pack 1 (KB983509)
(0032627)
toby_toby_toby   
2013-03-14 07:03   
Hotfixes didn't help, BUT.

Problem may be not in VS.

I installed VirtualBox, made XP virtual machine (same distro), installed only VS2010 and cmake, no windows update or anything.






Original badmake3\build errored:

------ Rebuild All started: Project: ZERO_CHECK, Configuration: Debug Win32 ------
  The system cannot find the path specified.
  Checking Build System
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(151,5): error MSB6006: "cmd.exe" exited with code 3.
------ Rebuild All started: Project: project, Configuration: Debug Win32 ------
  The system cannot find the path specified.
  Building Custom Rule C:/badmake3/src/project/CMakeLists.txt
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(151,5): error MSB6006: "cmd.exe" exited with code 3.
========== Rebuild All: 0 succeeded, 2 failed, 0 skipped ==========






But if I regenerate inside virtual machine, then build succeded:
------ Rebuild All started: Project: ZERO_CHECK, Configuration: Debug Win32 ------
  Checking Build System
  CMake does not need to re-run because C:/badmake3/build2/CMakeFiles/generate.stamp is up-to-date.
  CMake does not need to re-run because C:/badmake3/build2/project/CMakeFiles/generate.stamp is up-to-date.
------ Rebuild All started: Project: project, Configuration: Debug Win32 ------
  Building Custom Rule C:/badmake3/src/project/CMakeLists.txt
  CMake does not need to re-run because C:\badmake3\build2\project\CMakeFiles\generate.stamp is up-to-date.
  source.cpp
  source.cpp
  project.vcxproj -> C:\badmake3\build2\project\Debug\project.lib
========== Rebuild All: 2 succeeded, 0 failed, 0 skipped ==========


So, INSIDE virtual machine VS working good.

On my non-virtual XP I have same system (2 weeks old), no windows updates also.
No viruses, games, other versions of VS. Only MinGW, Python, Eclipse, CodeBlocks and drivers.

1) I will try to uninstall everything except VS, maybe some conflicts possible.
2) If it won't help, I will reinstall XP on another partition and will try clean VS.
(0032628)
toby_toby_toby   
2013-03-14 07:17   
(edited on: 2013-03-14 07:33)
And another fun part, inside virtual machine (VM).

Original 'badmake3\build' is not building, as I said in previous message, it happens if I rebuild 'project' or whole solution.



But if I click on single file 'source.cpp', then I got original error:

------ Build started: Project: project, Configuration: Debug Win32 ------
  source.cpp
C:\badmake3\src\project\src\source.cpp : fatal error C1083: Cannot open compiler generated file: 'project.dir\Debug\/src/source.cpp.obj': No such file or directory
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========




And there is no such problem in newly generated (inside VM) project:
------ Build started: Project: project, Configuration: Debug Win32 ------
  source.cpp
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========



I don't know, maybe it's normal for cmake that solution is not buildable if not generated on same PC. If you think this is strange - I can somehow send you image of this VM (it's 3Gig, but I can compress).

If it's normal, then Brad please tell me, and I will continue with (1) and (2) from previous post.

Edit: image compressed to 1Gig

(0032629)
toby_toby_toby   
2013-03-14 07:23   
Also if you are not interested in VM image then I will try:
3) install windows/vs updates on virtual machine
(0032630)
Brad King   
2013-03-14 10:07   
Re 0013992:0032628: CMake generates build systems meant only for use in the exact same build and source trees on the exact same machine on which it generates them.
(0032633)
toby_toby_toby   
2013-03-14 17:03   
Well, I will switch to another IDE/version...

PS: I understand that cmake must generate only for same environment and that "cmd" not found is expected, but failed compilation of single file with C1083 in one project and successful compilation in other project on the same vm is strange, maybe later I will look at this.

Thanks for help!

(0032634)
toby_toby_toby   
2013-03-15 06:31   
Installed Windows 8 trial (downloaded from Microsoft, reformatted drive, all updates) and VS 2012 express, same error.
Now I even don't have gcc, just clean PC.
I think this is related to visual studio express..
I will try non-express VS trial..
(0032635)
toby_toby_toby   
2013-03-15 08:07   
(edited on: 2013-03-15 08:08)
I FOUND IT, ATLEAST IN WINDOWS 8 (and for sure everywhere else).

Before single file becomes buildable, you need to click rebuild whole project, only this creates this directories.

Oh my IQ, it's good that I'm not showing my real name

(0042244)
Kitware Robot   
2016-06-10 14:28   
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.