Qt#5.5 works, but not Qt - qt

Attempting to run qt on my Mac, using the following homebrew commands:
brew install qt
brew install qt-creator
no errors occured. However, when I tried running qt-creator, I noticed I had to manually link qmake. When I attempted to run my program, I got the following error:
:-1: error: failed to parse default search paths from compiler output
After attempting to add qt to the environment variables, it did not work.
What I finally resorted to was the following:
brew remove qt
brew install qt#5.5
Still, I had to manually link qmake, but this time it worked.
Question: Why does qt#5.5 work, and not qt? Is there a fix/way to get qt to work?

I just ran into this issue, with a brand new homebrew install of qt and qt-creator.
The short answer is make sure your selected "Kit" is using Clang. It can default to gcc and cause this error.
Longer answer:
Go to "Preferences → Build and Run → Qt Versions" and ensure you have a path to your qmake binary.
For my homebrew install, it was /usr/local/Cellar/qt/5.11.1/bin/qmake (⌘+SHIFT+G in the open-file dialog).
Click OK, then re-navigate to "Preferences → Build and Run → Kits" and choose the Desktop (default) profile.
Choose a version in the "Qt version" dropdown.
Ensure that Clang is chosen for your compiler.

Related

How to Install qt4 on macOS with homebrew?

I need to install the qt4 C++ framework for one of my classes. I tried using the regular installer from the download archives page for both qt4.7 and qt4.8, however I get the warning:
"Installing this package may damage your system, and the installation may fail."
So I looked into installing it via homebrew and initially tried:
brew tap cartr/qt4
brew tap-pin cartr/qt4
brew install qt#4
However, that gives me this error:
Error: Calling brew tap-pin user/tap is disabled! Use fully-scoped user/tap/formula naming instead.
I looked online for a solution and was able to install it by omitting the brew tap-pin cartr/qt4 command:
brew tap cartr/qt4
brew install qt#4
I then tried to create a sample qt program in the CLion IDE and checked the version I was using, and it said I was using qt5 (from the python anaconda distribution). So my question is, can I install both qt4 and qt5 on my system simultaneously? How do I select which version to use?
You can install both simultaneously. You can select which to use.
When you install qt (meaning qt5) using homebrew, it produces a "Caveats" message that answers your question.
It says will need to set certain environment variables yourself.
It says that, in only those shell sessions where you set those environment variables, qt (meaning qt5) will be available.
It says, if you want qt always available, then you can simply put those settings in your dot files.
If you install qt#4 and set those same variables to point to qt#4, then qt#4 will be available instead.
You can view the same "Caveats" message again using brew info qt. Here is the whole message:
qt is keg-only, which means it was not symlinked into /usr/local,
because Qt 5 has CMake issues when linked.
If you need to have qt first in your PATH run:
echo 'export PATH="/usr/local/opt/qt/bin:$PATH"' >> ~/.zshrc
For compilers to find qt you may need to set:
export LDFLAGS="-L/usr/local/opt/qt/lib"
export CPPFLAGS="-I/usr/local/opt/qt/include"
For pkg-config to find qt you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/qt/lib/pkgconfig"
The same commands with qt#4 made qt#4 available for me:
export PATH="/usr/local/opt/qt#4/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/qt#4/lib"
export CPPFLAGS="-I/usr/local/opt/qt#4/include"
export PKG_CONFIG_PATH="/usr/local/opt/qt#4/lib/pkgconfig"
By the way, I installed qt#4 using the user/tap/formula syntax: brew install cartr/qt4/qt#4

module "QtMultimedia" is not installed

I've installed Qt and Qtcreator on a Raspberry Pi 3 using the normal apt-get install method. Everything seems to work fine except when I try to build the declarative-camera example or other multimedia examples I get an error saying module "QtMultimedia" is not installed. Then the empty white application window pops up.
I've tried installing and reinstalling all the required packages such as libqt5multimedia5, qtmultimedia5-dev, etc and it just says they are installed with newest version.
Has anyone had success with getting qt multimedia working on raspberry pi?
Edit:
I tried using the suggested solution of:
sudo apt-get install qtdeclarative5-qtmultimedia-plugin
That gives me an error of:
E: Unable to locate package qtdeclarative5-qtmultimedia-plugin
This seemed to work run the command below:
sudo apt-get install libqt5multimedia5-plugins qml-module-qtmultimedia
I was missing libqt5multimedia5-plugins
Open Qt Maintenance Tool (It is already installed on your pc when you downloaded Qt)
Login to your Qt account and hit next
Select Add or Remove Components, next
Go to Qt -> (The Qt version you installed) -> Additional Libraries and select Qt Multimedia like this
Hit next to install it

qtwebengine qmake error: unkown module: webchannel

