Qt 4.x installation on Ubuntu 18.04

  • Hi. I'm a newbie and trying to install Qt on Ubuntu 18.04 so that I can use the Avogadro program, which requires Qt v.4. I've failed pretty miserably so far. Can anyone provide guidance or links to help me:

    1. Remove all traces of previous Qt installations
    2. Find, download, make, and install some version of Qt 4.x

  • Qt Champions 2018

    hi @Just_Liberty,

    can you tell us what you did install so far (and how)?

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    There's no need to search to manually install Qt 4. Just use the one provided by your distribution. At this point in time, it will be the latest version available.

  • @SGaist Thanks for the response. I've tried various "X" in "sudo apt-get install X where "X" was qt-4 and other variations and "Unable to locate package X" is always returned.

  • Lifetime Qt Champion

    What about
    sudo apt install qt4-default

  • Well that was easy! So, is that -default a Qtism, an Ubuntu-ism, a package-ism, or a Linux-ism? How would I find that out if I (you!) didn't know it? Thanks very much.

  • Qt Champions 2018

    @Just_Liberty probably Debian/Ubuntu.

    apt-cache search qt4 is your friend ;)

  • Qt Champions 2018

    @Just_Liberty It's how Ubuntu packages Qt, nothing related to Qt project. To find out what you need to install use what @aha_1980 suggested or "apt search".

  • Lifetime Qt Champion

    @Just_Liberty said in Qt 4.x installation on Ubuntu 18.04:

    Well that was easy! So, is that -default a Qtism, an Ubuntu-ism, a package-ism, or a Linux-ism? How would I find that out if I (you!) didn't know it? Thanks very much.

    Each Linux distribution has a package mechanism or rather each major distribution has. For example all Debian derivates like Ubuntu uses Debian's package manager. That's one of the first thing you should look for when installing one or the other flavours of Linux. Also note that most of them also have one or more GUI available so you don't necessarily have to go through the command line.

  • Qt Champions 2018

    @Just_Liberty To add to @SGaist : on Debian derivatives like Ubuntu you can install Synaptic - it is a graphical user interface for the packet manager.

  • As a matter of principle, I wouldn't use a GUI to help install under Linux, that's too helpful ;-)

    In addition to to @aha_1980's apt-cache search qt4 suggestion, be aware that the shell (bash) will (get apt to) suggest completions for installation packages just via the tab key on the command line. It's not an "in-string" search like apt-cache search, but it's a convenient starting point. So if you are interested in packages which might start with qt4, just type in

    apt-get install qt4

    and press the Tab key. That will expand to qt4- in this case, as that's the only completion here. Pressing Tab now a second time will list all the packages starting with qt4- (12 in my case). That's what I do when I know the prefix of the package but not what's available.

  • @aha_1980 Excellent-thanks for helping me on my way to minimal linux admin proficiency

  • @JonB Thanks for the tip. Minor note: I have to press tab 3 times, the 2nd returns nothing new. I'm (pleasantly) surprised bash can do completion in this context.

  • @Just_Liberty
    Heads-up, just to be clear about the "3 vs 2 times". (I see I mis-explained this above.) It depends when you started pressing Tab, and shell filename completion works the same:

    • If you start from apt-get install qt4, the only possible completions at that point all start with qt4- (note the hyphen). Pressing Tab once will append the hyphen and that's it at that point.

    • You now have apt-get install qt4-. At this point there are multiple possible completions all from qt4-. When you press Tab once nothings (seems to) happen (in fact, I think the terminal "bell" rings to tell you this), because the shell does not know what you want next. If you then press Tab a second time at this point it will list all the possible completions, so that you know what you might want to type next.

    Above is all default bash behaviour (can be modified). So if you start from apt-get install qt4 you will end up pressing Tab 3 times, if you start from apt-get install qt4- it will only be 2 Tabs. See?

    This is all worth knowing if you like bash filename completion. That has worked for years & years, back to UNIX days. What's new (to me, somewhere along the line) is that it used to be only filename completion. bash now seems to be "clever" and look at what you have to the left on the command-line and adjust what it does to the "context" of the command you're intending, e.g. gunzip <filename><TAB> only offers files ending in .gz, tar xf archive.tar <file-to-extract><TAB> looks inside the archive for filenames to offer, etc.! Often helpful, sometimes annoying! :)

  • Qt Champions 2018

    @JonB The logic behind this bash feature is called bash-completion and is of course adjustable ;)

  • @aha_1980
    Aha! [So to speak.] What do I say to my Linux admin expert friend who says/claims it does not work in his Ubuntu 16.04 when it's working for me in 18.04, I know it always used to work in 17.04, and I would have thought when I started it 16.04 it did? How long do you think that "customizable" bash completion has been available & implemented, is it really new?

  • Qt Champions 2018

    @JonB the feature in bash exists for over 10 years.

    If it's not working in some distro - ask the maintainers. I can't tell for 10.04 anymore, but in16.04 it's surely working. I use it myself, for example git.

  • @aha_1980 Perfect, I shall go tell my expert friend he is talking rubbish :)

Log in to reply

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