[cfe-dev] Using Clang on Windows to Build for Linux

Joerg Sonnenberger via cfe-dev cfe-dev at lists.llvm.org
Wed Oct 17 15:24:26 PDT 2018


On Wed, Oct 17, 2018 at 10:58:35AM -0700, Hayden Livingston via cfe-dev wrote:
> We're a predominantly Windows shop but are moving some of our code to
> Linux but would like to use Clang on Windows to compile for Linux.
> 
> Is that possible? Is there a prepackaged version of Clang for that?

Put a copy of /usr/lib* and /usr/include from your Linux distro into a
directory, e.g. C:/linux-sysroot. Then compile with e.g.
  clang -target x86_64-pc-linux-gnu -Btooldir --sysroot C:/linux-sysroot

where tooldir contains your cross-linker (possibly lld).

Joerg



More information about the cfe-dev mailing list