Updating Qmake



  • I just updated my version of QT from 4.5 to 4.7.1 . However, I can't seem to be able to update qmake to make point to the newer libraries. I have ran " qmake -query " in terminal and it keeps pointing to the older version (QT_VERSION:4.5.3) I have tried setting the $path to point to the new location but still no luck. I also added the new location to QT Creator preferences and while I can add it there when I try to build my application it keeps looking to the older libraries. I also tried to change the quake variables using "qmake -set" but even there I made a mistake and now I have two identical variables. Is there any way to delete a variable once it is created. Any help with this would be greatly appreciated. Also is there any way to delete the older version completely?


  • Moderators

    Hm, you throw in a lot of info, but there are gaps. Let's try solving this. How exactly did you try to replace qmake in PATH?

    It's very strange that Qt Creator looks for older qmake, it does not do that, usually. Are you sure your shiny 4.7.1 has qmake, and that it was properly compiled, and that it runs without errors? Try looking into <your qt dir>/bin for qmake, and running it on one of your projects, to see if it works.

    I don't install Qt into path myself (I'm using multiple Qt versions, so I keep PATH clean to avoid errors. Well, more or less :) ), so it might be that I am missing something here, too.



  • Regarding the command line:
    If you add the new Qt location the usual way (appending to PATH - notice that it's all upper case, it does make a difference!), then you will not catch the new version. If you type qmake the shell looks in the contents of PATH in order and uses the first directory which contains the executable. Since the new directory is last, it won't be searched at all because the older Qt installation is earlier in the path.

    Regarding Qt Creator:
    You will have to add the new Qt version to the list of available versions in the general settings, that's what you did already. You also must change the used Qt version for each project and build configuration (debug/release) manually. If you don't the settings will still use the older Qt version. You might want to consider setting the "default Qt version" in the single projects and make your new Qt version the default version.



  • Thank you both for the reply. Here is my situation. I had installed QT 4.5.3 to develop a plugin for maya 2011. And while that worked I needed to update my version of QT version for Maya 2012 to QT 4.7.1 Also because the good folks at Autodesk have made changes to the QT libraries to work with maya and some other issues I have to compile the plugin from the command line using a custom make file. Anyway, after installing 4.7.1 I tried to add the line
    @#include <QtDeclarative>@ and I get and error saying that QtDeclarative cannot be found. However I looked through the 4.7.1 install and it is definitely there as well as qmake. I then ran the command "qmake -v" in the termainal and it reads

    @QMake version 2.01a
    Using Qt version 4.5.3 in /Library/Frameworks@

    Then I ran qmake -query and it reads

    @QT_INSTALL_DATA:/usr/local/Qt4.5
    QT_INSTALL_DOCS:/Developer/Ducuments
    QT_INSTALL_DOCS::/Users/myHomeDir/qt-4.7.1/doc
    QT_INSTALL_PREFIX:/
    QT_INSTALL_DOCS:/Developer/Documentation/Qt
    QT_INSTALL_HEADERS:/usr/include
    QT_INSTALL_LIBS:/Library/Frameworks
    QT_INSTALL_BINS:/Developer/Tools/Qt
    QT_INSTALL_PLUGINS:/Developer/Applications/Qt/plugins
    QT_INSTALL_TRANSLATIONS:/Developer/Applications/Qt/translations
    QT_INSTALL_CONFIGURATION:/Library/Preferences/Qt
    QT_INSTALL_EXAMPLES:/Developer/Examples/Qt/
    QT_INSTALL_DEMOS:/Developer/Examples/Qt/Demos
    QMAKE_MKSPECS:/usr/local/Qt4.5/mkspecs
    QMAKE_VERSION:2.01a
    QT_VERSION:4.5.3@

    These are all pointing to the wrong directories for my 4.7.1. installation. Then I tried to change the Path variable to point to the correct qmake directory by adding it to .profile

    @##

    DELUXE-USR-LOCAL-BIN-INSERT

    (do not remove this comment)

    echo $PATH | grep -q -s "/usr/local/bin"
    if [ $? -eq 1 ] ; then
    PATH=$PATH:/Users/myHomeDir/qt-4.7.1/bin:/usr/local/bin
    export PATH
    fi
    @

    But sill no dice. I even deleted the all the paths in the .profile expecting there to be an error when I ran "qmake - query" again. But it read out as before with no problem. (So I am thinking that might not be where I am supposed to edit) Then as a last resort I tried to change the Qmake variables using "qmake - set" but apperently my syntax was not correct and instead of updating the variable it added a new one and now I cant find how to delete that. Now there are two QT_INSTALL_DOCS. :( Anyway, I am hoping you all might be able to help me sort this out.



  • Ok so I found the solution. I had to change the path in the /private/etc/paths file. And for anyone else who may run into this problem here is what I ended up doing:

    I ran this in the terminal
    @sudo vi /etc/paths@ (This opens the file with the vi editor)
    Then I added my new bin path to the front and saved it (I had to hit esc first then Shift Z to save it)

    Now everything is working correctly with the exception of there being that extra QT_INSTALL_DOCS variable which I still have not figured out how to delete.



  • Your shell snippet appends to the existing PATH, so the directory with the old Qt is still before the new one. This does the trick:

    @
    PATH=/Users/myHomeDir/qt-4.7.1/bin:$PATH
    @

    This way, your new Qt dir is first.


Log in to reply
 

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