[gdal-dev] ERDASJP2 Debug builds crash
Emmet Spier
Emmet.Spier at 2d3.com
Tue May 31 07:20:56 EDT 2011
All,
I have been trying to build GDAL with ECWJP2 support. I have built a
test program using exactly the same build environment (vc80) and flags
as the gdal default gdal build enviroment. In Debug builds in or out of
the debugger I experience a crash in the ERDAS (debug) dll on
GDALClose(). Below I include full details demonstrating the vanilla test
carried out.
If anyone could offer thoughts on what I might be doing wrong I would be
very grateful.
Emmet.
----
I build gdal 1.8 using "nmake /f makefile.vc DEBUG=1" having set the ECW
variables in nmake.opt
------- BUILD EXTRACT FOLLOWS SHOWING 'Default' DEBUG BUILD ----------
D:\ThirdPartyBuilds\GDAL\yagb\gdal-1.8.0\frmts>cd ecw && nmake /nologo
/f makefile.vc && cd .. || exit 1
cl /nologo /MD /EHsc /Zi /W4 /D_CRT_SECURE_NO_DEPRECATE
/D_CRT_NONSTDC_NO_DEPRECATE /Fd..\..\gdal18.pdb /DDEBUG -I..\..\port
-I..\..\ogr -I..\..\gcore -I..\..\alg -I..\..\ogr\ogrsf_frmt
s -DHAVE_COMPRESS -DECWSDK_VERSION=41 -I"D:\Program Files
(x86)\ERDAS\ERDAS ECWJP2 SDK Desktop Read-Write"\include -I"D:\Program
Files (x86)\ERDAS\ERDAS ECWJP2 SDK Desktop Read-Write"\include/e
cw/api -I"D:\Program Files (x86)\ERDAS\ERDAS ECWJP2 SDK Desktop
Read-Write"\include/ecw/jp2 -I"D:\Program Files (x86)\ERDAS\ERDAS
ECWJP2 SDK Desktop Read-Write"\include/ecw/ecw -DFRMT_ecw -DOGR_
ENABLED /c ecwdataset.cpp
ecwdataset.cpp
cl /nologo /MD /EHsc /Zi /W4 /D_CRT_SECURE_NO_DEPRECATE
/D_CRT_NONSTDC_NO_DEPRECATE /Fd..\..\gdal18.pdb /DDEBUG -I..\..\port
-I..\..\ogr -I..\..\gcore -I..\..\alg -I..\..\ogr\ogrsf_frmt
s -DHAVE_COMPRESS -DECWSDK_VERSION=41 -I"D:\Program Files
(x86)\ERDAS\ERDAS ECWJP2 SDK Desktop Read-Write"\include -I"D:\Program
Files (x86)\ERDAS\ERDAS ECWJP2 SDK Desktop Read-Write"\include/e
cw/api -I"D:\Program Files (x86)\ERDAS\ERDAS ECWJP2 SDK Desktop
Read-Write"\include/ecw/jp2 -I"D:\Program Files (x86)\ERDAS\ERDAS
ECWJP2 SDK Desktop Read-Write"\include/ecw/ecw -DFRMT_ecw -DOGR_
ENABLED /c ecwcreatecopy.cpp
ecwcreatecopy.cpp
cl /nologo /MD /EHsc /Zi /W4 /D_CRT_SECURE_NO_DEPRECATE
/D_CRT_NONSTDC_NO_DEPRECATE /Fd..\..\gdal18.pdb /DDEBUG -I..\..\port
-I..\..\ogr -I..\..\gcore -I..\..\alg -I..\..\ogr\ogrsf_frmt
s -DHAVE_COMPRESS -DECWSDK_VERSION=41 -I"D:\Program Files
(x86)\ERDAS\ERDAS ECWJP2 SDK Desktop Read-Write"\include -I"D:\Program
Files (x86)\ERDAS\ERDAS ECWJP2 SDK Desktop Read-Write"\include/e
cw/api -I"D:\Program Files (x86)\ERDAS\ERDAS ECWJP2 SDK Desktop
Read-Write"\include/ecw/jp2 -I"D:\Program Files (x86)\ERDAS\ERDAS
ECWJP2 SDK Desktop Read-Write"\include/ecw/ecw -DFRMT_ecw -DOGR_
ENABLED /c jp2userbox.cpp
jp2userbox.cpp
xcopy /y /r /d /f *.obj ..\o
D:\ThirdPartyBuilds\GDAL\yagb\gdal-1.8.0\frmts\ecw\ecwcreatecopy.obj ->
D:\ThirdPartyBuilds\GDAL\yagb\gdal-1.8.0\frmts\o\ecwcreatecopy.obj
D:\ThirdPartyBuilds\GDAL\yagb\gdal-1.8.0\frmts\ecw\ecwdataset.obj ->
D:\ThirdPartyBuilds\GDAL\yagb\gdal-1.8.0\frmts\o\ecwdataset.obj
D:\ThirdPartyBuilds\GDAL\yagb\gdal-1.8.0\frmts\ecw\jp2userbox.obj ->
D:\ThirdPartyBuilds\GDAL\yagb\gdal-1.8.0\frmts\o\jp2userbox.obj
...
lib /nologo /out:gdal.lib port\*.obj gcore\*.obj alg\*.obj
frmts\o\*.obj ogr\ogrsf_frmts\ogrsf_frmts.lib ogr\ogr.lib
ogrsf_frmts.lib(resolvexlinks.obj) : warning LNK4221: no public symbols
found; archive member will be inaccessible
link /nologo /dll /INCLUDE:_OGRFeatureStylePuller
/INCLUDE:_OSRValidate /INCLUDE:_OPTGetProjectionMethods
/INCLUDE:_OGR_G_GetPointCount /INCLUDE:_OGRRegisterAll
/INCLUDE:_GDALSimpleIm
ageWarp at 36 /INCLUDE:_GDALReprojectImage at 48
/INCLUDE:_GDALComputeMedianCutPCT at 32 /INCLUDE:_GDALDitherRGB2PCT at 28
/INCLUDE:_OCTNewCoordinateTransformation at 8 port\*.obj gcore\*.obj
alg\*.obj frm
ts\o\*.obj ogr\ogrsf_frmts\ogrsf_frmts.lib ogr\ogr.lib
"D:\Program Files (x86)\ERDAS\ERDAS ECWJP2 SDK Desktop
Read-Write"\lib\vc80\win32\NCSEcw4d.lib "D:\Program Files
(x86)\ERDAS\ERDAS
ECWJP2 SDK Desktop Read-Write"\lib\vc80\win32\NCSUtil4d.lib "D:\Program
Files (x86)\ERDAS\ERDAS ECWJP2 SDK Desktop
Read-Write"\lib\vc80\win32\NCScnet4d.lib
odbc32.lib
odbccp32.lib user32.lib gcore\Version.res /out:gdal18.dll
/implib:gdal_i.lib /debug
------- BUILD EXTRACT END ----------
I then built a simple test app:
#include <cpl_conv.h>
#include <gdal.h>
#include <gdal_priv.h>
#include <windows.h>
#include <iostream>
int main ()
{
// DebugBreak();
unsigned int x_size = 100;
unsigned int y_size = 150;
unsigned int xstep = 1;
unsigned int pstep = 1;
unsigned int nplanes = 1;
unsigned int ystep = x_size * xstep;
void * data = malloc( y_size * ystep );
memset( data, 128, y_size * ystep );
// OEM License code for ERDAS ECW JPEG2000 compression capability
CPLSetConfigOption( "ECW_ENCODE_COMPANY", "" );
CPLSetConfigOption( "ECW_ENCODE_KEY", "" );
GDALAllRegister();
GDALDriver * pDriver = GetGDALDriverManager()->GetDriverByName(
"JP2ECW" );
if ( pDriver )
{
std::cout << "Creating" << std::endl;
GDALDataset * poDstDS = pDriver->Create( "jpeg2000test.jp2", x_size,
y_size, nplanes , GDT_Byte, NULL );
CPLErr err = poDstDS->RasterIO( GF_Write, 0, 0, x_size, y_size,
data, x_size, y_size, GDT_Byte, nplanes , NULL, xstep, ystep, pstep );
GDALClose( (GDALDatasetH) poDstDS );
std::cout << "Written" << std::endl;
}
else
{
std::cout << "jp2 Driver not found" << std::endl;
}
free( data );
return 0;
}
using a matched build line from the build extract above:
> cl /nologo /MD /EHsc /Zi /W4 /D_CRT_SECURE_NO_DEPRECATE
/D_CRT_NONSTDC_NO_DEPRECATE /DDEBUG -I..\include\ main.cxx
..\bin\Release\gdal_i.lib /link /debug
and when I run this program I get a memory access failure in a mutex in
the ERDAS library when GDALClose() is called:
NCSUtil4d.dll!NCS::CMutexLock::CMutexLock(NCS::CMutex *
pmMutex=0x0300cab8) Line 156 + 0x12 bytes C++
NCSEcw4d.dll!NCS::CView::SetFileInfo(NCSFileViewFileInfoEx & Info={...})
Line 1316 + 0x12 bytes C++
> gdal18.dll!GDALECWCompressor::Initialize(const char *
pszFilename=0x03008d78, char * * papszOptions=0x00000000, int
nXSize=100, int nYSize=150, int nBands=1, int bRGBA=0, GDALDataType
eType=GDT_Byte, const char * pszWKT=0x00000000, double *
padfGeoTransform=0x0300c6f8, int nGCPCount=0, const GDAL_GCP *
pasGCPList=0x00000000, int bIsJPEG2000=1) Line 910 + 0x29 bytes
C++
gdal18.dll!ECWWriteDataset::Crystalize() Line 1433 +
0x65 bytes C++
gdal18.dll!ECWWriteDataset::FlushLine() Line 1459 + 0x8
bytes C++
gdal18.dll!ECWWriteRasterBand::IWriteBlock(int
nBlockX=0, int nBlockY=0, void * pBuffer=0x03009290) Line 1561 + 0xb
bytes C++
gdal18.dll!GDALRasterBlock::Write() Line 518 C++
gdal18.dll!GDALRasterBand::FlushBlock(int nXBlockOff=0,
int nYBlockOff=0, int bWriteDirtyBlock=1) Line 1079 + 0x8 bytes C++
gdal18.dll!GDALDataset::BlockBasedFlushCache() Line 424
+ 0x12 bytes C++
gdal18.dll!ECWWriteDataset::FlushCache() Line 1366
C++
gdal18.dll!ECWWriteDataset::~ECWWriteDataset() Line
1345 C++
gdal18.dll!ECWWriteDataset::`vector deleting
destructor'() + 0x50 bytes C++
gdal18.dll!GDALClose(void * hDS=0x0300c648) Line 2380 +
0x20 bytes C++
main.exe!main() Line 44 C++
main.exe!__tmainCRTStartup() Line 597 + 0x17 bytes C
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110531/d183bd11/attachment-0001.html
More information about the gdal-dev
mailing list