Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Qt Creator debugging static lib

    General and Desktop
    5
    19
    9208
    Loading More Posts
    • 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
      mirswith last edited by

      Hi. I am using Qt Creator to create a static lib and in the same session have another project that links this static lib. I am having a problem with debugging. I can debug as usual however if I make a change in the static lib then I have to do a Rebuild All before I can debug the static lib, if I do not then it does not pick up the new build. I have tested this on Windows 7 as well as OSX.

      Any ideas?

      Thanks.
      -=ben

      1 Reply Last reply Reply Quote 0
      • G
        giesbert last edited by

        changes in the static lib require a new build of all projects. From my point of view, call make on the static lib and link on the executable should be enough.

        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 Reply Quote 0
        • M
          mirswith last edited by

          I agree, however this does not seem to be enough. I have my static lib set as a dependency to my main project and when I make a change it does build and link as I would expect.

          To throw another fly in the ointment it appears that if I turn of shadow builds then my problem goes away, however this sure makes my project folder over run with object files. Quit ugly. :/

          -=ben

          1 Reply Last reply Reply Quote 0
          • M
            mirswith last edited by

            I take that back, while turning off shadow builds lets me break into my static lib it does not actually update the code until I do a clean/build on the static lib... very strange.

            -=ben

            1 Reply Last reply Reply Quote 0
            • M
              mirswith last edited by

              Ok, I seem to be narrowing it down. The problem seems to be that Qt Creator does not detect that it needs to relink my static lib. In the Compile Output it seems to think nothing has changed, which is true for everything except that it needs to relink the static lib. I do have the static lib set as a Dependency in the Projects settings, is this a bug in Qt Creator or is there a way around this? This is Qt Creator 2.0.0 on OSX, I am installing the latest on my windows box and will be testing that once Qt finishes building.

              -=ben

              1 Reply Last reply Reply Quote 0
              • G
                goetz last edited by

                It's more a qmake problem. Qt Creator just calls qmake and make to build everything.

                http://www.catb.org/~esr/faqs/smart-questions.html

                1 Reply Last reply Reply Quote 0
                • G
                  giesbert last edited by

                  I think it's more a make than a qmake problem, isn't it?
                  If the pro is not changed, just make is called...

                  but is make called for both projects, or only for the projects ith changes?

                  so thejn it's a creator issue, as creator also calls make...

                  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 Reply Quote 0
                  • M
                    mirswith last edited by

                    Looking at the output it looks like just make is called, above that it says "Configuration unchanged, skipping qmake step.". Then in the make call it enters the shadow directory, then spits out "nothing to be done", leaves the directory and exist.

                    -=ben

                    1 Reply Last reply Reply Quote 0
                    • G
                      goetz last edited by

                      [quote author="mirswith" date="1300225793"]Looking at the output it looks like just make is called, above that it says "Configuration unchanged, skipping qmake step.". Then in the make call it enters the shadow directory, then spits out "nothing to be done", leaves the directory and exist.

                      -=ben[/quote]

                      That's expected behavior :-)

                      http://www.catb.org/~esr/faqs/smart-questions.html

                      1 Reply Last reply Reply Quote 0
                      • M
                        mirswith last edited by

                        Shouldn't it link the static lib though since changes in the static lib occurred?

                        -=ben

                        1 Reply Last reply Reply Quote 0
                        • G
                          goetz last edited by

                          only if you add to your .pro file:

                          @
                          PRE_TARGETDEPS = ../path/to/your/lib/liba.a
                          @

                          http://www.catb.org/~esr/faqs/smart-questions.html

                          1 Reply Last reply Reply Quote 0
                          • M
                            mirswith last edited by

                            AHHH.. THANK YOU! That is the bit of magic that I was missing. :D One would think that check marking the project as a Dependency in the Projects setting would accomplish this, but I am sure that would be WAY to easy! ;)

                            -=ben

                            1 Reply Last reply Reply Quote 0
                            • G
                              goetz last edited by

                              The dependency in the project configuration basically influences the build order (that's one thing that Creator handles itself). Without the PRE_TARGETDEPS (or one of its friends), the lib is not in the dependency list of qmake (and subsequently of the Makefile) and so none of the tools cares if it changed.

                              http://www.catb.org/~esr/faqs/smart-questions.html

                              1 Reply Last reply Reply Quote 0
                              • T
                                tobias.hunger last edited by

                                mirswith: The inter-project dependencies have severe limitations. In fact we discussed to remove them again...

                                Please use your build system to link to sub-projects together. All of them provide means to add proper dependency tracking between (sub-)projects. We do not want to introduce a similar logic into creator itself: It would be prone to errors, hardly tested and will require the developer to understand a new set of dependency logics in addition to the one already required by the build system.

                                1 Reply Last reply Reply Quote 0
                                • G
                                  goetz last edited by

                                  Tobias, but there will remain a configuration option to set the build order in Qt Creator?

                                  http://www.catb.org/~esr/faqs/smart-questions.html

                                  1 Reply Last reply Reply Quote 0
                                  • T
                                    tobias.hunger last edited by

                                    Volker: We only talked about it and did not change any code.

                                    1 Reply Last reply Reply Quote 0
                                    • G
                                      goetz last edited by

                                      Thanks Tobias for clarification. I like the dependency tool, but it would be sufficient for my use cases to set the build order. So, at least this should remain.

                                      http://www.catb.org/~esr/faqs/smart-questions.html

                                      1 Reply Last reply Reply Quote 0
                                      • T
                                        tobias.hunger last edited by

                                        mirswith: You could have actually used Qt Creators wizard to add a library. That does add the required qmake magic:-) Another hidden gem in Qt Creator...

                                        Open the .pro-file you want to add a library to. Right click anywhere in the editor and select "Add library" from the context menu to bring up a wizard to help with the task.

                                        Yes, that is very well hidden, I only found this by accident right now. I'll open a issue with our bug tracker to make that way more visible.

                                        1 Reply Last reply Reply Quote 0
                                        • D
                                          dialingo last edited by

                                          better use cmake for real projects.
                                          cmake rebuilds all libs and dependent executables when a source file changes. In qmake you need to specify dependencies and I found this all very fragile. The trolls continue to use qmake because of requirements you probably do not have, for example running on esoteric platforms, continuing backwards compatibility, etc.
                                          Give cmake a try!

                                          1 Reply Last reply Reply Quote 0
                                          • First post
                                            Last post