Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to build repo on latest VS dogfood #49646

Closed
stephentoub opened this issue Mar 15, 2021 · 18 comments · Fixed by #49961
Closed

Unable to build repo on latest VS dogfood #49646

stephentoub opened this issue Mar 15, 2021 · 18 comments · Fixed by #49961
Labels
area-Infrastructure-coreclr blocking Marks issues that we want to fast track in order to unblock other important work untriaged New issue has not been triaged by the area owner
Milestone

Comments

@stephentoub
Copy link
Member

I've just sync'd to the latest in main and cleaned my repo (git clean -xdf). I have VS Version 16.10.0 Preview 2.0 [31115.18.main] installed.

When I try to build (.\build.cmd clr+libs -rc release), I get ~400 warnings of the form:

  cl : command line warning D9002: ignoring unknown option '/external:envEXTERNAL_INCLUDES' [D:\repos\runtime\artifacts\obj\coreclr\windows.x64.Release\jit\static\clrjit_obj.vcxproj]

and then an error of the form:

LINK : fatal error LNK1268: inconsistent option 'ILK:coreclr.dir\Release\coreclr.ilk' specified with /USEPROFILE but not with /GENPROFILE [D:\repos\runtime\artifacts\obj\coreclr\windows.x64.Release\dlls\mscoree\coreclr\coreclr.vcxproj]

that kills the build.

@stephentoub stephentoub added area-Meta blocking Marks issues that we want to fast track in order to unblock other important work labels Mar 15, 2021
@stephentoub stephentoub added this to the 6.0.0 milestone Mar 15, 2021
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Mar 15, 2021
@ghost
Copy link

ghost commented Mar 15, 2021

Tagging subscribers to this area: @hoyosjs
See info in area-owners.md if you want to be subscribed.

Issue Details

I've just sync'd to the latest in main and cleaned my repo (git clean -xdf). I have VS Version 16.10.0 Preview 2.0 [31115.18.main] installed.

When I try to build (.\build.cmd clr+libs -rc release), I get ~400 warnings of the form:

  cl : command line warning D9002: ignoring unknown option '/external:envEXTERNAL_INCLUDES' [D:\repos\runtime\artifacts\obj\coreclr\windows.x64.Release\jit\static\clrjit_obj.vcxproj]

and then an error of the form:

LINK : fatal error LNK1268: inconsistent option 'ILK:coreclr.dir\Release\coreclr.ilk' specified with /USEPROFILE but not with /GENPROFILE [D:\repos\runtime\artifacts\obj\coreclr\windows.x64.Release\dlls\mscoree\coreclr\coreclr.vcxproj]

that kills the build.

Author: stephentoub
Assignees: -
Labels:

area-Infrastructure-coreclr, area-Meta, blocking, untriaged

Milestone: 6.0.0

@jkotas
Copy link
Member

jkotas commented Mar 15, 2021

This is break in the internal VS dogfood. I have opened https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1292565/ on it.

In the meantime, you can workaround it by using -ninja.

@stephentoub
Copy link
Member Author

Thanks, @jkotas. -ninja unblocked me.

@jkotas
Copy link
Member

jkotas commented Mar 18, 2021

This error is fixed in the latest VS build. However, there is a new set of errors that I am fixing in #49799

@jkotas jkotas closed this as completed Mar 18, 2021
@stephentoub
Copy link
Member Author

stephentoub commented Mar 19, 2021

@jkotas, I'm on the latest VS build that's offered to me (31118.392.main) and I'm sync'd to main, but I'm now unable to build, even with -ninja. What version of VS do you have?

With -ninja, I hit linking errors on ildasm:

  hotheapwriter.cpp.obj : error LNK2011: precompiled object not linked in; image may not run
    Hint on symbols that are defined and could potentially match:
      __@@_PchSym_@00@UivklhUifmgrnvUzigruzxghUmnzpvlyqUdrmwldhOcGEOivovzhvUfgroxlwvUxnzpvurovhUfgroxlwvhgzgrxmlslhgOwriUxnzpvurovhUfgroxlwvhgzgrxmlslhgOwriUxnzpvPkxsOxccOlyq@4B2008FD98C1DD4
  regmeta_imetadatatables.cpp.obj : error LNK2011: precompiled object not linked in; image may not run
    Hint on symbols that are defined and could potentially match:
      __@@_PchSym_@00@UivklhUifmgrnvUzigruzxghUmnzpvlyqUdrmwldhOcGEOivovzhvUfgroxlwvUxnzpvurovhUfgroxlwvhgzgrxmlslhgOwriUxnzpvurovhUfgroxlwvhgzgrxmlslhgOwriUxnzpvPkxsOxccOlyq@4B2008FD98C1DD4
  strongnameinternal.cpp.obj : error LNK2011: precompiled object not linked in; image may not run
    Hint on symbols that are defined and could potentially match:
      __@@_PchSym_@00@UivklhUifmgrnvUzigruzxghUmnzpvlyqUdrmwldhOcGEOivovzhvUfgroxlwvUxnzpvurovhUfgroxlwvhgzgrxmlslhgOwriUxnzpvurovhUfgroxlwvhgzgrxmlslhgOwriUxnzpvPkxsOxccOlyq@4B2008FD98C1DD4
  mdinternalrw.cpp.obj : error LNK2011: precompiled object not linked in; image may not run
    Hint on symbols that are defined and could potentially match:
      __@@_PchSym_@00@UivklhUifmgrnvUzigruzxghUmnzpvlyqUdrmwldhOcGEOivovzhvUfgroxlwvUxnzpvurovhUfgroxlwvhgzgrxmlslhgOwriUxnzpvurovhUfgroxlwvhgzgrxmlslhgOwriUxnzpvPkxsOxccOlyq@4B2008FD98C1DD4
  ildasm\exe\ildasm.exe : fatal error LNK1120: 4 unresolved externals

