[PATCH] D141738: Add initial support for cross compile Windows runtimes under Linux when building Fuchsia clang toolchain

Petr Hosek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 3 10:22:03 PST 2023


phosek accepted this revision.
phosek added a comment.

LGTM



================
Comment at: clang/cmake/caches/Fuchsia-stage2.cmake:95
+        # and remove these libpath flags.
+        -libpath:"${LLVM_WINSYSROOT}/VC/Tools/MSVC/14.34.31933/lib/x64"
+        -libpath:"${LLVM_WINSYSROOT}/VC/Tools/MSVC/14.34.31933/atlmfc/lib/x64"
----------------
haowei wrote:
> phosek wrote:
> > phosek wrote:
> > > haowei wrote:
> > > > thakis wrote:
> > > > > You can tell cmake to invoke lld-link, which has a /winsysroot: flag.
> > > > What would be a good way to make CMake invoke lld-link (or through clang-cl) instead of using `cmake vs_link` in this situation?
> > > > We thought about using
> > > > 
> > > > ```
> > > > set(CMAKE_${LANG}_SIMULATE_ID "MSVC")
> > > > set(CMAKE_${LANG}_COMPILER_FRONTEND_VARIANT "GNU")
> > > > ```
> > > > 
> > > > but I don't feel great about changing variables that are not suppose to change. 
> > > Wouldn't CMake use `lld-link` if you set `CMAKE_LINKER=lld-link`. We already do this in https://github.com/llvm/llvm-project/blob/0e09bb8b143c80426c497a924ee4fa57a26af6b5/llvm/cmake/modules/LLVMExternalProjectUtils.cmake#L179 which is used by the bootstrapping build so you should be able to use `/winsysroot:` here.
> > @haowei have tried this suggestion?
> I tried:
> 
> ```
> FAILED: runtimes/runtimes-x86_64-pc-windows-msvc-stamps/runtimes-x86_64-pc-windows-msvc-configure /mnt/nvme_sec/SRC/llvm-project/build-lldlink/runtimes/runtimes-x86_64-pc-windows-msvc-stamps/runtimes-x86_64-pc-windows-msvc-configure 
> cd /mnt/nvme_sec/SRC/llvm-project/build-lldlink/runtimes/runtimes-x86_64-pc-windows-msvc-bins && /mnt/nvme_sec/SRC/llvm-prebuilts/cmake/linux-amd64/bin/cmake \
> -DCMAKE_C_COMPILER=/mnt/nvme_sec/SRC/llvm-project/build-lldlink/./bin/clang-cl \
> -DCMAKE_CXX_COMPILER=/mnt/nvme_sec/SRC/llvm-project/build-lldlink/./bin/clang-cl \
> -DCMAKE_ASM_COMPILER=/mnt/nvme_sec/SRC/llvm-project/build-lldlink/./bin/clang-cl \
> -DCMAKE_LINKER=/mnt/nvme_sec/SRC/llvm-project/build-lldlink/./bin/lld-link \
> ....
> 
> ```
> 
> But cmake is still using vs_link, see:
> 
> ```
> FAILED: cmTC_a05d1.exe 
>         : && /mnt/nvme_sec/SRC/llvm-prebuilts/cmake/linux-amd64/bin/cmake -E vs_link_exe --intdir=CMakeFiles/cmTC_a05d1.dir --rc=/mnt/nvme_sec/SRC/llvm-project/build-lldlink/./bin/llvm-rc --mt=/mnt/nvme_sec/SRC/llvm-project/build-lldlink/bin/llvm-mt --manifests  -- /mnt/nvme_sec/SRC/llvm-project/build-lldlink/bin/lld-link /nologo CMakeFiles/cmTC_a05d1.dir/CMakeCCompilerABI.c.obj  /out:cmTC_a05d1.exe /implib:cmTC_a05d1.lib /pdb:cmTC_a05d1.pdb /version:0.0 /vfsoverlay:/mnt/nvme_sec/SRC/WinSDK/winsdk-cipd/llvm-vfsoverlay.yaml  /debug /INCREMENTAL /subsystem:console
> ```
Thanks for checking, we should investigate this further and perhaps reach out to CMake maintainers but that can be done separately.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141738/new/

https://reviews.llvm.org/D141738



More information about the cfe-commits mailing list