I am trying to get qt webengine running on my laptop for the first time, but can't seem to build it. I am following the instructions from here:
https://wiki.qt.io/QtWebEngineHowToTry
On the last few steps, I had to run "qmake -r" on the qtwebengine directory. This is the output:
SSL............................... Using system NSS
ICU............................... Using internal copy (Default, force system ICU with WEBENGINE_CONFIG += use_system_icu)
FFMPEG............................ Using internal copy (Default, force system FFMPEG with WEBENGINE_CONFIG += use_system_ffmpeg)
Proprietary codecs (H264, MP3).... Not enabled (Default, enable with WEBENGINE_CONFIG += use_proprietary_codecs)
Reading /home/kevin/workspace/qtwebengine/src/src.pro
Reading /home/kevin/workspace/qtwebengine/src/core/core.pro
Reading /home/kevin/workspace/qtwebengine/src/core/core_gyp_generator.pro
Project ERROR: Unknown module(s) in QT: webchannel
This error happened right after I installed WebKitGtk+ from here (http://trac.webkit.org/wiki/BuildingGtk) and ran "Tools/gtk/install-dependencies" and "Tools/Scripts/update-webkitgtk-libs". Before I installed WebKitGtk+, qmake would terminate at a later point.
(I installed WebKitGtk+ because, previously, running "qmake -r" on the qtwebengine directly resulted in an "unmet dependency: harfbuzz" error that I tried to fix on my own via google, and the WebKitGtk+ page was the only lead I could find that would supposedly fix that issue... big mistake!).
I am running on a (mostly freshly reformatted) Ubuntu 15.04 laptop. I installed qt5 via apt-get install, but apparently I have both qt4 and qt5 plugins installed, as well as qtchooser (I'm guessing from the WebKitGtk+ installation scripts).
Here is the output of "qmake --version":
QMake version 3.0
Using Qt version 5.4.1 in /usr/lib/x86_64-linux-gnu
Any help would be greatly appreciated, as I'm excited to try out qt webengine!
In case anyone else has the same problem, I fixed it by installing qt 5.5.0 from here http://download.qt.io/official_releases/qt/, and using the associated qmake binary from that installation. I guess installing qt from 'sudo apt-get install' still has some issues that won't work with qtwebengine.

PyQT5 error: could not find or load Qt platform plugin xcb

Up until Anaconda3 (which contains Python 3.4) was re-installed on my RedHat 6.5 workstation, I have been able to develop Python apps that use PyQT5.
Post re-install of Anaconda I receive an error message:
....could not find or load Qt platform plugin xcb
The only difference between Anaconda installs is the folder name: /usr/local/ananaconda3 vs /usr/local/anaconda_py3
I checked libqxcb.so has no missing dependencies.
I rebuilt PyQT5.
I tried explicitly adding location of site-packages of PyQT5:
import site
site.addsitedir("...path.../python3.4")
Any other suggestions?
How does re-installing Python impact the use of PyQT5?
This is an error caused by having two different versions of Qt under the same installation/environment.
Check the packages installed and their versions in your environment (if for some reason you're not working in a virtual environment, you can skip the first line):
source activate yourenvname
conda list
If you see pyqt and qt both with version 4.X.X then remove them (assuming you want to work in Qt v5):
conda remove qt
conda remove pyqt
I had an issue that seems to match what happened here.
But in my case the solution was to "sudo rm -rf user/anaconda3" and reinstall it with "bash anaconda....sh", because I had previously installed it using sudo ("sudo bash anaconda....sh")

Qt Creator needs a compiler set up to build. Configure a compiler in kit options

I just installed Qt 5.2 package on ubuntu. I simply created a Qt widget application, and when I tried to build it, I got the following message:
Qt Creator needs a compiler set up to build. Configure a compiler in
kit options
I have tried several things, all of which were unsuccessful. I tried setting the compiler kit to
Desktop Qt 5.2.0 GCC 32bit (default)
However it didn't work
After that I set the compiler to
GCC (x86 32bit in use/bin)
However that didn't work either.
I also tried adding gcc manually and gave it the path
/usr/bin/g++-4.6
but it still didn't work.
This is what appears in there Qt Version tab
This is what I get when I remove the .pro.user file and restart the IDE, Whats the difference between configuring a project as Desktop and Desktop Qt 5.2.0 GCC 32bit?
Qt Creator needs a version of tools that are able to link against the Qt binaries that the downloaded package contains. In your case, the local toolchain and the binaries don't match. That means that you would actually have to build the Qt with your toolkit and make sure that QtCreator can find the built binaries.
The simpler way for Ubuntu is to use the packaged version of the tools; they play well with the already delivered binaries. Use sudo apt-get install qtcreator to install it with all the dependencies.

Resources