Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29276 Discussions

Cannot used optimization O3 in debug mode?

Samba_Ba1
Beginner
1,473 Views
Hello all,

I have a fortran code using XE-12 on windows with dual core intel processor.
My code does not give the same results on optimization O3 than on normal run without optimization (Od).
I wanted to debug it but when I try to build the O3 on debug mode it gives the following erros:

[bash]1>libcmt.lib(invarg.obj) : error LNK2005: __initp_misc_invarg already defined in LIBCMTD.lib(invarg.obj)
1>libcmt.lib(invarg.obj) : error LNK2005: __call_reportfault already defined in LIBCMTD.lib(invarg.obj)
1>libcmt.lib(invarg.obj) : error LNK2005: __set_invalid_parameter_handler already defined in LIBCMTD.lib(invarg.obj)
1>libcmt.lib(invarg.obj) : error LNK2005: __get_invalid_parameter_handler already defined in LIBCMTD.lib(invarg.obj)
1>libcmt.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in LIBCMTD.lib(invarg.obj)
1>libcmt.lib(invarg.obj) : error LNK2005: "void __cdecl _invoke_watson(unsigned short const *,unsigned short const *,unsigned short const *,unsigned int,unsigned int)" (?_invoke_watson@@YAXPBG00II@Z) already defined in LIBCMTD.lib(invarg.obj)
1>libcmt.lib(invarg.obj) : error LNK2005: __invalid_parameter already defined in LIBCMTD.lib(invarg.obj)
1>libcmt.lib(invarg.obj) : error LNK2005: "void __cdecl _invalid_parameter(unsigned short const *,unsigned short const *,unsigned short const *,unsigned int,unsigned int)" (?_invalid_parameter@@YAXPBG00II@Z) already defined in LIBCMTD.lib(invarg.obj)
1>libcmt.lib(invarg.obj) : error LNK2005: ___pInvalidArgHandler already defined in LIBCMTD.lib(invarg.obj)[/bash]

Is it possible to parallel debug with O3?
How can I debug otherwise?

THanks for your help in advance.
Samba.
0 Kudos
5 Replies
timintel
Beginner
1,473 Views
The messages state that you are linking both the debug library and the non-debug library. If this is accidental, I suppose a reason could be that you haven't rebuilt all your .obj with the debug option.
0 Kudos
Samba_Ba1
Beginner
1,473 Views
Tim,

I have actually rebuild the entire solution but it is still showing the errors.
0 Kudos
jimdempseyatthecove
Honored Contributor III
1,473 Views
Build your standard Release configuration.
However, turn IPO off (Inter-Procedural Optimizations)
And, include Debug symbols (IOW do not strip debug symbols). Inspect both compiler and linker properties.

Break points may be somewhat difficult to set due to inlining and code optimizations. Sometimes you may need to insert a call to a non-inlined function in which you can place a break point (and step out of to get to code of interest).

Jim Dempsey
0 Kudos
Steven_L_Intel1
Employee
1,473 Views
The errors have nothing to do with optimization. It is that, as stated earlier, you have a mix of debug and non-debug libraries being linked in. Are you using libraries built elsewhere (not the compiler libraries). These may be built with other libraries specified.

You can try linking to the non-debug libraries - they won't prevent you from debugging. Under Fortran > Libraries, specify "Multithreaded (/MT)" and not "Multithreaded Debug (/MTd)" for the run-time libraries. If you are including a C/C++ project, set its libraries (under "Code Generation") to the same value.
0 Kudos
Samba_Ba1
Beginner
1,473 Views
Steve,

Thank you very much.
You were right, it works now that I set the options to Multithreaded/MT.

Kind regards,
Samba.
0 Kudos
Reply