Visual Studio 2012

Visual Studio 2012

Bild des Benutzers paul3579

I'm trying out the release candidate of Visual Studio 2012. tbb_exception.h does not compile due to use of std::copy_exception(). I'm having a hard time finding any info on this method. Is it really part of the std namespace? Will VS2012 be supported soon? Thanks, Paul

22 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.
Bild des Benutzers Vladimir Polin (Intel)

Hello, you are right, the issue is the same for clang (http://software.intel.com/en-us/forums/showthread.php?t=102603&o=a&s=lr), C++x0std::copy_exception was renamed tostd::make_exception_ptr in final version of C++11 standard. So you need to either rename it in the header or define /DTBB_USE_CAPTURED_EXCEPTION=1 to not use exception_ptr like for old compilers. We are working on how is better to support both cases at once (i.e. vs2010 and vs2012). thanks for the report --Vladimir Update - details on the issue: http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#1130

Bild des Benutzers Sergey Kostrov
Quoting paul3579 I'm trying out the release candidate of Visual Studio 2012. tbb_exception.h does not compile due to use of std::copy_exception(). I'm having a hard time finding any info on this method. Is it really part of the std namespace?

I just done verifications with different versions/editions ofVisual Studioand MinGW. Here are results:

- Visual Studio 2005 Professional Edition- 'copy_exception' is not supported

- Visual Studio 2008Express Edition- 'copy_exception' is not supported

- Visual Studio 2010Express Edition- 'copy_exception' issupported in 'exception' header file

-MinGW v3.4.2- 'copy_exception' is not supported

I don'tthinkthat Microsoft will remove that support inVisual Studio 2012.

Bild des Benutzers Vladimir Polin (Intel)
Quoting Sergey Kostrov

I don'tthinkthat Microsoft will remove that support inVisual Studio 2012.

I bet it will since it is out of C++11 standard.

--Vladimir

Bild des Benutzers Sergey Kostrov
Quoting Vladimir Polin (Intel)
Quoting Sergey Kostrov

I don'tthinkthat Microsoft will remove that support inVisual Studio 2012.

I bet it will since it is out of C++11 standard...

That is possible. But, Microsoft is "famous" for braking or ignoring,too some degree, standards. OpenGL and OpenMP are
the best examples.

Bild des Benutzers klaim

Looks like you're wrong. Currently Microsoft make sure to be as close as possible to the C++ standard, and the previous naming was intended to provide the functionality before standardization, making it obvious that if you used it you would be potentially subject to need to change the code in former versions of the compiler.

I don't know what you mean by OpengGl?

--------

So, I took the last TBB release file and tryed to compile the tbb project in VS2012.
After having replaced std::copy_exception to std::make_exception_ptr, I got this strange error and I can't find how to fix it:

2>atomic_support.obj : error LNK2026: module unsafe for SAFESEH image.
2>lock_byte.obj : error LNK2026: module unsafe for SAFESEH image.
2>     Creating library E:\[...]\tbb_debug.lib and object E:\[...]\tbb_debug.exp
2>E:\[...]\tbb_debug.dll : fatal error LNK1281: Unable to generate SAFESEH image.

Any idea?

Bild des Benutzers klaim

The only solution to this problem I found so far is to deactivate SAFESEH from the project file... Any better idea.

Bild des Benutzers Sergey Kostrov
Quoting klaim The only solution to this problem I found so far is to deactivate SAFESEH from the project file... Any better idea.

I just looked at MSDN and your simplesolution looks good. Also, this is whatMSDN says:

Error LNK2026:
/SAFESEH was specified, but a module was not compatible with the safe exception handling feature. If you want to use
this module with /SAFESEH, then you will need to recompile the module using the Visual C++ .NET 2003 (or later) compiler.

Did you try to re-build the TBB librarywith /SAFESEH?

Bild des Benutzers iliyapolak

That is possible. But, Microsoft is "famous" for braking or ignoring,too some degree, standards. OpenGL and OpenMP are
the best examples

IIRC OpenGL is layered on the top of Direct3D.

Bild des Benutzers klaim
Quoting Sergey Kostrov

Did you try to re-build the TBB librarywith /SAFESEH?

It IS when I have this flag set that I have this error.

What I did, to be precise, is :

1. get the TBB sources archive file
2. open tbb project file in VS2012, which trigger the automatic project conversion (because the other one was from older vs version)
3. after project conversion, I have a cmake script injecting this tbb project in my big set of projects

So, the /SAFESEH flag is set "by default".
It's the assembly code makes the flag trigger the link error. If I set /SAFESEH:NO it works.

I checked: the problem occurs only with converted project files as the compiler needs to be sure it is compatible with the new runtime. So, here the problem is that it would compile if the assembly code was not present (and considered not compatible with the crt or something like that). Compiling without the flag might hide a potential problem if I understood correctly.
I guess a good way to fix this would be to use std::atomic instead of providing the assembly code, OR to provide it in a way that makes it compiled by the C++ compiler instead of a separate compiler (because it seems it's compiled separately.

My understanding of the problem is obviously not complete, but I also need to be sure that using tbb on a recent VS compiler will no generate hard to spot problems...

Bild des Benutzers Sergey Kostrov
Quoting klaim ...
2. open tbb project file in
VS2012, which trigger the automatic project conversion (because the other one was from older vs version)...
My understanding of the problem is obviously not complete, but I also need to be sure that using tbb on a
recent VS compiler will no generate hard to spot problems...

Unfortunately, I can't verify it because I have Visual Studios 2005 Pro, 2008Pro / Express and 2010Express, and
there are no any plans to buy the2012 version.

I just checked a version of TBB installed on my primary development machine and it is aCommercially Alligned version 4 Update 3.
Also, there are only 5 *.asm files in different TBB folders. What asm-file is causing that problem?

Bild des Benutzers klaim

Yes not all the assemby files are in the VS project file, some are in but marked as to be ignored (I tried only with a 32bit build). The active ones: -itbb/src/tbb/ia32-masm/atomic_support.asm -itbb/src/tbb/ia32-masm/lock_byte.asm The ignored ones but visible in the project once open in VS: - itbb/src/tbb/intel64-masm/atomic_support.asm -itbb/src/tbb/intel64-masm/intel64_misc.asm These last files are deactivated because it's a 32bit target I am building for the moment. You should be able to see them by getting the last archive and opening the tbb.vsproj file with whatever VS you have.

Bild des Benutzers klaim

paul3579> Read the beginning of the thread, there is already an answer about this.

Bild des Benutzers Sergey Kostrov
Quoting klaim ...
1. get the TBB sources archive file
2. open tbb project file in VS2012, which trigger the automatic project conversion (because the other one was from older vs version)
3. after project conversion, I have a cmake script injecting this tbb project in my big set of projects

So, the /SAFESEH flag is set "by default".
It's the assembly code makes the flag trigger the link error.

If I set /SAFESEH:NO it works...

I verified Update 1 and Update 3 of TBB version 4. For a 32-bitTBB DLL librarytwo asm-files are always compiled:

..\ia32-masm\lock_byte.asm
..\ia32-masm\atomic_support.asm

andfor both asm-files a project option'Use Safe Exception Handlers' was set to 'No' ( in both TBB releases ).
It looks like some changes are made in a latest release of TBB.

Bild des Benutzers klaim

I see. I've read the CHANGES file but I see nothing related to this. Should this option be changed back to NO for these files for the next release?

Bild des Benutzers Sergey Kostrov
Quoting klaim I see. I've read the CHANGES file but I see nothing related to this. Should this option be changed back to NO for these files for the next release?

It is not clear. I think TBB developers should explain why the option was changedto 'Yes'.

Bild des Benutzers klaim

I just upgraded to v4.1 Update 2 and this "error LNK2026: module unsafe for SAFESEH image." problem isn't fixed yet.

It's annoying because I can't automate easily the change in the VS project file and I have to remember what it was about each time I upgrade TBB.

Bild des Benutzers klaim

I just upgraded to v4.1 Update 2 and this "error LNK2026: module unsafe for SAFESEH image." problem isn't fixed yet.

It's annoying because I can't automate easily the change in the VS project file and I have to remember what it was about each time I upgrade TBB.

Bild des Benutzers pkshan

Hello

I've the same problem & found the solution, it's simple... just enable safeseh for atomic_support.asm & lock_byte.asm,

(right click the asm files: Properties\Microsoft Macro Assembler\Advanced\Use Safe Exception Handlers)

Bild des Benutzers klaim

Once again, the fix is easy and already reported, but hard to automatize with scripts to integrate tbb into a project and be able to update it easily.

Bild des Benutzers Vladimir Polin (Intel)

Right,

We are looking how to support all 3 versions of visual studio without such issues and not introducing extra overhead...

--Vladimir

Bild des Benutzers klaim

Would switching to a meta-build system (CMake, premake, whatever) help with this? It seem that, past the learning time and the time necessary to write the scripts, there would be a possibility to generate different setups for these files depending on which visual studio the user wants to use.

Melden Sie sich an, um einen Kommentar zu hinterlassen.