Opened 12 years ago

Closed 7 years ago

Last modified 5 years ago

#3346 closed defect (fixed)

Debug build of static library crashes on Windows

Reported by: Mateusz Łoskot Owned by: warmerdam
Priority: normal Milestone:
Component: ConfigBuild Version: svn-trunk
Severity: normal Keywords: msvc, debug, release, static, gdal.lib


It is a well-known issue that GDAL forces to link against /MD in nmake.opt CRT - Dynamic Link for Release configuration when building using Visual C++ compiler in debug mode:

nmake /f DEBUG=1

If user wants to link his application against GDAL static library (gdal.lib) and build be able to debug his application, what means linking against /MDd, then he should expect crashes, heap corruption and other serious problems. Shortly, the use of /MD effectively removes possibility to properly debug clients' programs.

In spite of what has been said and discussed so far, I think that use of /MD is a bad idea. This mechanism is consistent on Windows and it assumes that if software is compiled in Debug configuration, it happens on developer's environment, not on end-user's machine and all related components, especially those used in form of static library, are built in Debug configuration and linked against /MDd.

GDAL default settings are completely exotic here and ignore the recommendations for development in Windows environment. Thus, it is GDAL problem.

Other related tickets: #540, #850, #1647


Change History (5)

comment:2 by Jukka Rahkonen, 8 years ago

All three related tickets have been closed. Is this one still valid?

comment:3 by Jukka Rahkonen, 7 years ago

I still wonder if this issue is solved or not.

comment:4 by Mateusz Łoskot, 7 years ago

Resolution: wontfix
Status: newclosed

I opened this ticket to provoke some debate on that issue and collect all the details in one place. However, AFAIR, GDAL links against /MD instead of /MDd by design, and given 5 years without any changing decisions, the ticket can be closed as wontfix.

I'm closing it.

comment:5 by Even Rouault, 5 years ago

Resolution: wontfixfixed

In 40242:

nmake.opt: use /MDd for OPTFLAGS for DEBUG=1 builds (fixes #7059, fixes #6384, fixes #4291, fixes #3346, fixes #1647, fixes #540)

Note: See TracTickets for help on using tickets.