Unknown module(s) in QT: svg - qt

Added QT += svg and I tried just QT += svg and greaterThan(QT_MAJOR_VERSION, 4): QT += svg to the .pro solution file and ran qmake from inside the QtCreator and got this error:
error: Unknown module(s) in QT: svg
Any ideas?

You are lacking the installation of the the QtSvg library. Try to install them on your Ubuntu 13.10 in the following way:
sudo apt-get install libqt5svg5*

Debian Stretch:
sudo apt install libqt5svg5-dev
Fedora (courtesy of #robin-green):
sudo dnf install qt5-qtsvg-devel

Because zsh complains to me about "no matches found" when using lpapp's answer, I would like to add here:
On Debian Systems one can get the required library for release builds via:
sudo apt install libqt5svg5
and if one also wants to build a debug build one requires:
sudo apt install libqt5svg5-dev
additionally.

Related

Build project in Qt Creator using CMake from snap

Ubuntu 20.04
I just want to use default snap and apt versions
Qt Creator 4.11.0 from apt:
sudo apt install qtcreator qt5-default
CMake 3.24.0 from snap:
sudo snap install cmake --classic
If I open the project, it gives an error:
Running /usr/bin/snap /home/fresh/Downloads/test -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_CXX_COMPILER:STRING=/usr/bin/g++ -DCMAKE_C_COMPILER:STRING=/usr/bin/gcc -DCMAKE_PREFIX_PATH:STRING=/usr -DQT_QMAKE_EXECUTABLE:STRING=/usr/bin/qmake in /tmp/QtCreator-BsxNPO/qtc-cmake-BcKQdVpk.
error: unknown command "/home/fresh/Downloads/test", see 'snap help'.
CMake process exited with exit code 64.
Any change to make it work properly without building CMake from source or installing newer version of Qt Creator?
Solution:
sudo ln -s /snap/cmake/current/bin/cmake /usr/bin/cmake
sudo ln -s /snap/cmake/current/bin/ccmake /usr/bin/ccmake
sudo ln -s /snap/cmake/current/bin/cpack /usr/bin/cpack
In Qt go to Tools > Options > Kits > CMake in Manual set Path:
/usr/bin/cmake
Go back to Kits tab, in CMake Tool choose added new CMake
Relaunch Qt. It works

How to update Qt from 5.5.1 to 5.7 on Ubuntu 16.04?

I am trying to update Qt from 5.5.1 to 5.7 or higher.
I tried sudo apt-get install qt-default qtdeclarative5-dev
gives me following output on console:
qtdeclarative5-dev is already the newest version (5.5.1-2ubuntu6).
qt5-default is already the newest version (5.5.1+dfsg-16ubuntu7.6).
How can I update Qt to 5.7 or higher version?
Ubuntu packages in standard repository are always outdated. I suggest you install Qt from .run file they provide .
But you can possibly run into problems, as i did, using Qt + CMake without Qt Creator
I followed this post and was able to update Qt to 5.11 using PPA following commands:
sudo add-apt-repository ppa:beineri/opt-qt-5.11.1-xenial
sudo apt update
sudo apt install qt511-meta-full
For system wide usage, create default.conf file at /etc/xdg/qtchooser with following content:
/opt/qt511/bin
/opt/qt511/lib
That's it, it should be updated by now. qmake -v outputs the current Qt and qmake version

CMake cannot find Qt5LinguistTools in Docker / Ubuntu 18.04

My simple Dockerfile:
FROM ubuntu:18.04
RUN apt update && apt upgrade -y
RUN apt install build-essential cmake qt5-default -y
RUN apt install qttools5-dev-tools -y
When I check linguist inside the container it's there:
root#9087245330a7:/# which linguist
/usr/bin/linguist
...but when I configure my app inside the container:
CMake Error at CMakeLists.txt:72 (find_package):
By not providing "FindQt5LinguistTools.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"Qt5LinguistTools", but CMake did not find one.
Could not find a package configuration file provided by "Qt5LinguistTools"
(requested version 5.5.1) with any of the following names:
Qt5LinguistToolsConfig.cmake
qt5linguisttools-config.cmake
Add the installation prefix of "Qt5LinguistTools" to CMAKE_PREFIX_PATH or
set "Qt5LinguistTools_DIR" to a directory containing one of the above
files. If "Qt5LinguistTools" provides a separate development package or
SDK, be sure it has been installed.
What is going on? This works on Ubuntu 16.04 just fine.
The problem was that in Ubuntu 18.04+ you need to install also qttools5-dev in order to get /usr/lib/x86_64-linux-gnu/cmake/Qt5LinguistTools/Qt5LinguistToolsConfig.cmake.

Qt multimedia: cannot find -lpulse

I modified .pro:
QT += core gui multimedia multimediawidgets
And I include <QMediaPlayer>, <QVideoWidgets> in main.cpp
Then I tried to build. It gives me following errors:
cannot find -lpulse-mainloop-glib
cannot find -lpulse
collect2:error:ld returned 1 exit status
Can anyone help me? My system is Ubuntu 16.04 LTS.
Try sudo apt-get install libpulse-dev
From http://www.qtcentre.org/threads/50938-QT-error-usr-bin-ld-cannot-find-lpulse-mainloop-glib:
From: norobro
Default Re: QT error /usr/bin/ld: cannot find -lpulse-mainloop-glib
On my Debian box that lib is in the libpulse-dev package. Do you have it installed?

Self-compile Qt Webkit

I have self-compiled Qt 5.4.1 and installed in /opt/qt-5.4.1.
However, I encountered an error while trying to 'qmake' my project file:
Project ERROR: Unknown module(s) in QT: webkitwidgets
I did sudo apt-get install libqt5webkit5-dev but the error persists.
I suspect then that apt-get install does not work when Qt-Core was self-compiled. The Qt Webkit source is available on https://qt.gitorious.org/qt
The question is, how and where should I install Webkit from source so that it can be detected while running qmake?
Probably you missed compilation of webkit while compilation of Qt. Read here how to resolve this issue:
https://forum.qt.io/topic/40378/solved-linux-unknown-module-s-in-qt-webkitwidgets
QtWebKit is not built anymore by default. You can build it after you have a proper build of Qt. Once you have your build of Qt clone the QtWebKit repo:
git clone https://github.com/qt/qtwebkit.git
then, make a new dir for the build files and from that directory enter the command:
/opt/qt-5.4.1/bin/qmake <path/to/qtwebkit>
make -j<n>
make install
Now you should be able to use QtWebKit with your build.
might want to try:
sudo apt-get install libqt5webkit5
and
sudo apt-get install libqt5webkit5-dev

Resources