1

I have made the appropriate modification as found in this thread to enable the Qt sqlite plugin to load extensions. However, when I run SELECT load_extension('spatialite_mod'), I now get the error The specified module could not be found

On a Windows Qt installation, where do I need to put the spatialite_mod.dll file so that it can be found a runtime? I have already tried putting it in the binary directory without any success.

Community
  • 1
  • 1
user8908459
  • 537
  • 5
  • 24

1 Answers1

1

This turned out to be a multi-part problem.

The answer to the original question is that Qt looks for the libraries in the working directory (QDir::currentPath()) and in the Windows PATH.

Part 1:

On Windows, the specified module could not be found error also can mean that one of mod_spatialite.dll dependencies was not found. In my case, I had forgotten to move these dependencies to the same directory as mod_spatialite.dll. They include:

  • libgcc_s_dw2-1.dll
  • libstdc++-6.dll
  • libsqlite3-0.dll
  • libxml2-2.dll
  • zlib1.dll
  • libfreexl-1.dll
  • libgeos_c-1.dll
  • libgeos-3-5-0.dll
  • libiconv-2.dll
  • liblzma-5.cll
  • libproj-9.dll

Part 2:

The libgcc_s_dw2-1.dll and libstdc++-6.dll libraries shipped with libspatialite do not work with Windows 10. Read more about this here and here. They would crash the program when loaded. The fix for me was to grab the same libraries from my Qt installation at C:\Qt\5.11.3\mingw53_32.

user8908459
  • 537
  • 5
  • 24