[cfe-dev] Anyone uses Clang 3.8 and higher on Windows with MinGW-w64?

Constantine via cfe-dev cfe-dev at lists.llvm.org
Mon Mar 20 09:24:10 PDT 2017


Reid, thanks for tip. I guess Clang 3.7 mislead me into thinking that
mingw headers should be searched by default since it works without
explicitly specifying mingw as the target.

On 3/20/17, Reid Kleckner <rnk at google.com> wrote:
> If you want clang to default to mingw, it is easy to configure that way
> (-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-w64-mingw32 at cmake time). Or you can
> pass --target=x86_64-w64-mingw32 at runtime, and that will trigger mingw
> header search.
>
> The upstream installer is built with MSVC, and LLVM targets whatever it was
> built with by default.
>
> On Mon, Mar 20, 2017 at 9:10 AM, Constantine via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>
>> Oh, I found what was the problem: Clang 3.8 and higher defaults to
>> x86_64-pc-windows-msvc target that straight up ignores MinGW headers,
>> but if I specify the mingw target in a compile command:
>>
>> clang -target x86_64-w64-mingw32 main.c
>>
>> It compiles fine, both for copied "C:\mingw64\*" in "C:\Program
>> Files\LLVM\" folder as Mateusz suggested or with respect to separate
>> mingw64 path from PATH env variable.
>>
>> Solved!
>>
>> On 3/20/17, Mateusz Mikuła <mati865 at gmail.com> wrote:
>> >  Clang from official installer works if you copy "C:\mingw64\*" to
>> > "C:\Program Files\LLVM\".
>> >
>> >
>> > P.S.
>> >
>> > Use reply to all on LLVM mailing list.
>> >
>> >
>> > ------ Original Message ------
>> > Subject: Re: [cfe-dev] Anyone uses Clang 3.8 and higher on Windows with
>> > MinGW-w64?
>> > Date: Mon, 20 Mar 2017 18:38:40 +0300
>> > To: Mateusz Mikuła
>> > From: Constantine
>> >> Yaron, yes, I know it works, if I install Clang 3.7.0 or Clang 3.7.1
>> >> from llvm website it picks up a "C:\mingw64\bin" path from PATH env
>> >> variable, but when I replace them with Clang 3.8 or higher versions it
>> >> doesn't find the headers anymore and a basic hello world throws an
>> >> error that stdio.h can't be found.
>> >>
>> >> Mateusz, thanks for reminding that MSYS2 has its own version of Clang!
>> >> Indeed, I installed Clang 3.9.1 and it works. Will stick with it for
>> >> now, just wanted to point out a possible issue with the official
>> >> installers.
>> >>
>> >> On 3/20/17, Mateusz Mikuła <mati865 at gmail.com> wrote:
>> >>>  It's far from being drop-in replacement for GCC.
>> >>>
>> >>> At MSYS2 we have patched Clang working only a little better than
>> >>> installed from LLVM website but there is still a lot to fix.
>> >>>
>> >>>
>> >>> ------ Original Message ------
>> >>> Subject: Re: [cfe-dev] Anyone uses Clang 3.8 and higher on Windows
>> >>> with
>> >>> MinGW-w64?
>> >>> Date: Mon, 20 Mar 2017 09:57:38 +0000
>> >>> To: Constantine, Cfe-dev
>> >>> From: Yaron Keren Via Cfe-dev
>> >>>> clang works fine with mingw-builds from
>> >>>> https://sourceforge.net/projects/mingw-w64/
>> >>>>
>> >>>>
>> >>>> ‫בתאריך יום ב׳, 20 במרץ 2017 ב-6:31 מאת ‪Constantine via cfe-dev‬‏
>> >>>> <‪cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>‬‏>:‬
>> >>>>
>> >>>>     I can't get it to work, Clang 3.8, 3.9 and 4.0 appear to ignore
>> >>>> PATH
>> >>>>     environment variable and fail to find MinGW headers, while Clang
>> >>>> 3.7
>> >>>>     and 3.7.1 can find and use them just fine.
>> >>>>
>> >>>>     Anyone tried Clang 3.8+ versions with MinGW-w64?
>> >>>>     _______________________________________________
>> >>>>     cfe-dev mailing list
>> >>>>     cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>
>> >>>>     http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>> >>>>
>> >>>>
>> >>>>
>> >>>> _______________________________________________
>> >>>> cfe-dev mailing list
>> >>>> cfe-dev at lists.llvm.org
>> >>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>> >>>
>> >>
>> >
>> >
>>
>>
>> --
>> コンスタンティン・タラセンコフ
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>
>>
>


-- 
コンスタンティン・タラセンコフ



More information about the cfe-dev mailing list