@bartonjs
Copy link
Member

FWIW, @stephentoub, I just ran into your original problem, tried to solve it by upgrading VS/tooling to the latest (which was also 31118.392.main), and after finding this issue found that building with -ninja worked for me. (build as of aebce68)

@jkotas
Copy link
Member

jkotas commented Mar 20, 2021

I just tried on 31118.392.main as well. I do not see the _@@_PchSym_ errors. The only error that I see is linker warning treated as error in non-ninja release build. I am going to submit a PR for that shortly.

@stephentoub
Copy link
Member Author

Without ninja, I get:

LINK : fatal error LNK1268: inconsistent option 'ILK:coreclr.dir\Release\coreclr.ilk' specified with /USEPROFILE but not with /GENPROFILE [D:\repos\runtime\artifacts\obj\coreclr\windows.x64.Release\dlls\mscoree\coreclr\coreclr.vcxproj]

Is that the warning-as-error you're referring to?

With ninja, I get the aforementioned _@@_PchSym_ errors.

This is after doing:
git fetch --all
git reset --hard upstream/main
git clean -xdf

@jkotas
Copy link
Member

jkotas commented Mar 20, 2021

fatal error LNK1268: inconsistent option 'ILK:coreclr.dir\Release\coreclr.ilk' specified with /USEPROFILE but not with /GENPROFILE

Yes, that's the error that I am referring to. It is actually non-surprissible hard error and I have not found yet what needs to be changed to make it go away.

With ninja, I get the aforementioned _@@PchSym errors.

I have tried again with ninja and it works fine for me. (I have done build.cmd -s clr+libs -c Release -ninja.) What is the exact command that you are using?

I suspect that it may be a build race condition that only repros with ninja. @jkoritzinsky Could you please help to troubleshoot it?

@stephentoub
Copy link
Member Author

It is actually non-surprissible hard error

Yeah, I'd tried and had no luck.

What is the exact command that you are using?

Not at my machine right now, but I've been doing:
build.cmd clr+libs -rc Release -ninja

@jkotas
Copy link
Member

jkotas commented Mar 20, 2021

fatal error LNK1268: inconsistent option 'ILK:coreclr.dir\Release\coreclr.ilk' specified with /USEPROFILE but not with /GENPROFILE

This error can be worked around by passing /p:NoPgoOptimize=true to the build, e.g. build.cmd -s clr+libs -c Release /p:NoPgoOptimize=true

@jkotas
Copy link
Member

jkotas commented Mar 20, 2021

I have opened https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1295929/ on the LNK1268 error. It looks like a recently introduced bug in VC++ msbuild targets or tasks.

@stephentoub
Copy link
Member Author

This error can be worked around by passing /p:NoPgoOptimize=true to the build, e.g. build.cmd -s clr+libs -c Release /p:NoPgoOptimize=true

No dice. I did:

.\build.cmd -s clr+libs -c Release /p:NoPgoOptimize=true

and I got:

  Build FAILED.

  hotheapwriter.obj : error LNK2011: precompiled object not linked in; image may not run [D:\repos\runtime\artifacts\obj\coreclr\windows.x64.Release\ildasm\exe\ildasm.vcxproj]
  regmeta_imetadatatables.obj : error LNK2011: precompiled object not linked in; image may not run [D:\repos\runtime\artifacts\obj\coreclr\windows.x64.Release\ildasm\exe\ildasm.vcxproj]
  strongnameinternal.obj : error LNK2011: precompiled object not linked in; image may not run [D:\repos\runtime\artifacts\obj\coreclr\windows.x64.Release\ildasm\exe\ildasm.vcxproj]
  mdinternalrw.obj : error LNK2011: precompiled object not linked in; image may not run [D:\repos\runtime\artifacts\obj\coreclr\windows.x64.Release\ildasm\exe\ildasm.vcxproj]
  D:\repos\runtime\artifacts\obj\coreclr\windows.x64.Release\ildasm\exe\Release\ildasm.exe : fatal error LNK1120: 4 unresolved externals [D:\repos\runtime\artifacts\obj\coreclr\windows.x64.Release\ildasm\exe\ildasm.vcxproj]
  pesectionman.obj : error LNK2011: precompiled object not linked in; image may not run [D:\repos\runtime\artifacts\obj\coreclr\windows.x64.Release\ilasm\ilasm.vcxproj]
  D:\repos\runtime\artifacts\obj\coreclr\windows.x64.Release\ilasm\Release\ilasm.exe : fatal error LNK1120: 1 unresolved externals [D:\repos\runtime\artifacts\obj\coreclr\windows.x64.Release\ilasm\ilasm.vcxproj]
      0 Warning(s)
      7 Error(s)

