Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Windows compilers and mean of life questions  (Read 3000 times)

0 Members and 1 Guest are viewing this topic.

SwinkiTrzy

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Windows compilers and mean of life questions
« on: October 08, 2015, 09:49:30 pm »
Assume
{
Noob= True;
};

There are a lot open source C++compilers for Windows, which all are called ‘MinGW’ – I mean Windows ports of GCC suite, which are ready to use and do not require recompiling. So I hope someone could answers simple questions – preferably in general if it possible, but also specific to SFML. A answers are welcome:
1)   what are differences between different distros of MinGW? Searching over the net I’ve recognized at least five distros of MinGW (probably missing a lot) and now I’m totally confused:
a.   sourceforge.net/projects/tdm-gcc/
b.   sourceforge.net/projects/mingw-w64/
c.   sourceforge.net/projects/mingw/
d.   sourceforge.net/projects/mingwbuilds/
e.   http://nuwen.net/mingw.html
2)   what are differences between different version numbers. For example, but I’m not sure, version number  4.9.x is compatible with c++11 but earlier are not – is that true? What about C++14? which GCC version number should one use?,
3)   what does it mean that TDM is not recommended (I believe I’ve seen such statement on SFML forum)
4)   What does it mean DW2 (Dwarf the second?), SJLJ (ShortJump LongJump?) and SHE  (Structural Exception Handling)?. Does it practical matter in context of SFML?
5)   Differences in: ‘Posix threads’ and ‘Win32 threads’ – also does it matter in SFML? Or for  precompiled libraries?
6)   what specifically C++ (Windows compiler) should I use if I see: ”GCC 4.9.2 MinGW (DW2)” on http://www.sfml-dev.org/download/sfml/...”?   7)   

PS. I know that eXpl0it3r offers on his site precompiled SFML lib for a few compilers. Thanks!
 Thank you

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Windows compilers and mean of life questions
« Reply #1 on: October 08, 2015, 10:11:39 pm »
Short version: They mostly differ by source versions and settings (e.g. the mentioned options) and the people who provide them.

TDM is tricky because it statically links by default, which may cause other issues.

Posix threads vs. Win32 threads is also something tricky, because one of them (I think the Win32 library being used; don't remember specifically) has different licensing terms than the rest of the runtime. So if you just give someone your binary, you're possibly violating the license terms.

But to be honest, if you're new to this and you're not some fanatic "omg I can't use that!" guy, download and use Microsoft Visual Studio 2015 Community Edition. It's free to use unless you're part of a large company.

This saves you all those headaches for now and should give you an easy/easier start.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Windows compilers and mean of life questions
« Reply #2 on: October 08, 2015, 10:53:37 pm »
There are basically two source bases, the original MinGW project and the MinGW-w64 project.
The original MinGW project isn't very actively maintained anymore, has/had quite a few issues (e.g. regarding C++11 features) and does not provide an 64bit compiler.
The MinGW-w64 project is actively maintained and already up-to-date with GCC 5.2, plus I have yet to run into any issues with C++11/14 features.

Now from these two source bases exist multiple builds, i.e. someone grabbed the source and compiled the compiler. Such builds are for example the TDM builds, the nuwen builds, the MinGW-w64 Builds and a bunch of others. All of the mentioned builds are using the MinGW-w64 source base by now.
The TDM builds have quite a few quirks, the most prominent and in my opinion a deal-breaker is that by default the runtime libraries are linked statically. Every other GCC based (and Clang based) compiler acts differently and thus all build scripts you find out there will expect things to work differently, meaning unless a build script is explicitly adjusted for the TDM compilers, it won't be fully compatible with the TDM builds. This is why I advocate whenever I have the chance to not use TDM builds.
The nuwen builds are created by S.T.L. the guy behind Visual Studios implementation of the STL (standard library). In addition to the GCC toolchain you'll also get a few libraries pre-compiled including boost, zlib, SDL and a bunch more. One issue that these builds sometimes have is that there's no mingw32-make.exe which for example CMake is looking for when you use the MinGW Makefile generator, but this is a minor issue and can easily be fixed.
The MinGW-w64 Builds are my favorite builds because they come in various configurations and are usually updated very quickly. I've been using them for a long time and haven't noticed any issues. There are many options which I'll go into further down.

DW2, SJLJ and SEH are exception models, meaning they are different implementation of exception handling. It really doesn't matter which model you use. If you research them a bit then you'll find that some yield "better" performance and some can be used to throw across OS calls or similar. But again it doesn't matter, especially not for SFML.

POSIX threads and Win32 threads specify what implementation for threading is used. The important point is that if you want to use std::thread you'll have to use the POSIX threading model, which unfortunately will pull in the winpthread library that you either have to ship the DLL of or link it statically (only link statically if you also link the runtime libs statically). I've no idea what Mario said about the licensing.

As for version numbers, they match the GCC version numbers. The newest version you currently can get it GCC 5.2. The 4.9.2 packages you see on the download page used this package. If you want to use the pre-built libs you have to use that exact compiler.

My personally recommendation is to get the MinGW-w64 installer, download the latest version and build SFML and any other library from source.
It's simple and doesn't give you any headaches as others seem to suggest...
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

SwinkiTrzy

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: Windows compilers and mean of life questions
« Reply #3 on: October 09, 2015, 06:40:56 pm »
Thank you for a such comprehensive answers. You've dispelled a lot of my doubts. Not everything is still clear for me, but it is understandable for a newcomer.