OPENCV_CAN_BREAK_BINARY_COMPATIBILITY needs clarification (Bug #2358)
Description
When compiling OpenCV 2.4.2 with OPENCV_CAN_BREAK_BINARY_COMPATIBILITY enabled it is crucial to also set this flag in the code that links against OpenCV. Otherwise, weird errors can occur because the binary becomes incompatible.
As far as I have seen, no OpenCV CMake option requires the user to add extra flags to the project that links against OpenCV.
Therefore, this option needs a very clear clarification, in bold large letters. Because the resulting errors (stack overflow for instance) are almost impossible to trace back to this.
The reason for the binary incompatibility is that with the flag enabled the OpenCV binary will contain virtual destructors for certain classes. When compiling your own program and not setting the flag explicitly, the compiler will not see these d'tors and the function addresses become mixed up, wreaking havok.
I could actually see this happen in the debugger (VS 2008).
Please keep in mind that I'm NOT talking about binary compatibility between versions (which it will obviously break), but between what is being compiled and what is being used.
Associated revisions
Merge pull request #2358 from rohitgirdhar:rotatedRect
History
Updated by Vadim Pisarevsky over 12 years ago
Hi! This option is intended for internal testing purposes only; it will likely be removed by the official 2.4.3 release. So, just always set OPENCV_CAN_BREAK_BINARY_COMPATIBILITY=OFF or assume that there is no such option at all.
- Assignee set to Andrey Kamaev
- Category set to build/install
- Status changed from Open to Cancelled