Can't build project on Ubuntu using QT6.4 and CMake - qt

I installed a fresh new copy of QTCreator on a Ubuntu VM. It is a clean virtual machine. Then I create a dummy QTQuick project with almost nothing in it. But creator fails to compile, saying CMAKE_CXX_COMPILER not found. See message below:
error: No CMAKE_CXX_COMPILER could be found. Tell CMake where to find the compiler by
setting either the environment variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER
to the full path to the compiler, or to the compiler name if it is in the PATH.
Am I missing the compiler? This is a fresh install and I don't understand. Creator is showing the only compiler option. See the screen shot below:
Any ideas why it does not compile from a clean install, using all default option? The compiler must be there.
thank you.

I followed these instructions and it worked finally.
sudo apt-get update && sudo apt-get upgrade
sudo apt-get -y install build-essential openssl libssl-dev libssl1.0 libgl1-mesa-dev libqt5x11extras5
downloaded the install and made it executable
chmod +x qt*.run
then it worked.
Here is the page with more explanations:
https://web.stanford.edu/dept/cs_edu/resources/qt/install-linux

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

Cant run qgis version Qt_5_PRIVATE_API not defined

I am running Ubuntu 18.04 and I cant seem to get qgis to run anymore. The error I get is:
/usr/bin/qgis.bin: relocation error: /usr/lib/x86_64-linux-gnu/libQt5QuickWidgets.so.5: symbol _ZN15QQmlMemoryScope5stateE version Qt_5_PRIVATE_API not defined in file libQt5Qml.so.5 with link time reference
my qmake version is:
QMake version 3.1
Using Qt version 5.9.5 in /usr/lib/x86_64-linux-gnu
I have tried to link to qt5 but that did not change anything.
sudo ln -snf ../../../../share/qtchooser/qt5-x86_64-linux-gnu.conf default.conf
You need to uninstall QGIS and reinstall with the latest stable release. Using sudo apt-get install qgis* python3-qgis* to install is not precisely the best method because of the wildcard. The official instructions suggest using: sudo apt install qgis qgis-plugin-grass.
The instructions for best installation procedure on Ubuntu for LTS releases is posted here.

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.

How to configure compiler in debian os QT kit

I installed QT creator in debian linux. If I try to create a new project, in Kit option I got the error like "No valid Kit found". If I go to Tools ->Options -> Build&Run -> kit, there is no options to select. But I installed same in ubuntu, it is working fine without same problem. What im missing?
Also suggest me if I need to reinstall the QT creator or something else...
Its time to explain the tricks to install QT creator in debian linux operating system.
STEP 1: dont install just QT creator in your PC.
Install whole package of QT [link to download QT SDK below][1]
[1]: http://www.qt.io/download-open-source/#section-2 , so that you will get all the libraries and dependencies.
After downloading the file is in the ".run" format . Install the downloaded file in your terminal (by giving commands).
STEP 2: install
sudo apt-get install g++
sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev
in your terminal.
STEP 3: install
sudo apt-get install libcanberra-gtk-module
sudo apt-get install libcanberra-gtk-module:i386
now restart your system once and create new project.It should work
I like to thank agold for his guidance , Actually he spent more than 3 hours to resolve this issue. :)

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