Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] QT5 for Debian Linux
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] QT5 for Debian Linux

Scheduled Pinned Locked Moved General and Desktop
10 Posts 2 Posters 58.2k Views 1 Watching
  • 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.
  • Z Offline
    Z Offline
    Zerby
    wrote on 1 Jan 2014, 20:17 last edited by
    #1

    Hello,

    I need QCryptographicHash.addData() -function to accept a QIODevice (QFile). This can be done with Qt5. Sadly, Qt5 isn't officially released for Debian (I mean you can't get it with apt-get install...)

    I found this: http://packages.debian.org/sid/qt5-default

    How can I use it? If I simply:

    @apt-get install qt5-default@

    I get an error:

    @E: Unable to locate package qt5-default@

    Now I suppose this is because it's not an official package, and I need to add it to /etc/apt/sources.list. Problem is, I don't know how? Has someone used this package, how can I install it?

    Thank you in advance!

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 1 Jan 2014, 21:34 last edited by
      #2

      Hi,

      If I saw things correctly, Qt 5 is available in the testing repositories (currently known as Jessie)

      You should either install a debian based on Jessie (so you only use packages from it) or add the repositories from Jessie in your sources.list (copy the lines from stable and change the target to testing), sync and install Qt 5

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        Zerby
        wrote on 2 Jan 2014, 20:38 last edited by
        #3

        [quote author="SGaist" date="1388612048"]Hi,

        If I saw things correctly, Qt 5 is available in the testing repositories (currently known as Jessie)

        You should either install a debian based on Jessie (so you only use packages from it) or add the repositories from Jessie in your sources.list (copy the lines from stable and change the target to testing), sync and install Qt 5

        Hope it helps[/quote]

        Thank you for your answer.

        The problem is, I don't really know much about editing sources.list.. I've read about it some, from here: https://wiki.debian.org/SourcesList, but I don't understand:

        1. Which URL should I use? I tried http://anonscm.debian.org/gitweb/?p=pkg-kde/qt/qtbase.git;a=summary, which I found from http://packages.debian.org/source/sid/qtbase-opensource-src, is it right?
        2. Which distribution (after your post, I guess it's jessie?)
        3. What about component1 - 3, do I need to add them?

        Thank you in advance again!

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 2 Jan 2014, 22:15 last edited by
          #4

          There's the "Example sources.list for Debian 7 "Wheezy"" that you can follow, just substitute Wheezy with Jessie

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • Z Offline
            Z Offline
            Zerby
            wrote on 3 Jan 2014, 12:49 last edited by
            #5

            Yes, but I still don't understand which URL I shoud use. If I add:

            @
            deb http://anonscm.debian.org/gitweb/?p=pkg-kde/qt/qtbase.git;a=summary jessie main@

            and run apt-get update, I get errors:

            @
            W: Failed to fetch http://anonscm.debian.org/gitweb/?p=pkg-kde/qt/qtbase.git;a=summary/dists/jessie/main/binary-amd64/Packages Error reading from server. Remote end closed connection
            W: Failed to fetch http://anonscm.debian.org/gitweb/?p=pkg-kde/qt/qtbase.git;a=summary/dists/jessie/main/i18n/Translation-en Error reading from server. Remote end closed connection
            @

            Now, I assume this is because I'm not using the corrent url? What is the correct url? Is my entry to the sources.list correct, excluding the url? Sorry for probably asking stupid questions, I've tried to Google and tested stuff myself, but can't figure it out..

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 3 Jan 2014, 22:15 last edited by
              #6

              Change Wheezy example:
              @deb http://http.debian.net/debian wheezy main@

              to Jessie:

              @deb http://http.debian.net/debian jessie main@

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • Z Offline
                Z Offline
                Zerby
                wrote on 4 Jan 2014, 11:19 last edited by
                #7

                Heh, okay now I got it.. So I wasn't even supposed to be adding anything, just modifying the existing entry.

                Thank you for your help, it's now installing :)

                1 Reply Last reply
                0
                • Z Offline
                  Z Offline
                  Zerby
                  wrote on 4 Jan 2014, 11:44 last edited by
                  #8

                  Damn, actually it's not solved.. Well, Qt5 is now installed:

                  @
                  $ qtchooser -print-env
                  QT_SELECT="default"
                  QTTOOLDIR="/usr/lib/x86_64-linux-gnu/qt5/bin"
                  QTLIBDIR="/usr/lib/x86_64-linux-gnu"

                  $ qmake -v
                  QMake version 3.0
                  Using Qt version 5.1.1 in /usr/lib/x86_64-linux-gnu
                  @

                  But if I try to compile function:

                  @QString hashFile(QString filename, QCryptographicHash::Algorithm a)
                  {
                  QFile *f = new QFile(filename);
                  if (f->open(QIODevice::ReadOnly))
                  {
                  QCryptographicHash *hash = new QCryptographicHash(a);

                      hash->addData(f);
                      QByteArray result = hash->result();
                      f->close();
                      return QString(result.toHex());
                  }
                  else
                  {
                      logentry("Could not open file " + filename.toStdString() + " for generating MD5 hash, error: " + f->errorString().toStdString(), logs::ERRORS, logs::ID_ERROR);
                      return QString();
                  }
                  

                  }@

                  on my Linux machine, I get error:

                  @basic_functions.cpp: In function 'QString hashFile(QString, QCryptographicHash::Algorithm)':
                  basic_functions.cpp:243:24: error: no matching function for call to 'QCryptographicHash::addData(QFile*&)'
                  basic_functions.cpp:243:24: note: candidates are:
                  In file included from /usr/include/qt4/QtCore/QCryptographicHash:1:0,
                  from basic_functions.h:8,
                  from basic_functions.cpp:1:
                  /usr/include/qt4/QtCore/qcryptographichash.h:69:10: note: void QCryptographicHash::addData(const char*, int)
                  /usr/include/qt4/QtCore/qcryptographichash.h:69:10: note: candidate expects 2 arguments, 1 provided
                  /usr/include/qt4/QtCore/qcryptographichash.h:70:10: note: void QCryptographicHash::addData(const QByteArray&)
                  /usr/include/qt4/QtCore/qcryptographichash.h:70:10: note: no known conversion for argument 1 from 'QFile*' to 'const QByteArray&'
                  make: *** [basic_functions.o] Error 1
                  @

                  It compiles fine on my Windows machine, with Qt5.1.1 installed aswell.

                  EDIT: Also noticed a memory leak in my function, will fix that...

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 4 Jan 2014, 22:12 last edited by
                    #9

                    You project is still using Qt 4. If using Qt Creator, change the kit to use Qt 5, on the command line, clean your build and re-run qmake

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • Z Offline
                      Z Offline
                      Zerby
                      wrote on 6 Jan 2014, 11:31 last edited by
                      #10

                      Ah, thank you. I'm not using Qt Creator on my Linux machine, I'm compiling from terminal. I ran make clean and qmake, and after that the it compiled fine!

                      Now it's solved :)

                      1 Reply Last reply
                      0

                      2/10

                      1 Jan 2014, 21:34

                      topic:navigator.unread, 8
                      • Login

                      • Login or register to search.
                      2 out of 10
                      • First post
                        2/10
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved