<div dir="ltr"><div><div><div><div><div>From my own experience this is what I think happens when building the whole solution through Visual Studio's UI. This also happens for building individual projects. I assume something similar happens when building via the command-line, but I rarely do that, so I can't be certain.<br><br></div><div>1) Visual Studio/MSBuild (I don't know which, but probably MSBuild) determines the dependency graph of the projects that are to be built.<br></div>2) The "ZeroCheck" project runs and cmake is rerun if any of the CMakeLists.txt files have been updated.<br></div>3) The build continues for each of the projects, using the dependency graph from 1). If the projects from 1) were updated due to 2) then the updated projects will be built in the updated way (e.g. new files will be included in that build).<br></div>4) Since any new projects created by re-running cmake in 2) were not in the dependency graph in 1), projects that now rely on them will likely get link errors.<br><br></div>There are two solutions I've used in my development: 1) always run cmake explicitly after doing an svn/git fetch before building or 2) build twice. The second build is usually a lot faster, so it doesn't really matter.<br><br></div>James<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 16 May 2018 at 22:07, Martin J. O'Riordan via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">With VS2013 I found that editing a CMakeLists.txt file caused CMake to be re-run successfully and the build to also continue successfully, but since I switched to VS2015 the CMake re-run occurs - apparently successfully, but more often than not the build failed afterwards from either the IDE and from MSBuild. Since I seldom change the CMakeLists.txt files, I simply do a clean CMake configuration anytime I do change them. I also use the "Build" rather than "Rebuild" for incremental development.<br>
<br>
MartinO<br>
<div class="gmail-HOEnZb"><div class="gmail-h5"><br>
-----Original Message-----<br>
From: llvm-dev [mailto:<a href="mailto:llvm-dev-bounces@lists.llvm.org">llvm-dev-bounces@<wbr>lists.llvm.org</a>] On Behalf Of Michael Kruse via llvm-dev<br>
Sent: 16 May 2018 21:26<br>
To: Reid Kleckner <<a href="mailto:rnk@google.com">rnk@google.com</a>><br>
Cc: llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>>; Valentin Churavy <<a href="mailto:v.churavy@gmail.com">v.churavy@gmail.com</a>><br>
Subject: Re: [llvm-dev] Windows build strangeness<br>
<br>
msbuild is is able to re-run cmake if a CMakeLists.txt changes. CMake adds a special project "ZERO_CHECK" that does this. However, I am not sure it runs when invoking on the individual projects instead of the solution.<br>
<br>
Try the cmake --build command, which should output the following:<br>
<br>
> cmake --build . --target opt<br>
CMake is re-running because<br>
C:/Users/Meinersbur/build/<wbr>llvm/vc15_debug_x86/tools/<wbr>polly/CMakeFiles/generate.<wbr>stamp<br>
is out-of-date.<br>
[...]<br>
<br>
Michael<br>
<br>
<br>
<br>
2018-05-16 15:08 GMT-05:00 Reid Kleckner via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>>:<br>
> I think MSBuild isn't capable of re-running cmake and then reloading <br>
> the project files when CMakeLists.txt changes. It re-runs cmake, but <br>
> then continues the build with the stale projects. That probably <br>
> explains the "PipSqueek.cxx doesn't exist" errors. As for the link <br>
> error, it could also be caused by things like a file rename not getting picked up by MSBuild.<br>
><br>
> The fix is probably to always run cmake before MSBuild in the nightly job.<br>
> This isn't necessary if you are using ninja or make, if those are options.<br>
><br>
> On Wed, May 16, 2018 at 12:59 PM via llvm-dev <br>
> <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>><br>
> wrote:<br>
>><br>
>> Here are a couple of representative errors. C:\Dev\upstream\gitmono <br>
>> is where I keep my clone.<br>
>><br>
>><br>
>><br>
>> "C:\Dev\upstream\gitmono\<wbr>wbuild\ALL_BUILD.vcxproj" (Rebuild <br>
>> target)<br>
>> (1) -><br>
>><br>
>><br>
>> "C:\Dev\upstream\gitmono\<wbr>wbuild\unittests\Support\<wbr>DynamicLibrary\SecondLib.<wbr>vcxproj"<br>
>> (default target) (170:2) -><br>
>><br>
>> c1xx : fatal error C1083: Cannot open source file:<br>
>> 'C:\Dev\upstream\gitmono\llvm-<wbr>project\llvm\unittests\Suppor<br>
>><br>
>> t\DynamicLibrary\PipSqueak.<wbr>cxx': No such file or directory <br>
>> [C:\Dev\upstream\gitmono\<wbr>wbuild\unittests\Support\Dyn<br>
>><br>
>> amicLibrary\SecondLib.vcxproj]<br>
>><br>
>><br>
>><br>
>> "C:\Dev\upstream\gitmono\<wbr>wbuild\ALL_BUILD.vcxproj" (Rebuild <br>
>> target)<br>
>> (1) -><br>
>><br>
>> "C:\Dev\upstream\gitmono\<wbr>wbuild\tools\llvm-mca\llvm-<wbr>mca.vcxproj"<br>
>> (default target) (339:2) -><br>
>><br>
>> (Link target) -><br>
>><br>
>> Backend.obj : error LNK2019: unresolved external symbol "public:<br>
>> virtual bool __cdecl mca::FetchStage::isReady<br>
>><br>
>> (void)const " (?isReady@FetchStage@mca@@<wbr>UEBA_NXZ) referenced <br>
>> in function "public: void __cdecl mca::Backend::run<br>
>><br>
>> (void)" (?run@Backend@mca@@QEAAXXZ) <br>
>> [C:\Dev\upstream\gitmono\<wbr>wbuild\tools\llvm-mca\llvm-<wbr>mca.vcxproj]<br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>> From: Valentin Churavy [mailto:<a href="mailto:v.churavy@gmail.com">v.churavy@gmail.com</a>]<br>
>> Sent: Wednesday, May 16, 2018 1:54 PM<br>
>> To: Robinson, Paul<br>
>> Cc: <a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
>> Subject: Re: [llvm-dev] Windows build strangeness<br>
>><br>
>><br>
>><br>
>> What kind of missing symbols are you getting?<br>
>><br>
>> I had to work around dependencies for a Mingw32 build. See<br>
>> <a href="https://reviews.llvm.org/D44650" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D44650</a><br>
>><br>
>> On Wed, May 16, 2018, 13:13 via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
>><br>
>> I have the git monorepo, and Visual Studio 2015. I am finding that <br>
>> running a build from the command line with msbuild (as a nightly job) <br>
>> invariably fails on the first try, and succeeds on a retry.<br>
>><br>
>> The first msbuild command looks like this:<br>
>><br>
>> msbuild ALL_BUILD.vcxproj /p:Configuration="<wbr>RelWithDebInfo" /m:6 <br>
>> /t:Rebuild<br>
>><br>
>> This appears to compile everything okay, but invariably fails with <br>
>> some set of link-time errors, reporting missing symbols. Then I run <br>
>> msbuild again, but without the /t:Rebuild (thus it's a dirty build <br>
>> the second time) and this succeeds.<br>
>><br>
>> Is there some inadequacy in the CMake dependencies somewhere, so that <br>
>> some links are trying to happen before the libraries are completely <br>
>> finished? Or just an msbuild issue?<br>
>><br>
>> I made my nightly script check for errors and run the second round, <br>
>> because it has been happening so consistently, but a proper build <br>
>> system shouldn't require such a workaround.<br>
>><br>
>> For reference, I generated the sln/project files like this:<br>
>><br>
>> cmake -G "Visual Studio 14 Win64" -Thost=x64 ^<br>
>> -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_OPTIMIZED_TABLEGEN=ON ^<br>
>> -DLLVM_ENABLE_PROJECTS="llvm;<wbr>clang;clang-tools-extra" ^<br>
>> ..\llvm-project\llvm<br>
>><br>
>> (Yes I know the optimized tablegen comes from a separate tree, that's <br>
>> built separately and always works. It's just the main build that <br>
>> fails.)<br>
>><br>
>> Thanks,<br>
>> --paulr<br>
>><br>
>> ______________________________<wbr>_________________<br>
>> LLVM Developers mailing list<br>
>> <a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
>><br>
>> ______________________________<wbr>_________________<br>
>> LLVM Developers mailing list<br>
>> <a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
><br>
______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br>
______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
</div></div></blockquote></div><br></div>