Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. QT static hot does it build ?
QtWS25 Last Chance

QT static hot does it build ?

Scheduled Pinned Locked Moved Installation and Deployment
12 Posts 6 Posters 4.8k 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.
  • B Offline
    B Offline
    bu7ch3r
    wrote on last edited by
    #1

    When you build qt static it generates only libs or it makes libs+dlls?

    for(int i = 200; i > 0;)
    try
    {
    //do something
    }
    catch(...)
    {
    i--;//try again
    }

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      Hi,

      first of all, I assume you are on windows (as you talk about .dll and .lib and not about .so and .a)?

      A static library does not have a dll. A dll is a dynamic link linbrary, which implies, it's dynamically linked. A dll that exports symbols, also has a .lib file which contains the fuinction offsets, not more.

      A static library only consits of .lib files which are much bigger, as they are only object containers.

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bu7ch3r
        wrote on last edited by
        #3

        Hi, yes indeed it's windows:) I am trying to build QT static with MYSQL driver using nmake. I can't figure how.

        for(int i = 200; i > 0;)
        try
        {
        //do something
        }
        catch(...)
        {
        i--;//try again
        }

        1 Reply Last reply
        0
        • D Offline
          D Offline
          ddurhamdavyandbeth.com
          wrote on last edited by
          #4

          Running configure with -static will build only .libs. I don't believe you can configure with -static and -dynamic at the same time anyhow.

          Also, I HIGHLY recommend making sure you disable demos and examples when building static (and almost never for that matter) otherwise you're likely to fill up your disk with libraries/object files and executable taking up many many GB. Not to mention that it compiles much faster without them.

          I'm not sure if there's a standard way to do it. Don't see an explicit configure flag for it. But one option (what I do) is to edit projects.pro before running configure. Just add "QT_BUILD_PARTS = tools libs" as the first line of projects.pro.

          1 Reply Last reply
          0
          • B Offline
            B Offline
            bu7ch3r
            wrote on last edited by
            #5

            Ok I undestand how linking works. Because qt static uses only libs I must link against mysql when i build. However while building qt I get strange errorrs regarding MSVCR that is allready defined. I have compiled QT with /MT flag and the single error I got was of an undefined symbol: "instance_plugin_mysql" or somenthin... Is there a good documentation regarding building mysql driver/plugin on a static version of qt? I want everything to be in a single .exe file ?

            for(int i = 200; i > 0;)
            try
            {
            //do something
            }
            catch(...)
            {
            i--;//try again
            }

            1 Reply Last reply
            0
            • L Offline
              L Offline
              lgeyer
              wrote on last edited by
              #6

              [quote author="Davy Durham" date="1322622374"]I'm not sure if there's a standard way to do it.[/quote]
              -nomake part is what you are looking for, eg. -nomake examples -nomake demos -nomake tests.

              1 Reply Last reply
              0
              • B Offline
                B Offline
                bu7ch3r
                wrote on last edited by
                #7

                I know that: my configure command looks like:

                configure -release -nomake examples -nomake demos -no-exceptions -no-stl -no-rtti -no-qt3support -no-scripttools -no-openssl -no-opengl -no-webkit -no-phonon -no-style-motif -no-style-cde -no-style-cleanlooks -no-style-plastique -plugin-sql-mysql -I C:\mysql\include -L C:\mysql\lib -l mysqlcient

                nmake

                But I get compilation errors regarding sql I have also tryed -qt-sql-mysql, linking with libmysq not mysqlclient but with no success...

                Should I build mysql before configuring ?

                for(int i = 200; i > 0;)
                try
                {
                //do something
                }
                catch(...)
                {
                i--;//try again
                }

                1 Reply Last reply
                0
                • Q Offline
                  Q Offline
                  qtd1d1
                  wrote on last edited by
                  #8

                  Do I get it right, that you have to include all your libraries in your configure command ? I thought that Qt static only contains the qt libraries.

                  Can't you define your external libraries in your project file?

                  1 Reply Last reply
                  0
                  • B Offline
                    B Offline
                    bu7ch3r
                    wrote on last edited by
                    #9

                    It's about mysql driver wich is dependent by the mysql libs. Mysql has different license so qt cannot deploy mysql driver built in. Documentation says that you shall build it yourself... The problem is that I don't know how! I mean I know how but I get a lot of errors on compile.

                    for(int i = 200; i > 0;)
                    try
                    {
                    //do something
                    }
                    catch(...)
                    {
                    i--;//try again
                    }

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      ddurhamdavyandbeth.com
                      wrote on last edited by
                      #10

                      Also note that it's not possible to use dynamic plugins when building Qt statically (at least that's how I read: http://doc.qt.nokia.com/latest/plugins-howto.html (c.f. "Static Plugins"))

                      Not sure if that answers your question, but might be worth noting.

                      1 Reply Last reply
                      0
                      • P Offline
                        P Offline
                        phonesystems
                        wrote on last edited by
                        #11

                        Well got my doubt cleared for how so many object files were created...It was so because I did not disable the demos and examples so these files were also stored..!!

                        [url=http://www.chesstelecom.com/business-broadband]Business broadband and phone[/url]

                        1 Reply Last reply
                        0
                        • B Offline
                          B Offline
                          bu7ch3r
                          wrote on last edited by
                          #12

                          I have resolved the issue. First I have compiled qtsqlmysql.lib using lib+dll(libmysql.lib) just to import simbols(so dll is not needed). When compiling the app I had to set the linker to ignore libcmt.lb and added mysqlclient.lib befoere qtsqlmysql.lib. A bit complicated I must say.

                          for(int i = 200; i > 0;)
                          try
                          {
                          //do something
                          }
                          catch(...)
                          {
                          i--;//try again
                          }

                          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