This is an archive of the discontinued LLVM Phabricator instance.

[CMake] try creating symlink first on windows
ClosedPublic

Authored by paperchalice on Mar 23 2021, 3:46 AM.

Details

Summary

-E create_symlink is available on windows since CMake 3.13 (LLVM now uses 3.13.4)
It may needs administrator privileges or enabled developer mode (Windows 10)
See https://cmake.org/cmake/help/latest/release/3.13.html

Diff Detail

Event Timeline

paperchalice created this revision.Mar 23 2021, 3:46 AM
paperchalice requested review of this revision.Mar 23 2021, 3:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 23 2021, 3:46 AM
paperchalice edited reviewers, added: kbobyrev; removed: chandlerc.Mar 27 2021, 3:51 AM
paperchalice edited the summary of this revision. (Show Details)Mar 27 2021, 4:03 AM
kbobyrev accepted this revision.Mar 30 2021, 11:39 PM

I don't have a Windows machine to test this out but the change looks reasonable to me and the "fallback to COPY" should probably be enough in this case.

This revision is now accepted and ready to land.Mar 30 2021, 11:39 PM
paperchalice added a comment.EditedApr 7 2021, 2:14 AM

Sorry, I don't have commit access. Thanks in advance if someone can commit the change. @kbobrovs

This revision was automatically updated to reflect the committed changes.

Note, there's a bug caused by these changes: LLVM bug 51692
TLDR: in Github Action (Windows) environment compiler builds "successfully", but links are broken and no copy is done.

Hi Dmitry! Thanks for bringing this to my attention, I'll look into this
issue!

The bug reporter tried to use 7zip to distribute llvm on Windows, but the 7zip on Windows cannot handle symbolic links properly in 7z format. Using 7zip to create tarball or wim can avoid this issue.

Oh, I see, thanks a lot for the context! I've looked into the bug and was
under the same impression but I was curious why this happened after the
commit I approved since the process looked similar. But also the pipeline
seemed to be working for the next revisions in the reporter's CI :thinking:

I confirm that it is a problem with 7zip, which is not preserving symlinks by default. Thanks for pointing to it.
The reason why this commit "broke" it for us, is because it introduced symlinks on Windows.
I'm still not sure that using symlinks on Windows is a good idea, given how poorly they are supported by the ecosystem.

For those who have similar issue - we end up using tar format produced by "7z a -ttar -snl" (-snl is essential) and then wrapped it by regular 7z.
Note, stock "tar" on Windows doesn't handle symlinks out of the box.

Qt Creator hit the same issue as others have had, 0 bytes clang-cl.exe due to packaging with 7zip.

I had to do a quick revert of this commit, since there is no option to disable this new functionality. There should be a LLVM_WINDOWS_DISABLE_SYMLINK or similar.

https://github.com/msys2/MINGW-packages/tree/34191f03a6da67f58b33ee2c756a142691746118/mingw-w64-clang maintains a list of revert patches, this is one of them.