with earlier details like:

  hotheapwriter.obj : error LNK2011: precompiled object not linked in; image may not run [D:\repos\runtime\artifacts\obj\coreclr\windows.x64.Release\ildasm\exe\ildasm.vcxproj]
      Hint on symbols that are defined and could potentially match:
        __@@_PchSym_@00@UivklhUifmgrnvUzigruzxghUlyqUxlivxoiUdrmwldhOcGEOivovzhvUfgroxlwvUfgroxlwvhgzgrxmlslhgOwriUivovzhvUxnzpvPkxsOlyq@4B2008FD98C1DD4
  regmeta_imetadatatables.obj : error LNK2011: precompiled object not linked in; image may not run [D:\repos\runtime\artifacts\obj\coreclr\windows.x64.Release\ildasm\exe\ildasm.vcxproj]
      Hint on symbols that are defined and could potentially match:
        __@@_PchSym_@00@UivklhUifmgrnvUzigruzxghUlyqUxlivxoiUdrmwldhOcGEOivovzhvUfgroxlwvUfgroxlwvhgzgrxmlslhgOwriUivovzhvUxnzpvPkxsOlyq@4B2008FD98C1DD4
  strongnameinternal.obj : error LNK2011: precompiled object not linked in; image may not run [D:\repos\runtime\artifacts\obj\coreclr\windows.x64.Release\ildasm\exe\ildasm.vcxproj]
      Hint on symbols that are defined and could potentially match:
        __@@_PchSym_@00@UivklhUifmgrnvUzigruzxghUlyqUxlivxoiUdrmwldhOcGEOivovzhvUfgroxlwvUfgroxlwvhgzgrxmlslhgOwriUivovzhvUxnzpvPkxsOlyq@4B2008FD98C1DD4
  mdinternalrw.obj : error LNK2011: precompiled object not linked in; image may not run [D:\repos\runtime\artifacts\obj\coreclr\windows.x64.Release\ildasm\exe\ildasm.vcxproj]
      Hint on symbols that are defined and could potentially match:
        __@@_PchSym_@00@UivklhUifmgrnvUzigruzxghUlyqUxlivxoiUdrmwldhOcGEOivovzhvUfgroxlwvUfgroxlwvhgzgrxmlslhgOwriUivovzhvUxnzpvPkxsOlyq@4B2008FD98C1DD4

No idea how my system differs from yours.

@stephentoub
Copy link
Member Author

stephentoub commented Mar 20, 2021

I tried installing the latest VS2019 release (16.9.2) hoping that would unblock me, but even when running in its dev prompt, I get the same failures. Presumably the build is finding something newer on my box and using it.

@stephentoub stephentoub reopened this Mar 20, 2021
@stephentoub
Copy link
Member Author

I was able to build successfully on another machine with /p:NoPgoOptimize=true, so... 🤷‍♂️

@jkotas
Copy link
Member

jkotas commented Mar 21, 2021

I have managed to hit the LNK2011 errors a few times on my machine too. It looks like an intermittent error. I have asked about diagnosing it on the email thread with the C++ compiler team.

@jkotas jkotas changed the title Unable to build repo locally due to D9002 and LNK1268 warnings and errors Unable to build repo on latest VS dogfood Mar 21, 2021
@jkotas
Copy link
Member

jkotas commented Mar 21, 2021

@stephentoub Could you please check cmake version being used for the success and failure cases? I believe that the LNK2011 errors are caused by a bug in some older cmake versions (e.g. 3.16.0-rc1), and upgrading to the latest cmake makes them go away.

@stephentoub
Copy link
Member Author

Could you please check cmake version being used for the success and failure cases? I believe that the LNK2011 errors are caused by a bug in some older cmake versions (e.g. 3.16.0-rc1), and upgrading to the latest cmake makes them go away.

That did it! I had cmake 3.16-rc2. I updated to the latest release build (3.19.7), and with your merged workaround last night, I can now successfully build (build.cmd clr+libs -rc release) with the latest dogfood VS (31119.371.main).

Thank you!

(Worth updating https://github.com/dotnet/runtime/blob/main/docs/workflow/requirements/windows-requirements.md#cmake ?)

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Mar 21, 2021
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Mar 22, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Apr 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Infrastructure-coreclr blocking Marks issues that we want to fast track in order to unblock other important work untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants