2

I'm developing on QT an application that uses GDAL library (which I compiled using MinGW 4.8). When I use the application on my windows 8 laptop, it works fine, but when I tried using it on several windows 7 computers it crashes as soon as I use the GDAL dll.

Mapper::Mapper() {
GDALAllRegister();
...
}

My program didn't send any error, but when I looked in the eventlog I saw this:

Faulting application name: MainApp.exe, version: 0.0.0.0, time stamp: 0x00000000
Faulting module name: ntdll.dll, version: 6.1.7601.18247, time stamp: 0x521ea8e7
Exception code: 0xc0000374
Fault offset: 0x000ce753
Faulting process id: 0x12fc
Faulting application start time: 0x01cfc5ade29fe9d9
Faulting application path: C:\Users...\release\MainApp.exe
Faulting module path: C:\Windows\SysWOW64\ntdll.dll
Report Id: 3e036714-31a1-11e4-8ac1-bc7737c9ef36

Fault bucket , type 0
Event Name: APPCRASH
Response: Not available
Cab Id: 0

Problem signature:
P1: MainApp.exe
P2: 0.0.0.0
P3: 00000000
P4: StackHash_940e
P5: 6.1.7601.18247
P6: 521ea8e7
P7: c0000374
P8: 000ce753
P9:

Any ideas what may be causing this?

1
  • Where do you get GDAL dll/lib? Does it compiled with the same compiler than your program? What happen if launch your program in debug mode? Feb 1, 2017 at 7:52

2 Answers 2

1

I experienced a similar problem. I use Windows 7. I compiled the binaries for MinGW using the steps found on this page http://trac.osgeo.org/gdal/wiki/BuildingWithMinGW (I could not find prebuilt binaries for MinGW, the links in the documentation were a dead end). The produced DLL and LIB files were linked correctly but my program still crashed. I also had installed the GDAL command line app previously. It turned out the DLL and EXE file for the command line app were 64 bit and they somehow interfered with the 32 bit DLL/compiler. Once I deleted the command line app everything worked correctly.

Make sure your build kit in Qt is using the same compiler you used compile the GDAL binaries.

Also, here is the code I used to link to the GDAL DLL.

unix|win32: LIBS += -L$$PWD/../../../../../MinGW/msys/1.0/local/lib/ -llibgdal #path to GDAL DLL

INCLUDEPATH += $$PWD/../../../../../MinGW/msys/1.0/local/include #path to header includes
DEPENDPATH += $$PWD/../../../../../MinGW/msys/1.0/local/include #path to header includes
1
  • Thanks, I also compiled using the same steps (the link is still dead). It sounds like there is some kind of mixup in the dlls loaded, since in my computer the ntdll loaded is the 64bit version, and in the windows 7 it is the 32bit. Do you know how can I force loading the correct bitness version? Thanks!
    – yotam
    Sep 3, 2014 at 15:00
1

Make sure you set the environment variables. Check that the GDAL DLLs of the right bitness on your path.

SysWOW64 indicates to me that you're trying to run 32-bit on a 64-bit OS.

4
  • Thanks for the answer. I tried now to explicitly set my GDAL_DATA and GDAL_DRIVER_PATH, but the app still crashes when loading drivers. Also - I know that I'm running a 32-bit application. It's due to the need to also support 32-bit systems. Is that the problem?
    – yotam
    Sep 2, 2014 at 8:49
  • No, not a problem. Just make sure your paths are pointing to the 32-bit version of GDAL. you might want to get Dependency Walker (dependencywalker.com) and make sure your dependencies are being met. Also don't forget the PROJ_LIB environment variable. Simplest thing might be to run the sdkshell.bat file in the GDAL distribution folder, and then run your app from that command prompt to see if environment is set up correctly. Also, why not just download the prebuilt GDAL binaries?
    – Reilly
    Sep 2, 2014 at 13:25
  • Dependency Walker is a great tool THX! Anyway, I didn't find anything new about it. I did try to run the class separately without loading any of the QT dlls and everything was OK, so I'm guessing there is some problem with the integration. also - I tried using the prebuilt binary but the link was dead.
    – yotam
    Sep 3, 2014 at 14:56
  • How about right-click on the .exe, select properties, and change compatibility mode to XP? If DepWalker didn't show you errors, then the good news is that all the DLLs are on your computer. Is your Win 8 laptop, where it works, 32-bit? If not then we may be barking up the wrong tree.
    – Reilly
    Sep 4, 2014 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.