[cfe-dev] Clang on Windows targeting gcc requirements

Martell Malone martellmalone at gmail.com
Tue Jul 7 13:23:48 PDT 2015


Hi Yaron,

I'm adding j-b from videolan  to the CC list.
We are looking at setting up a build bot for this target as we have a lot
of invested interest in this target.

It would be great if we could get my patches reviewed and whatever changes
needed to get them merged.
Is there anything you need from us to get this merged?

I don't know who to add as a reviewer on pabricator for this target
The only one that came to mind was yourself because you helped me with the
mingw-w64 driver review last time

Kind Regards
Martell

On Tue, Jul 7, 2015 at 7:58 PM, Martell Malone <martellmalone at gmail.com>
wrote:

> Can you build the whole toolchain without any GNU stuff?
>> What replaces make, gprof, addr2line, c++filt? Is lldb working perfectly
>> on Windows/GNU?
>
>
> Well i am using cmake so you can use ninja or whatever generator is uses.
>
> In terms of the other things you mentioned binutils is still required as
> lld is not quite ready to handle this
> I did say it was independent of gcc not binutils :)
>
> I have't tested lldb but that will be the next package I work on.
>
> Right now clang drops in the mingw chain which requires us to maintain
>> mingw compatibility, a task by itself.
>>
> Well thats exactly what I changed
> Clang can now build the mingw-w64 crt itself also so gcc is not needed at
> all.
>
> On Tue, Jul 7, 2015 at 7:18 PM, Yaron Keren <yaron.keren at gmail.com> wrote:
>
>> Hi Martell,
>>
>> Can you build the whole toolchain without any GNU stuff?
>> What replaces make, gprof, addr2line, c++filt? Is lldb working perfectly
>> on Windows/GNU?
>>
>> Right now clang drops in the mingw chain which requires us to maintain
>> mingw compatibility, a task by itself.
>> Making and maintaining/owning a mingw-w64 toolchain distribution is much
>> larger undertaking and I don't have the time for it. I can review
>> additions/expansions/bug fixes to the mingw toolchain though.
>>
>> Yaron
>>
>>
>> 2015-07-07 20:51 GMT+03:00 Martell Malone <martellmalone at gmail.com>:
>>
>>> Hey guys,
>>>
>>> Thanks for CC'ing me on this.
>>> I do remember a previous discussion on this issue with gcc where there
>>> are 3 possible combinations for locations of c++ includes.
>>> Hurcan I don't maintain the gcc packages for msys2 alexey does.
>>> He is currently looking at rebuilding to gcc 5.1
>>> If you create an issue there he might be able to change the paths of the
>>> package to match mingw-builds.
>>> If not I will update clang in the next msys2 package to handle the msys2
>>> layout
>>>
>>> A bit unrelated but still on topic of clang gcc I have build a
>>> fully independent clang toolchain for mingw-w64.
>>> What this mean by this is that we no longer require gcc.
>>>
>>> I patched the mingw-w64-crt to be buildable with clang and
>>> I patched the clang driver and got compiler-rt working for mingw-w64
>>> along with libc++.
>>>
>>> I would prefer to move the package in the direction of defaulting to use
>>> compiler-rt and libc++ instead of libgcc and libstdc++
>>> I sent in the patches to llvm commits for the compiler-rt support but
>>> didn't get reply from anyone
>>>
>>> Yaron maybe you would be able to help me in getting this reviewed /
>>> merged
>>> All the patches are here
>>>
>>> https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-clang-svn
>>>
>>> Kind Regards
>>> Martell
>>>
>>
>> On Sun, Jul 5, 2015 at 6:30 AM, Yaron Keren <yaron.keren at gmail.com>
>> wrote:
>>
>>> The attached patch should fix that, please let me know if it works for
>>> you.
>>>
>>>
>>>
>>> 2015-07-05 0:33 GMT+03:00 Hurcan Solter <hsolter at gmail.com>:
>>>
>>>> Yes, upon further inspection, aforementioned patch explicitly adds the
>>>> directories in MinGW::AddClangCXXStdlibIncludeArgs()
>>>> which is distinctly different than mingw-builds.
>>>> With MSYS2 C++ include directories is kept in
>>>> /mingw64/include/c++/${gccver} whereas with mingw-builds
>>>> /mingw64/x86_64-w64-mingw32/include/c++
>>>> is where they are.
>>>>
>>>> Old patch is removed from the MSYS2 packages and a new one is
>>>> introduced after this update but unfortunately it does not handle
>>>> the changes. ( I've added the maintainer of clang at MSYS2 in this
>>>> conversation).
>>>>
>>>> MSYS2 is damn great and convenient to use. I'd very much like to see
>>>> recent version of clang is usable without problems again.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>> On Sat, Jul 4, 2015 at 6:40 PM, Yaron Keren <yaron.keren at gmail.com>
>>> wrote:
>>>
>>>> Hi Hurcan,
>>>>
>>>> clang support the mingw-builds and mingw.org directory structure.
>>>> With the msys2 build, the problem is the missing C++ include
>>>> directories?
>>>>
>>>> Yaron
>>>>
>>>>
>>>> 2015-07-04 16:41 GMT+03:00 Hurcan Solter <hsolter at gmail.com>:
>>>>
>>>>> I've used to build clang on MSYS2 with older version of this patch at
>>>>> https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-clang/clang-mingw-driver.patch
>>>>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_Alexpux_MINGW-2Dpackages_blob_master_mingw-2Dw64-2Dclang_clang-2Dmingw-2Ddriver.patch&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=CnzuN65ENJ1H9py9XLiRvC_UQz6u3oG6GUNn7_wosSM&m=r3JtGknlg70px5yvRWhv1Zl7r4WNJKqtaJd9HISLW8E&s=Ix-0aW1nGYMxzuqzb9pdVofsl42YNYgvP3nfa6Vzf8E&e=>
>>>>> and it served me well. this new patch not so much.Below the relevant dumps ;
>>>>>
>>>>> $ g++ -E -x c++ - -v < /dev/null
>>>>> Using built-in specs.
>>>>> COLLECT_GCC=C:\msys2_64\mingw64\bin\g++.exe
>>>>> Target: x86_64-w64-mingw32
>>>>> Configured with: ../gcc-4.9.2/configure --prefix=/mingw64
>>>>> --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32
>>>>> --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32
>>>>> --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include
>>>>> --libexecdir=/mingw64/lib --with-gxx-include-dir=/mingw64/include/c++/4.9.2
>>>>> --enable-bootstrap --with-arch=x86-64 --with-tune=generic
>>>>> --enable-languages=c,lto,c++,objc,obj-c++,fortran,ada --enable-shared
>>>>> --enable-static --enable-libatomic --enable-threads=posix --enable-graphite
>>>>> --enable-fully-dynamic-string --enable-libstdcxx-time=yes
>>>>> --disable-libstdcxx-pch --disable-libstdcxx-debug
>>>>> --enable-cloog-backend=isl --enable-version-specific-runtime-libs
>>>>> --disable-cloog-version-check --disable-isl-version-check --enable-lto
>>>>> --enable-libgomp --disable-multilib --enable-checking=release
>>>>> --disable-rpath --disable-win32-registry --disable-nls --disable-werror
>>>>> --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64
>>>>> --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64
>>>>> --with-cloog=/mingw64 --with-pkgversion='Rev5, Built by MSYS2 project'
>>>>> --with-bugurl=http://sourceforge.net/projects/msys2
>>>>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__sourceforge.net_projects_msys2&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=CnzuN65ENJ1H9py9XLiRvC_UQz6u3oG6GUNn7_wosSM&m=r3JtGknlg70px5yvRWhv1Zl7r4WNJKqtaJd9HISLW8E&s=qxch1gn6dUS6rczZ8OX27JDQX2SAixXM5TJTJug9FhI&e=>
>>>>> --with-gnu-as --with-gnu-ld
>>>>> Thread model: posix
>>>>> gcc version 4.9.2 (Rev5, Built by MSYS2 project)
>>>>> COLLECT_GCC_OPTIONS='-E' '-v' '-shared-libgcc' '-mtune=generic'
>>>>> '-march=x86-64'
>>>>>  C:/msys2_64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/cc1plus.exe
>>>>> -E -quiet -v -iprefix
>>>>> C:/msys2_64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/ -D_REENTRANT -
>>>>> -mtune=generic -march=x86-64
>>>>> # 1 "<stdin>"
>>>>> # 1 "<built-in>"
>>>>> # 1 "<command-line>"
>>>>> # 1 "<stdin>"
>>>>> ignoring duplicate directory
>>>>> "C:/msys2_64/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/4.9.2/include"
>>>>> ignoring nonexistent directory "C:/msys64/mingw64/include"
>>>>> ignoring nonexistent directory "/mingw64/include"
>>>>> ignoring duplicate directory
>>>>> "C:/msys2_64/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/4.9.2/include-fixed"
>>>>> ignoring duplicate directory
>>>>> "C:/msys2_64/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/include"
>>>>> ignoring nonexistent directory
>>>>> "C:/msys64/mingw64/x86_64-w64-mingw32/include"
>>>>> #include "..." search starts here:
>>>>> #include <...> search starts here:
>>>>>  C:/msys2_64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/include
>>>>>
>>>>>  C:/msys2_64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../include
>>>>>
>>>>>  C:/msys2_64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/include-fixed
>>>>>
>>>>>  C:/msys2_64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/include
>>>>>  C:/msys2_64/mingw64/lib/gcc/../../include/c++/4.9.2
>>>>>  C:/msys2_64/mingw64/lib/gcc/../../include/c++/4.9.2/x86_64-w64-mingw32
>>>>>  C:/msys2_64/mingw64/lib/gcc/../../include/c++/4.9.2/backward
>>>>>
>>>>>
>>>>> Built with the older MSYS2 patch ;
>>>>> $ clang++ -E -x c++ - -v < /dev/null
>>>>> clang version 3.7.0 (http://llvm.org/git/clang.git
>>>>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_git_clang.git&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=CnzuN65ENJ1H9py9XLiRvC_UQz6u3oG6GUNn7_wosSM&m=r3JtGknlg70px5yvRWhv1Zl7r4WNJKqtaJd9HISLW8E&s=pPjfizf2zAebxGKdA0tfJNJMfhG4rOM7lwPnfPMa14Q&e=>
>>>>> e7cee814a12b5dd16c8672543fd93efe741d5208) (
>>>>> http://llvm.org/git/llvm.git
>>>>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_git_llvm.git&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=CnzuN65ENJ1H9py9XLiRvC_UQz6u3oG6GUNn7_wosSM&m=r3JtGknlg70px5yvRWhv1Zl7r4WNJKqtaJd9HISLW8E&s=nrLEvIb_FdlnMl1MALmnNd72UDSWQ11U46obfWTKRRA&e=>
>>>>> d594ba081506f0f57e9801e3f81467b1766b1e04)
>>>>> Target: x86_64-pc-windows-gnu
>>>>> Thread model: posix
>>>>>  "C:\\msys2_64\\mingw64\\bin\\clang++.exe" -cc1 -triple
>>>>> x86_64-pc-windows-gnu -E -disable-free -disable-llvm-verifier
>>>>> -main-file-name - -mrelocation-model pic -pic-level 2 -mthread-model posix
>>>>> -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
>>>>> -target-cpu x86-64 -momit-leaf-frame-pointer -v -dwarf-column-info
>>>>> -fno-unique-section-names -resource-dir
>>>>> "C:\\msys2_64\\mingw64\\bin\\..\\lib\\clang\\3.7.0" -internal-isystem
>>>>> "C:\\msys2_64\\mingw64\\bin/../include/c++/4.9.2" -internal-isystem
>>>>> "C:\\msys2_64\\mingw64\\bin/../include/c++/4.9.2/x86_64-w64-mingw32"
>>>>> -internal-isystem
>>>>> "C:\\msys2_64\\mingw64\\bin/../include/c++/4.9.2/backward"
>>>>> -internal-isystem
>>>>> "C:\\msys2_64\\mingw64\\bin/../x86_64-w64-mingw32/include/c++"
>>>>> -internal-isystem
>>>>> "C:\\msys2_64\\mingw64\\bin/../x86_64-w64-mingw32/include/c++/x86_64-w64-mingw32"
>>>>> -internal-isystem
>>>>> "C:\\msys2_64\\mingw64\\bin/../x86_64-w64-mingw32/include/c++/backward"
>>>>> -internal-isystem
>>>>> "C:\\msys2_64\\mingw64\\bin\\..\\lib\\clang\\3.7.0\\include"
>>>>> -internal-isystem
>>>>> "C:\\msys2_64\\mingw64\\bin/../x86_64-w64-mingw32/include"
>>>>> -internal-isystem "C:\\msys2_64\\mingw64\\bin/../include"
>>>>> -fdeprecated-macro -fdebug-compilation-dir "E:\\llvm\\buildmingw64\\bin"
>>>>> -ferror-limit 19 -fmessage-length 0 -mstackrealign -fno-use-cxa-atexit
>>>>> -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
>>>>> -o - -x c++ -
>>>>> clang -cc1 version 3.7.0 based upon LLVM 3.7.0svn default target
>>>>> x86_64-pc-windows-gnu
>>>>> ignoring nonexistent directory
>>>>> "C:\msys2_64\mingw64\bin/../x86_64-w64-mingw32/include/c++"
>>>>> ignoring nonexistent directory
>>>>> "C:\msys2_64\mingw64\bin/../x86_64-w64-mingw32/include/c++/x86_64-w64-mingw32"
>>>>> ignoring nonexistent directory
>>>>> "C:\msys2_64\mingw64\bin/../x86_64-w64-mingw32/include/c++/backward"
>>>>> ignoring duplicate directory
>>>>> "C:\msys2_64\mingw64\bin\..\lib\clang\3.7.0\include"
>>>>> #include "..." search starts here:
>>>>> #include <...> search starts here:
>>>>>  C:\msys2_64\mingw64\bin/../include/c++/4.9.2
>>>>>  C:\msys2_64\mingw64\bin/../include/c++/4.9.2/x86_64-w64-mingw32
>>>>>  C:\msys2_64\mingw64\bin/../include/c++/4.9.2/backward
>>>>>  C:\msys2_64\mingw64\bin\..\lib\clang\3.7.0\include
>>>>>  C:\msys2_64\mingw64\bin/../x86_64-w64-mingw32/include
>>>>>  C:\msys2_64\mingw64\bin/../include
>>>>> End of search list.
>>>>> New Patch
>>>>> $ ./clang++ -E -x c++ - -v < /dev/null
>>>>> clang version 3.7.0 (http://llvm.org/git/clang.git
>>>>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_git_clang.git&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=CnzuN65ENJ1H9py9XLiRvC_UQz6u3oG6GUNn7_wosSM&m=r3JtGknlg70px5yvRWhv1Zl7r4WNJKqtaJd9HISLW8E&s=pPjfizf2zAebxGKdA0tfJNJMfhG4rOM7lwPnfPMa14Q&e=>
>>>>> 0af047c817acbc67e61aa82f0b43a54d61b753f8) (
>>>>> http://llvm.org/git/llvm.git
>>>>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_git_llvm.git&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=CnzuN65ENJ1H9py9XLiRvC_UQz6u3oG6GUNn7_wosSM&m=r3JtGknlg70px5yvRWhv1Zl7r4WNJKqtaJd9HISLW8E&s=nrLEvIb_FdlnMl1MALmnNd72UDSWQ11U46obfWTKRRA&e=>
>>>>> 9a9ee6f550c0789053c260203aea8430a34554fe)
>>>>> Target: x86_64-pc-windows-gnu
>>>>> Thread model: posix
>>>>>  "E:\\llvm\\buildmingw64\\bin\\clang++.exe" -cc1 -triple
>>>>> x86_64-pc-windows-gnu -E -disable-free -disable-llvm-verifier
>>>>> -main-file-name - -mrelocation-model pic -pic-level 2 -mthread-model posix
>>>>> -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
>>>>> -target-cpu x86-64 -momit-leaf-frame-pointer -v -dwarf-column-info
>>>>> -resource-dir "E:\\llvm\\buildmingw64\\bin\\..\\lib\\clang\\3.7.0"
>>>>> -internal-isystem "C:\\msys2_64\\mingw64\\x86_64-w64-mingw32\\include\\c++"
>>>>> -internal-isystem
>>>>> "C:\\msys2_64\\mingw64\\x86_64-w64-mingw32\\include\\c++\\x86_64-w64-mingw32\\"
>>>>> -internal-isystem
>>>>> "C:\\msys2_64\\mingw64\\x86_64-w64-mingw32\\include\\c++\\backward"
>>>>> -internal-isystem
>>>>> "C:\\msys2_64\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\4.9.2\\include\\c++"
>>>>> -internal-isystem
>>>>> "C:\\msys2_64\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\4.9.2\\include\\c++\\x86_64-w64-mingw32\\"
>>>>> -internal-isystem
>>>>> "C:\\msys2_64\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\4.9.2\\include\\c++\\backward"
>>>>> -internal-isystem
>>>>> "E:\\llvm\\buildmingw64\\bin\\..\\lib\\clang\\3.7.0\\include"
>>>>> -internal-isystem
>>>>> "C:\\msys2_64\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\4.9.2\\include"
>>>>> -internal-isystem
>>>>> "C:\\msys2_64\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\4.9.2\\include-fixed"
>>>>> -internal-isystem "C:\\msys2_64\\mingw64\\x86_64-w64-mingw32\\include"
>>>>> -internal-isystem "C:\\msys2_64\\mingw64\\include" -fdeprecated-macro
>>>>> -fdebug-compilation-dir "E:\\llvm\\buildmingw64\\bin" -ferror-limit 19
>>>>> -fmessage-length 0 -mstackrealign -fno-use-cxa-atexit -fobjc-runtime=gcc
>>>>> -fcxx-exceptions -fexceptions -fdiagnostics-show-option -o - -x c++ -
>>>>> clang -cc1 version 3.7.0 based upon LLVM 3.7.0svn default target
>>>>> x86_64-pc-windows-gnu
>>>>> ignoring nonexistent directory
>>>>> "C:\msys2_64\mingw64\x86_64-w64-mingw32\include\c++"
>>>>> ignoring nonexistent directory
>>>>> "C:\msys2_64\mingw64\x86_64-w64-mingw32\include\c++\x86_64-w64-mingw32\"
>>>>> ignoring nonexistent directory
>>>>> "C:\msys2_64\mingw64\x86_64-w64-mingw32\include\c++\backward"
>>>>> ignoring nonexistent directory
>>>>> "C:\msys2_64\mingw64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++"
>>>>> ignoring nonexistent directory
>>>>> "C:\msys2_64\mingw64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\x86_64-w64-mingw32\"
>>>>> ignoring nonexistent directory
>>>>> "C:\msys2_64\mingw64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\backward"
>>>>> #include "..." search starts here:
>>>>> #include <...> search starts here:
>>>>>  E:\llvm\buildmingw64\bin\..\lib\clang\3.7.0\include
>>>>>  C:\msys2_64\mingw64\lib\gcc\x86_64-w64-mingw32\4.9.2\include
>>>>>  C:\msys2_64\mingw64\lib\gcc\x86_64-w64-mingw32\4.9.2\include-fixed
>>>>>  C:\msys2_64\mingw64\x86_64-w64-mingw32\include
>>>>>  C:\msys2_64\mingw64\include
>>>>> End of search list.
>>>>>
>>>>> I assume this patch only meant to fix the official mingw-builds?
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>>> cfe-dev mailing list
>>>>>> cfe-dev at cs.uiuc.edu
>>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> cfe-dev mailing list
>>>>> cfe-dev at cs.uiuc.edu
>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>>>>
>>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150707/48ca8c21/attachment.html>


More information about the cfe-dev mailing list