Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Where does the Qt sqlite plugin look for extension libraries
QtWS25 Last Chance

Where does the Qt sqlite plugin look for extension libraries

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 3 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    j_omega
    wrote on last edited by
    #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.

    1 Reply Last reply
    0
    • J Offline
      J Offline
      j_omega
      wrote on last edited by
      #8

      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.

      1 Reply Last reply
      2
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi,

        Did you try to pass the full file path ?

        Or if you have it one the same folder as your application, "./name.dll".

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • J Offline
          J Offline
          j_omega
          wrote on last edited by
          #3

          Yes, I have tried both of these options as well as adding ".dll" to the end.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            MrShawn
            wrote on last edited by
            #4

            Did you place it in the application directory folder?

            J 1 Reply Last reply
            0
            • M MrShawn

              Did you place it in the application directory folder?

              J Offline
              J Offline
              j_omega
              wrote on last edited by
              #5

              @MrShawn Yes, I tried that. I also tried one directory higher since that is what QDir::currentPath() returns when called immediately before the load_extension call.

              1 Reply Last reply
              0
              • M Offline
                M Offline
                MrShawn
                wrote on last edited by
                #6

                What about relative to your driver? I see that they get the driver from the DB object so my guess is either relative to the driver or the .db file.

                For example when running through the qt creator IDE it should look at the folder which contains the sql drivers(unless you have put your dependencies in your local build folder).

                On my Qt version 5.12.0 64 bit mingw that folder is located here: C:\Qt\5.12.0\mingw73_64\plugins\sqldrivers

                Did you try that?

                I tried googling a bit and only see code examples but no statements on WHERE the extension should be placed...

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #7

                  Can you provide a minimal compilable example ?
                  This way we may also test on our end to find out.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    j_omega
                    wrote on last edited by
                    #8

                    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.

                    1 Reply Last reply
                    2
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #9

                      Thanks for the detailed feedback !

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved