Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

questions about make install and uninstall



  • Hi,

    I'm wondering how DESTDIR compares with other build systems. Sometimes i see make DESTDIR=/dir install like this . Is that usable with qmake as well?

    Also, i noticed that after qmake and make install and make uninstall, empty top level directories will remain . E.g. make install creates /opt/share/doc/<appname>/<filename>. And after make uninstall, /opt/share/doc/ is still there with nothing else in the directory since it was created by the make install. This seems to happen for every directory that was created to have other directories. Is this expected behaviour?



  • Can anyone comment on this?
    Or should this be asked in another part of the forum..?


  • Lifetime Qt Champion

    Hi,

    Please show some patience and allow at least 24 hours before bumping your own thread. This is a voluntary driven forum and people may not even live in the same time zone as you.

    As for your question, you should not try to hard code through qmake where your application should go. That's rather a choice for your users.



  • Hey @SGaist

    I will be more patient in the future. And i do appreciate the efforts of people like you responding as much as you do. They should pay you i think. Or give you a free lifelong license at least!

    As for my question, i'm not trying to hard code the final destination. But trying to understand what can be done for packaging. With GNU Autotools i see DESTDIR a lot for a temporary destination.

    The DESTDIR variable can be used to perform a staged installation. The package should be configured as if it was going to be installed in its final location (e.g., --prefix /usr), but when running make install, the DESTDIR should be set to the absolute name of a directory into which the installation will be diverted. From this directory it is easy to review which files are being installed where, and finally copy them to their final location by some means. (https://www.gnu.org/software/automake/manual/html_node/DESTDIR.html)


  • Lifetime Qt Champion

    Packaging is even a different thing. Can you explain what kind of package you want to create ?



  • Well for whatever Linux distro is being used. It can be accomplished with cp commands but if it can be done with a make command, it would be the more elegant solution i think. Since all the install sets are already defined in the project file for a make install.



  • Ok, it seems that for this purpose $INSTALL_ROOT exist. https://doc.qt.io/qt-5.9/deployment-android.html

    The documentation is a bit confusing/lacking at times when one expects to find the info in a certain place only to discover it on stackoverflow first and then on an android specific page...

    Which leaves the other question of the remaining empty directories, if anyone knows how to fix that?


  • Lifetime Qt Champion

    That's were there's something not clear. You are talking about packaging your application, yet you would use make install which implies compiled your code.

    So which is your use case ?



  • People, end user or packager, can download the code, qmake, make, make install. And in the case of creating a package, they can use make install with INSTALL_ROOT and then use the specific distribution's packaging method. Which uses the temporary install location which has the correct filesystem layout, to create a package.

    Makes sense?


  • Lifetime Qt Champion

    Yes it does, in the case if DESTDIR, it's rather for when you use the subdir template. For example to group your libs together. Nowadays, you would use it with OUT_PWD so you can easily use out of source build while having the option to structure your generated applications/libraries.



  • Ah i see. Well i just use the app template.

    The other question i had about the empty directories not getting removed, is because the Makefile has a plain rmdir for the DEL_DIR variable. Changing that with rmdir -p fixes it. E.g. make uninstall DEL_DIR='rmdir -p'.


Log in to reply