Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. [Solved] Using foreign library in static build

[Solved] Using foreign library in static build

Scheduled Pinned Locked Moved 3rd Party Software
7 Posts 2 Posters 3.1k Views 1 Watching
  • 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.
  • M Offline
    M Offline
    moonrising
    wrote on last edited by
    #1

    My problem is my static build of my program chrashes with foreign DLL.
    I can use it without any problems when I start the program from Qt Creator, but I want to use the program without Qt, like a standalone exe with some DLL's if needed.
    I read somewhere that I need a static build, so I downloaded Qt and built it statically myself, just as a tutorial said.
    The tutorial: "http://qt-project.org/wiki/How-to-build-a-static-Qt-for-Windows-MinGW":http://qt-project.org/wiki/How-to-build-a-static-Qt-for-Windows-MinGW

    I use win8.1 and Qt 5.2.1 with MinGW

    When I build the program statically there are now warnings or errors, everything goes smooth.
    Although I built it statically the program still requires some Qt DLL files like:

    • icudt51, icuin51, icuuc51
    • libgcc_s_dw2-1
    • libstdc++-6
    • libwinpthread-1
    • Qt5Code, Qt5Gui, Qt5Widgets
    • and the foreign library DLL's I downloaded of course

    After building the program statically, and I start the exe I get errors of these DLL's missing so I copy them to one directory.
    After all the DLL's are in one dir with the exe, the program finally starts, and works just as intended.
    The problem is, when others run my program on their computer.
    !http://www.wiliam.com.au/content/upload/blog/worksonmymachine.jpg(Works on my machine)!
    When they start the exe my program starts and works indeed UNTIL the program needs to use the foreign DLL's. Then the program chrashes (windows message program has stopped working or something)

    My questions are:

    • Is there a way to statically build my program without needing like 10 Qt DLL's?
    • How do I use foreign DLL in my static program?

    Please don't say something like "you need to build those foreign DLL's yourself" (couldn't make it, even with tutorials) but then how come it works on my computer
    or "there is already a topic about this" because I searched for it and what I found didn't help at all.

    Thanks in advance!

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

      Hi,

      Did you check if these dll's had any dependencies ? You can use Dependency Walker for that.

      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
      • M Offline
        M Offline
        moonrising
        wrote on last edited by
        #3

        Hi SGaist!
        I tried Dependency Walker
        No error or warning messages when loading DLL
        !https://i.imgur.com/e1joUqm.png(My DLL)!

        I'm pretty sure this is the DLL that chrashes my program.
        As far as I can tell from the image everything seems to be fine.
        Any other ideas?

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

          I'd say MinGW vs Visual Studio clash

          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
          • M Offline
            M Offline
            moonrising
            wrote on last edited by
            #5

            [quote author="SGaist" date="1416698014"]I'd say MinGW vs Visual Studio clash[/quote]

            I tested it on another machine which has Qt with MSVC and works as intended. It seems it only works on a machine with Qt installed.
            What can be the problem? Is it some DLL in the windows folder? Some registry entry? Some Qt system variable?

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

              Taking deployment considerations outside, it's more a problem of using a library built for Visual Studio with a Qt built with MinGW.

              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
              • M Offline
                M Offline
                moonrising
                wrote on last edited by
                #7

                [quote author="SGaist" date="1416699642"]Taking deployment considerations outside, it's more a problem of using a library built for Visual Studio with a Qt built with MinGW. [/quote]

                This was it. I -stole- borrowed the DLL I needed from another MinGW project and now it works just as intended on other computers as well, although I'm not using the static build, so I have like 50 MB of DLL's but the point is it works.

                Thank you SGaist!

                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