Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: The E on May 13, 2015, 03:31:24 am

Title: Visual Studio 2010 and C++11
Post by: The E on May 13, 2015, 03:31:24 am
As the discussion about this issue on github pointed out (https://github.com/scp-fs2open/fs2open.github.com/pull/50), we may soon find ourselves with a situation where MSVS 2010's compiler is insufficiently standards-compliant for our needs.

Luckily, there's an alternative. clang (http://clang.llvm.org/), an open-source compiler for C and C++, provides a toolset that is compatible with all VS versions from 2010 onward, which you can download here: http://llvm.org/builds/

Now, be aware that this is experimental for the moment. We will have to investigate if there are any issues being caused by using this toolset; if you find any, please report them either here or on Mantis.
Title: Re: Visual Studio 2010 and C++11
Post by: chief1983 on May 13, 2015, 07:11:28 am
Is it to the point that clang is a simple installer, and we could default 2010 to use it as long as it's in a default location or PATH or whatever?  We should probably update our README soon once the compiling options get sorted out on various platforms.

Also, we found a bug in the Apple clang with Xcode 5.1.1 which is the last version for OS X 10.8.  I will be seeing if it's fixed in Xcode 6.x soon,but dropping in an alternative clang compiler for Xcode could get us AddressSanitizer support on OS X too.  Apple has left that unavailable by default so far.
Title: Re: Visual Studio 2010 and C++11
Post by: The E on May 13, 2015, 07:18:55 am
It's a simple visual studio extension installer, you run it, and it's available as a toolset in the project settings thereafter. Theoretically, we could alter the VS2010 solution to default to that.
Title: Re: Visual Studio 2010 and C++11
Post by: m!m on May 13, 2015, 07:28:13 am
I don't think this will actually fix the issues that were discussed in the PR you linked to. I think the issue we currently have are caused by the STL implementation of VS2010 but they aren't actually caused by the compiler itself. I am not sure how clang handles it but I think it uses the MS STL implementation (at least I couldn't find an implementation in the headers the installer supplied) so it actually wouldn't solve our issues.
Title: Re: Visual Studio 2010 and C++11
Post by: Iss Mneur on May 13, 2015, 07:49:08 am
My daily driver is VS2010 so I will check out this pull request and the proposed solution this evening.

Having said that I do now have a more recent VS available so if it doesn't work out I am not stuck.
Title: Re: Visual Studio 2010 and C++11
Post by: chief1983 on May 13, 2015, 09:25:11 am
I do like that it has ASan in the clang builds.  Even those running newer versions could install this alongside to get an ASan FSO build on Windows.  That could be incredibly useful, if we can make sure we can get the output in the event of a crash :P

If it won't fix VS 2010, that's a bummer, but if we think it might, I can go ahead and give it a shot.
Title: Re: Visual Studio 2010 and C++11
Post by: chief1983 on May 13, 2015, 01:02:42 pm
Another downside is that clang can't work with the native MSVC 2010 debugger, as it only works with PDB, and clang can't output PDB information.  At least, according to this (http://stackoverflow.com/questions/12048312/clang-libc-libc-on-windows-with-debugging-symbols-compatible-with-visual-stud).
Title: Re: Visual Studio 2010 and C++11
Post by: Goober5000 on May 13, 2015, 01:40:01 pm
I don't think this will actually fix the issues that were discussed in the PR you linked to. I think the issue we currently have are caused by the STL implementation of VS2010 but they aren't actually caused by the compiler itself. I am not sure how clang handles it but I think it uses the MS STL implementation (at least I couldn't find an implementation in the headers the installer supplied) so it actually wouldn't solve our issues.

Don't forget we still have STLport in the FSO repository.  Have you tried using it as the STL implementation for Visual Studio 2010 instead of Microsoft's STL?
Title: Re: Visual Studio 2010 and C++11
Post by: m!m on May 13, 2015, 02:26:05 pm
As far as I can tell STLPort doesn't support C++11 (at least I couldn't find any indication of that in the headers).
Title: Re: Visual Studio 2010 and C++11
Post by: The E on May 14, 2015, 02:18:43 am
STLPort is a dead project, more or less. Their last release was in 2008.

Actually, not that dead. The last commit to their public repo was in 2012. Still, no releases or blog posts or anything.