Using the /RTC option without specifying a debug runtime will lead to linker errors
Hi I'm trying to track down a very nasty stack corruption bug in my release code and therefore I would like to enabled the Visual C++ RTCs option to enable runtime stack checks in my release build, however when I try to do this I get an "Incompatible build options" error from the boost libraries. Specifically I get this from boosts AutoLink.hpp: #if defined(__MSVC_RUNTIME_CHECKS) && !defined(_DEBUG) # pragma message("Using the /RTC option without specifying a debug runtime will lead to linker errors") # pragma message("Hint: go to the code generation options and switch to one of the debugging runtimes") # error "Incompatible build options" #endif It seems to be suggesting that in order to use /RTC I need to do a Debug build, buts that's exactly what I don't want to do... I need to enable Runtime Checks in the Release build! Is there any way to get this to work in a release build that uses boost? Does anyone know the details of the incompatibility? Surely /RTC doesn't require all linked in DLLs also to be compiled with /RTC? Thanks in advance. Ben This email is from Verint Systems UK Ltd and is confidential. If you have received it in error, please advise us and then delete the original and any attachments it may have contained. Verint Systems UK Ltd does not accept any responsibility for viruses. Verint Systems UK Ltd is a limited company registered in England and Wales at 241 Brooklands Road, Weybridge, Surrey KT13 0RH ,registration number 2602824. VAT registration number GB566153238.
I’m trying to track down a very nasty stack corruption bug in my release code and therefore I would like to enabled the Visual C++ RTCs option to enable runtime stack checks in my release build, however when I try to do this I get an “Incompatible build options” error from the boost libraries. Specifically I get this from boosts AutoLink.hpp:
#if defined(__MSVC_RUNTIME_CHECKS) && !defined(_DEBUG)
# pragma message("Using the /RTC option without specifying a debug runtime will lead to linker errors")
# pragma message("Hint: go to the code generation options and switch to one of the debugging runtimes")
# error "Incompatible build options"
#endif
It seems to be suggesting that in order to use /RTC I need to do a Debug build, buts that’s exactly what I don’t want to do… I need to enable Runtime Checks in the Release build!
"/RTC cannot be used with compiler optimizations " http://msdn.microsoft.com/en-us/library/8wtf2dfz(v=VS.100).aspx
"/RTC cannot be used with compiler optimizations " http://msdn.microsoft.com/en-us/library/8wtf2dfz(v=VS.100).aspx
Thanks for your reply Igor, I'm aware of that /RTC cannot be used with optimizations and therefore I disabled them (/Zd If I remember correctly), however I still get the boost error. Thanks Ben This email is from Verint Systems UK Ltd and is confidential. If you have received it in error, please advise us and then delete the original and any attachments it may have contained. Verint Systems UK Ltd does not accept any responsibility for viruses. Verint Systems UK Ltd is a limited company registered in England and Wales at 241 Brooklands Road, Weybridge, Surrey KT13 0RH ,registration number 2602824. VAT registration number GB566153238.
"/RTC cannot be used with compiler optimizations " http://msdn.microsoft.com/en-us/library/8wtf2dfz(v=VS.100).aspx
Thanks for your reply Igor, I'm aware of that /RTC cannot be used with optimizations and therefore I disabled them (/Zd If I remember correctly),
Well, if you don't mind to disable optiomizations, then what do you mean by saying "release build"?
however I still get the boost error.
I believe, you have to compile with /MTd (or /MDd, if you link CRT dynamically). See "C/C++" --> "Code generation" page.
"/RTC cannot be used with compiler optimizations " http://msdn.microsoft.com/en-us/library/8wtf2dfz(v=VS.100).aspx Thanks for your reply Igor, I'm aware of that /RTC cannot be used with optimizations and therefore I disabled them (/Zd If I remember correctly), Well, if you don't mind to disable optiomizations, then what do you mean by saying "release build"?
Thanks again Igor, As I'm sure you're aware a Debug build is much more than a Release build with the optimizations disabled. I basically want a Release build but with the Stack Checking enabled (Temporarily whilst I investigate a stack corruption bug). If I do a debug build of my code then I'll have to copy over 100 other debug DLLs onto the test system to get it up and running.
however I still get the boost error. I believe, you have to compile with /MTd (or /MDd, if you link CRT dynamically). See "C/C++" --> "Code generation" page.
That's what I don't want. This seems to be a restriction that Boost is imposing as I can safely enable the /RTCs option on Release builds of projects that don't use Boost. So it sounds like there isn't a real workaround then? Thanks Ben This email is from Verint Systems UK Ltd and is confidential. If you have received it in error, please advise us and then delete the original and any attachments it may have contained. Verint Systems UK Ltd does not accept any responsibility for viruses. Verint Systems UK Ltd is a limited company registered in England and Wales at 241 Brooklands Road, Weybridge, Surrey KT13 0RH ,registration number 2602824. VAT registration number GB566153238.
This seems to be a restriction that Boost is imposing as I can safely enable the /RTCs option on Release builds of projects that don't use Boost.
So it sounds like there isn't a real workaround then?
Are you linking a boost lib or dll instead of just using header files? Perhaps try rebuilding the boost lib/dll with optimizations off and rtc checks on and then relink. I can't see any reason why the boost code itself would care one or the other about those settings. But, it might make sense if the pre-built lib files are simply incompatible with them. -- Bill
participants (3)
-
Bill Buklis
-
Igor R
-
Sleat, Ben