Yaron Keren
2014-Sep-24 09:56 UTC
[LLVMdev] RFC: LLVM should require a working C++11 <thread>, <mutex>, and <atomic>
Indeed, mingw and pthreads have C++11 atomics, so building clang (with atomics) should be possible even in cross compilation. I have no idea what is the win from *not* using winpthreads, it is one small DLL file with BSD license. For context (does not matter to mingw as host for buiilding clang but matters for clang running with mingw environment), clang TLS implementation is not same as mingw so atomics do not work for clang+mingw pthreads unless you replace libstdc++ with libcxx compiled by clang. Even there may be troubles with mingw-compiled libraries. libc++ could be built with mingw-w64. I had worked for a while with mingw-w64 distribution with the C++ includes and libstdc++ replaced by the libcxx files and dll respectively. It mostly works but there were many issues in tests. I'm not sure what is the value of this configuration unless it is start of road to independent clang-based 'gnu flavor' windows toolchain. 2014-09-24 9:06 GMT+03:00 Mueller-Roemer, Johannes Sebastian < Johannes.Sebastian.Mueller-Roemer at igd.fraunhofer.de>:> I would love to see libc++ working on Windows. In any case, I personally > use MinGW with pthreads, as that supports std::thread etc. Yes, it uses > libwinpthread, but that shouldn't really be an issue. > > > > -- > > Johannes S. Mueller-Roemer, MSc > > Wiss. Mitarbeiter - Interactive Engineering Technologies (IET) > > > > Fraunhofer-Institut für Graphische Datenverarbeitung IGD > > Fraunhoferstr. 5 | 64283 Darmstadt | Germany > > Tel +49 6151 155-606 | Fax +49 6151 155-139 > > johannes.mueller-roemer at igd.fraunhofer.de | www.igd.fraunhofer.de > > > > *From:* llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] *On > Behalf Of *Chandler Carruth > *Sent:* Wednesday, September 24, 2014 03:02 > *To:* LLVM Developers Mailing List; clang-dev Developers; > lldb-dev at cs.uiuc.edu; Chris Bieneman; Reid Kleckner; David Majnemer; Alex > Rosenberg; Zachary Turner > *Subject:* [LLVMdev] RFC: LLVM should require a working C++11 <thread>, > <mutex>, and <atomic> > > > > AKA: MinGW + win32threads is holding LLVM (and all of its subprojects) > back. We need to stop supporting this host platform. > > > > I'm aware of essentially 2 reasonably important use cases for supporting > MinGW + win32threads: > > > > 1) Sane host toolchain on Windows that doesn't require downloading MSVC. > (I'm dubious about the value of this one...) > > > > 2) Cross-compiling a Windows clang.exe (and other tools) from a Linux (or > other host) box. > > > > Are there others? (And thanks to Reid for explaining these to me!) > > > > > > I'm somewhat dubious about #1, but if we address #2 it will address any > concerns with #1 anyways. > > > > I would like to propose that we finish implementing libc++ sufficiently to > host Clang on Windows using native Windows APIs to implement things. Then > we document very clearly what is required to download the basic Windows SDK > and cross compile Clang (and any other tools) for Windows using just libc++ > and the SDK. No need for MSVC bits, etc. Would this be acceptable? > > > > If not, would it be acceptable to use libc++ on top of mingw (so just > avoiding libstdc++)? I *really* don't want to spend lots of time going > there because it seems like a low-value platform, but we can. > > > > Anyways, I want to tease out anything else required here because if this > is all we need, I think we can make it a reality and get to a much saner > platform. > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140924/58f8850b/attachment.html>
Mueller-Roemer, Johannes Sebastian
2014-Sep-24 09:59 UTC
[LLVMdev] RFC: LLVM should require a working C++11 <thread>, <mutex>, and <atomic>
<atomic> should work both in win32 and pthread versions of MinGW. <mutex> and <thread> are only supported in the pthread version though. -- Johannes S. Mueller-Roemer, MSc Wiss. Mitarbeiter - Interactive Engineering Technologies (IET) Fraunhofer-Institut für Graphische Datenverarbeitung IGD Fraunhoferstr. 5 | 64283 Darmstadt | Germany Tel +49 6151 155-606 | Fax +49 6151 155-139 johannes.mueller-roemer at igd.fraunhofer.de | www.igd.fraunhofer.de From: Yaron Keren [mailto:yaron.keren at gmail.com] Sent: Wednesday, September 24, 2014 11:56 To: Mueller-Roemer, Johannes Sebastian Cc: Chandler Carruth; LLVM Developers Mailing List; clang-dev Developers; lldb-dev at cs.uiuc.edu; Chris Bieneman; Reid Kleckner; David Majnemer; Alex Rosenberg; Zachary Turner Subject: Re: [LLVMdev] RFC: LLVM should require a working C++11 <thread>, <mutex>, and <atomic> Indeed, mingw and pthreads have C++11 atomics, so building clang (with atomics) should be possible even in cross compilation. I have no idea what is the win from *not* using winpthreads, it is one small DLL file with BSD license. For context (does not matter to mingw as host for buiilding clang but matters for clang running with mingw environment), clang TLS implementation is not same as mingw so atomics do not work for clang+mingw pthreads unless you replace libstdc++ with libcxx compiled by clang. Even there may be troubles with mingw-compiled libraries. libc++ could be built with mingw-w64. I had worked for a while with mingw-w64 distribution with the C++ includes and libstdc++ replaced by the libcxx files and dll respectively. It mostly works but there were many issues in tests. I'm not sure what is the value of this configuration unless it is start of road to independent clang-based 'gnu flavor' windows toolchain. 2014-09-24 9:06 GMT+03:00 Mueller-Roemer, Johannes Sebastian <Johannes.Sebastian.Mueller-Roemer at igd.fraunhofer.de<mailto:Johannes.Sebastian.Mueller-Roemer at igd.fraunhofer.de>>: I would love to see libc++ working on Windows. In any case, I personally use MinGW with pthreads, as that supports std::thread etc. Yes, it uses libwinpthread, but that shouldn't really be an issue. -- Johannes S. Mueller-Roemer, MSc Wiss. Mitarbeiter - Interactive Engineering Technologies (IET) Fraunhofer-Institut für Graphische Datenverarbeitung IGD Fraunhoferstr. 5 | 64283 Darmstadt | Germany Tel +49 6151 155-606 | Fax +49 6151 155-139 johannes.mueller-roemer at igd.fraunhofer.de<mailto:johannes.mueller-roemer at igd.fraunhofer.de> | www.igd.fraunhofer.de<http://www.igd.fraunhofer.de> From: llvmdev-bounces at cs.uiuc.edu<mailto:llvmdev-bounces at cs.uiuc.edu> [mailto:llvmdev-bounces at cs.uiuc.edu<mailto:llvmdev-bounces at cs.uiuc.edu>] On Behalf Of Chandler Carruth Sent: Wednesday, September 24, 2014 03:02 To: LLVM Developers Mailing List; clang-dev Developers; lldb-dev at cs.uiuc.edu<mailto:lldb-dev at cs.uiuc.edu>; Chris Bieneman; Reid Kleckner; David Majnemer; Alex Rosenberg; Zachary Turner Subject: [LLVMdev] RFC: LLVM should require a working C++11 <thread>, <mutex>, and <atomic> AKA: MinGW + win32threads is holding LLVM (and all of its subprojects) back. We need to stop supporting this host platform. I'm aware of essentially 2 reasonably important use cases for supporting MinGW + win32threads: 1) Sane host toolchain on Windows that doesn't require downloading MSVC. (I'm dubious about the value of this one...) 2) Cross-compiling a Windows clang.exe (and other tools) from a Linux (or other host) box. Are there others? (And thanks to Reid for explaining these to me!) I'm somewhat dubious about #1, but if we address #2 it will address any concerns with #1 anyways. I would like to propose that we finish implementing libc++ sufficiently to host Clang on Windows using native Windows APIs to implement things. Then we document very clearly what is required to download the basic Windows SDK and cross compile Clang (and any other tools) for Windows using just libc++ and the SDK. No need for MSVC bits, etc. Would this be acceptable? If not, would it be acceptable to use libc++ on top of mingw (so just avoiding libstdc++)? I *really* don't want to spend lots of time going there because it seems like a low-value platform, but we can. Anyways, I want to tease out anything else required here because if this is all we need, I think we can make it a reality and get to a much saner platform. _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu<mailto:LLVMdev at cs.uiuc.edu> http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140924/37c77d28/attachment.html>
David Chisnall
2014-Sep-24 15:00 UTC
[LLVMdev] RFC: LLVM should require a working C++11 <thread>, <mutex>, and <atomic>
On 24 Sep 2014, at 05:59, Mueller-Roemer, Johannes Sebastian <Johannes.Sebastian.Mueller-Roemer at igd.fraunhofer.de> wrote:> <atomic> should work both in win32 and pthread versions of MinGW. <mutex> and <thread> are only supported in the pthread version though.<atomic> is trivial, as most of the support is provided by the compiler. As of Vista, Windows comes with some quite sane primitives for implementing <mutex> and <thread>, so it would only be 1-2 days of work for someone to write the implementation for libc++. I'd suggest that the total effort that has gone into this thread so far is close to the amount of effort required to add the missing support... David