Giter Club home page Giter Club logo

Comments (5)

paleozogt avatar paleozogt commented on May 30, 2024

I don't think its possible. AFAIK, Clang isn't ABI compatible with MSVC.

from msvcdocker.

KOLANICH avatar KOLANICH commented on May 30, 2024

https://clang.llvm.org/docs/MSVCCompatibility.html

First, Clang attempts to be ABI-compatible, meaning that Clang-compiled code should be able to link against MSVC-compiled code successfully. However, C++ ABIs are particularly large and complicated, and Clang’s support for MSVC’s C++ ABI is a work in progress.

from msvcdocker.

paleozogt avatar paleozogt commented on May 30, 2024

Now, that's very interesting. It looks like clang-cl is

the first-ever open-source C++ compiler that’s ABI-compatible with Microsoft Visual C++ (MSVC)

Both Chrome and Firefox use clang-cl/lld-link, so its not just a beta feature.

At first glance it seems like we could cross-compile with clang on a Linux host. Some thoughts:

  • Wine would still be necessary to run any unit/integration/automated tests.
  • Getting tools like CMake to use clang-cl might be problematic on a non-Windows host. For example, CMake doesn't have an MSVC generator on Linux hosts.
  • clang-cl requires at least Windows SDK headers/libs. It's unclear how to get those files. Perhaps we could install them on a Windows VM and copy them over into a Docker image just like we do with MSVC proper.
  • It's unclear if the MSVCRT runtime is part of the Windows SDK or not. If we have to install MSVC in order to get the CRT for clang, is it worth it to use clang? (Perhaps... running the compiler outside of Wine seems compelling.)

It's definitely worth looking into. Thanks for the info!

from msvcdocker.

KOLANICH avatar KOLANICH commented on May 30, 2024

clang-cl requires at least Windows SDK headers/libs. It's unclear how to get those files. Perhaps we could install them on a Windows VM and copy them over into a Docker image just like we do with MSVC proper.

If we have to install MSVC in order to get the CRT for clang, is it worth it to use clang

Or you can install (or just download) VS in Windows, obtain a direct link to msi files by proxying all the requests via mitmproxy, then download only the needed msis by direct links and install (requires wine, but .net is not needed) or unpack (doesn't require wine, only msitools) only them. Should consume much less space than full VS build tools installed by the installer (the installer lacks customization, for example it installs toolchains for unneeded platforms and there is (at least was the last time I have installed MSVC and on the feedback site the support have claimed that adding customization to the installer is not planned) no way to disable it other than not to use it at all);

Getting tools like CMake to use clang-cl might be problematic on a non-Windows host.

In fact on Windows host it is problematic to use CMake + CLang + MinGW since Kitware have embedded a check and shows the message "this setup is unsupported" so I have to patch CMake stdlib in order to build CLang + MinGW on Windows host. It is obviously a bug in CMake. So if CLang + MSVC is unsupported, you may need to create a patch file and apply it after cmake installation. And a toolchain file is obviously needed.

For example, CMake doesn't have an MSVC generator on Linux hosts.

You don't need clang-cl. The only difference of clang-cl from usual clang is MSVC-compatible command line interface. You can compile with usual clang using usual flags like in GCC and still use MS libs and runtime.

It's unclear if the MSVCRT runtime is part of the Windows SDK or not.

It isn't and Windows SDK really depends on MSVC. MinGW and ReactOS use 9wn SDKs and DDKs which are far from being complete.

from msvcdocker.

paleozogt avatar paleozogt commented on May 30, 2024

@KOLANICH With b6ac118 I've updated the project to support clang-cl. Thanks for the suggestion!

from msvcdocker.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.