QMAKE_POST_LINK failures don't re-try on the next build?



  • I use QMAKE_POST_LINK for my post build steps (a python script) (so i can move the project to a different computer and not have to manually create post build steps in the build config)

    But if that post link step fails, i go and fix the python script. then when i go back and hit build again, it doesn't re-attempt the post link step.

    is this a bug in Qt Creator?


  • Lifetime Qt Champion

    Hi,

    No it's not related to Qt Creator at all. What happens is that in fact no build happens since your application was already built thus nothing is linked therefore the post link step is not called.



  • oh, so "linking" is not actually considered a build step (when i hit "build") ?
    i totally thought it was. in my thinking, if Qt Creator knows that the build was successful but the link was not, then next time i "build", i would have expected it to just attempt to link again.


  • Lifetime Qt Champion

    You misunderstood me: the second time you hit build, nothing happens because there is nothing to do.

    Let's rewind:

    • You change your application code
    • You hit the build button (first time)
    • Your code is built
    • Your objects are linked
    • Your post link step is called

    So far so good.

    Now:

    • You modify your post link script (so unrelated to your application code)
    • You hit the build button (so second time)
    • No code was modified so nothing is built
    • Nothing was built so nothing needs to be linked
    • Nothing was linked so there's no post link action

    An easy work around to that is to take of your source file, "touch it" and then build again.



  • well, so this is what i'm seeing:

    • You change your application code
    • You hit the build button (first time)
    • Your code is built
    • Your objects are linked
    • Your post link step is called
    • the post link step FAILS <--- this is the problem

    here's what i expect:

    • You modify your post link script (so unrelated to your application code)
    • You hit the build button (so second time)
    • No code was modified so nothing is built
    • Nothing was built so nothing needs to be linked
    • since post-link FAILED last time, re-run the post link action

    IMHO, post-link is PART of linking. if linking fails (including post-link) then you HAVE to re-do it. i consider this a bug.


  • Lifetime Qt Champion

    Post link is not part of link, it happens after it when linking happened and succeeded. Like I wrote before, the second time, there's no linking happening so there's no post linking to be run.



  • okay, so i get it that it's not part of linking.

    my question remains: how can i get the compiler to see a post-link failure as something to re-attempt the next time i build?


  • Lifetime Qt Champion

    Like I suggested before, the quick and easy solution is to "touch" one of the source file so the next build will do something.



  • yes i know i can do that, but that's the point, the IDE should track that, not me.

    from my perspective, touching any source file, including the post link python script, is what should cause the IDE to KNOW to rebuild that file or rerun that script. having to remember to do it manually harkens back to the day when you had to manually re-compile a file you had touched, because the IDE didn't track that sort of thing, because there was no IDE to do so.

    in xcode there's a notion in any build step about "input files". you set any files as an input to the build step, then xcode tracks the mod dates of those files, and if any of those dates change between builds, that step is always re-run. it's a no brainer. computers should do our bidding and automate tedious tasks for us, we should not have to "work around" a limitation that can very easily be scripted.



  • what i did was make a new build step, reordered it to come FIRST, which just deletes the .exe (or .app). that way, the app is ALWAYS linked, and ALWAYS runs the post link step


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.