This is an archive of the discontinued LLVM Phabricator instance.

[cmake] Use symlinks for Windows-hosted toolchains built on Unix
ClosedPublic

Authored by smeenai on Dec 15 2017, 4:52 PM.

Details

Summary

When cross-compiling for Windows on Unix, the built toolchain will need
to be transferred to Windows to actually run. My opinion is that the
Unix build should use symlinks, and the transfer to Windows should take
care of making those symlinks usable. E.g., I envision tarballs to be a
common form of transfer from Unix to Windows, in which case the tarball
can be created using --dereference to follow the symlinks.

The motivation here is that, when cross-compiling for Windows on Unix,
the installation will *already* create symlinks. The reason is that the
installation script will be invoked without knowing the host system, so
the if(UNIX) check in the installation symlink creation script will
reflect the build system rather than the host system. We could either
make the build and install trees both contain copies or both contain
symlinks, and using symlinks is a significant space saving without (in
my opinion) having any detrimental effect on the usage of the cross-
compiled toolchain on Windows.

A secondary motivation is that Windows 10 version 1703 and later finally
lift the administrator rights requirement for creating symbolic links
(if the system is in Developer Mode), which makes symlinks a lot more
practical even on Windows. Of course Unix and Windows symlinks aren't
interoperable, but symlinks for Windows toolchains is a reasonable
future direction to be going in anyway.

Diff Detail

Repository
rL LLVM

Event Timeline

smeenai created this revision.Dec 15 2017, 4:52 PM
smeenai added a comment.EditedJan 2 2018, 1:22 AM

Ping.

We should either go in this direction or change the installation to also create a copy rather than a symlink (but I've outlined why I prefer symlinks personally in the summary). The current situation, where the build tree has copies but the install tree has symlinks (while attempting to create copies but failing because of a CMake subtlety) is really confusing.

compnerd accepted this revision.Jan 8 2018, 10:27 PM

Yeah, we should be using symlinks on the unix hosts. This fixes an issue in cross-compiling, LGTM.

This revision is now accepted and ready to land.Jan 8 2018, 10:27 PM
This revision was automatically updated to reflect the committed changes.