-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing DEBUG macro #11311
Comments
A workaround is that you use CMake Release or RelWithDebInfo builds, not Debug one |
Tried it, but doesn't work. When we are building our framework in Debug mode, but using Release GDAL libraries, we are getting SEH expception. When building Release and RelWithDebInfo (with |
ah yes, that's a Windows thing where the ABI of the C++ standard library changes between debug and release. Nothing that GDAL can do about. |
Yep. Actually, my idea now is to backport the fix from #11314. So if the version is <= 3.10.0, that it adds the flag to the imported target. However, this would possibly break the vcpkg setup, because for some reason it runs without the flag. That's why I'm currently still looking for what the vcpkg port does differently. Btw: We need for Linux also a separate Debug build as we compile our framework with |
Ok I think I found the reason, why vcpkg works for us. As we are still using GDAL 3.8.5 there, so this commit is still not relevant for us: bfed070. As vcpkg builds the dependencies the So without testing: Could be it, that |
What is the bug?
Currently we have issues switching from an old GDAL version (3.3.3 - nmake build systems) to a new one (3.5+ - cmake build system) as the linker fails in debug mode. Specifically, we have the linker problem with
OGRSpatialReference::FindMatches
.With vcpk, on the other hand, we don't have the linker issue. That's why I used
dumpbin
to inspect thegdald.lib
:dumpbin
with GDAL compiled via vcpkg:?FindMatches@OGRSpatialReference@@QEBAPEAPEAUOGRSpatialReferenceHS@@PEAPEADPEAHPEAPEAH@Z
(
public: struct OGRSpatialReferenceHS * __ptr64 * __ptr64 __cdecl OGRSpatialReference::FindMatches(char * __ptr64 * __ptr64,int * __ptr64,int * __ptr64 * __ptr64)const __ptr64
)dumpbin
with self compiled GDAL:?FindMatches@OGRSpatialReference@@QEBAPEAPEAXPEAPEADPEAHPEAPEAH@Z
(
public: void * __ptr64 * __ptr64 __cdecl OGRSpatialReference::FindMatches(char * __ptr64 * __ptr64,int * __ptr64,int * __ptr64 * __ptr64)const __ptr64
)As you can see, the return type differs. The reason for this is this:
For some reason
DEBUG
is defined during building self compiled GDAL, but during compiling via vcpkg. Unfortunately, I have not yet found where this macro is defined, as it is not actually a predefined one (_DEBUG
is predefined, but notDEBUG
, see here). If you create a simple CMake project that has only one executable, set the debug mode in MSVC, and copy in the above#ifdef
from GDAL, you will also see thatDEBUG
is not defined this case.So the question is: Where is
DEBUG
defined? And shouldn't it be exported so that it is active for the GDAL headers when it is included?Steps to reproduce the issue
Versions and provenance
Windows 10/11
Additional context
No response
The text was updated successfully, but these errors were encountered: