2013/4/2 Baruch Burstein <bmburst...@gmail.com>

> Just to clarify that I understand the process:
> The GCC implementation of <thread> and friends (part of the libc or libgcc
> or libstdc++ or whatever the GCC standard library is called) really uses
> pthread calls under the hood. Changing that would mean changing the code of
> the standard library implementation. So in order to use those headers, an
> implementation of pthreads needs to exist and be available to the linker =>
> winpthreads. Is this correct?
>

Yes. It is actualy libgcc that provides an "abstraction" in the form of
"gthreads" internally used by libstdc++ (and other languages' standard
libraries) to implement the "top-level" functionality.

>
> I assume that these builds automatically have -lwinpthreads or whatever
> the correct name is added to the linking command, since it would be needed
> for every compilation? Does just using a static CRT give me a static
> winpthreads, too, or are they separate?
>

libgcc != crt. The C library you will link too is msvcrt.dll, which is a
Windows system library present on every system. libgcc is a compiler suppor
library providing tons of miscellaneous functionality required to make the
generated code work. You can link to libgcc statically by adding
-static-libgcc to the linker commandline, to libstdc++ by adding
-static-libstdc++ and everything static (including a static winpthreads, if
the libraries are available) by using plain -static.

If you want a static winpthreads but shared libgcc/libstdc++, you'll need
to remove libwinpthread.dll.a from your toolchain directory. Your mileage
may vary. Note my current builds only work with -static, I omitted the
known fix for this issue from my recent builds.


>
> Would having one build with winpthreads bundled into the libstdc++.dll (or
> whatever it is) not work?
>

Sure, it might work, but I'm no going to hack that into GCC's brittle build
system.

Ruben


>
>
> On Tue, Apr 2, 2013 at 12:38 PM, Ruben Van Boxem <vanboxem.ru...@gmail.com
> > wrote:
>
>> 2013/4/2 Baruch Burstein <bmburst...@gmail.com>
>>
>>> Can you explain the difference from your "regular" builds? Does
>>> std::thread not work with them? If I use std::thread, do I need to
>>> link/distribute any additional libraries? Or are there special licenses
>>> issues?
>>> In short: Why 2 separate builds?
>>>
>>
>> std::thread (and other stuff like <mutex>) only works on the builds
>> labeled "stdthread'. The difference is that gcc is built based on the posix
>> threading model using the winpthreads library. The result is a libstdc++
>> that has multithreading functionality. The affected headers are <thread>,
>> <mutex>, <condition_variable>, and <future>. <atomic> has always worked and
>> will continue to work without posix threading.
>>
>> You will need to additionally distribute the winpthreads dll if you do
>> not link statically. There are no licensing issues, as the winpthreads code
>> is placed in the Public Domain in the same way the rest of the MinGW-w64
>> headers and crt are.
>>
>> The two builds are incompatible due to the difference in libgcc. All code
>> has to be recompiled with the same toolchain.
>>
>> I have two builds because currently enabling posix threading (like in the
>> std::thread builds) makes libgcc depend on winpthreads. This is not a
>> problem for most people, but it does make even C code not using pthreads
>> that depends on libgcc (pretty much all code compiled by gcc depends on
>> libgcc), depend on winpthreads as well.
>>
>> Ruben
>>
>>
>>>
>>> On Tue, Mar 26, 2013 at 9:02 PM, Ruben Van Boxem <
>>> vanboxem.ru...@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> I have uploaded a new GCC 4.8 experimental std::thread build. Nothing
>>>> fundamentally changed since the previous posix-threaded builds.
>>>>
>>>> Enjoy,
>>>>
>>>> Ruben
>>>>
>>>> Find the goodies here:
>>>>
>>>> http://sourceforge.net/projects/mingw-w64/files/Toolchain%20sources/Personal%20Builds/rubenvb/experimental/
>>>>
>>>> http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/rubenvb/gcc-4.8-experimental-stdthread/
>>>>
>>>> http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/rubenvb/gcc-4.8-experimental-stdthread/
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Own the Future-Intel&reg; Level Up Game Demo Contest 2013
>>>> Rise to greatness in Intel's independent game demo contest.
>>>> Compete for recognition, cash, and the chance to get your game
>>>> on Steam. $5K grand prize plus 10 genre and skill prizes.
>>>> Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
>>>> _______________________________________________
>>>> Mingw-w64-public mailing list
>>>> Mingw-w64-public@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>>>>
>>>>
>>>
>>>
>>> --
>>> ˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Own the Future-Intel(R) Level Up Game Demo Contest 2013
>>>
>>> Rise to greatness in Intel's independent game demo contest. Compete
>>> for recognition, cash, and the chance to get your game on Steam.
>>> $5K grand prize plus 10 genre and skill prizes. Submit your demo
>>> by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2
>>>
>>> _______________________________________________
>>> Mingw-w64-public mailing list
>>> Mingw-w64-public@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>>>
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> Own the Future-Intel(R) Level Up Game Demo Contest 2013
>> Rise to greatness in Intel's independent game demo contest. Compete
>> for recognition, cash, and the chance to get your game on Steam.
>> $5K grand prize plus 10 genre and skill prizes. Submit your demo
>> by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2
>> _______________________________________________
>> Mingw-w64-public mailing list
>> Mingw-w64-public@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>>
>>
>
>
> --
> ˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
>
>
> ------------------------------------------------------------------------------
> Own the Future-Intel(R) Level Up Game Demo Contest 2013
> Rise to greatness in Intel's independent game demo contest. Compete
> for recognition, cash, and the chance to get your game on Steam.
> $5K grand prize plus 10 genre and skill prizes. Submit your demo
> by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2
> _______________________________________________
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
>
------------------------------------------------------------------------------
Own the Future-Intel(R) Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest. Compete 
for recognition, cash, and the chance to get your game on Steam. 
$5K grand prize plus 10 genre and skill prizes. Submit your demo 
by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to