How to Install qt4 on macOS with homebrew? - qt

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

Related

MSYS2 Qt-creator examples not showing

I have installed qt-creator on windows 10 using msys2.
I installed packages according to https://wiki.qt.io/MSYS2
base-devel git mercurial cvs wget p7zip
perl ruby python2 mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain
mingw-w64-i686-qt-creator mingw-w64-x86_64-qt-creator
I had previously installed qt from the official site but the mingw version is too old and I'd rather not have two mingw versions installed.
I have existing C:\msys64\mingw64\share\qt5\examples folder but it seems there are some folders missing from C:\msys64\mingw64\share\qt5\doc compared to the official install. Maybe that has something to do with it.
So the question: Is there a specific package I need to install so that the examples show up in the qt-creator examples page or something else?
I found in this place https://www.archlinux.org/packages/extra/any/qt5-examples/
decompress with
zstd -df qt5-examples-5.14.2-1-any.pkg.tar.zst
and then
tar xzf qt5-examples-5.14.2-1-any.pkg.tar
the examples are saved in /usr/share/doc/qt/examp,es
The qt-creator in msys2 distribution do not have examples installed. The msys2 also do not have separate package for it.
But as what #user3930978 found. You can use example package from archlinux site for workaround.
But unfortunately, msys2 qt5 configured with "-nomake examples" parameter. You need to modify generated file. The easiest way is still to install qt5 and creator with official full pack.

Qt#5.5 works, but not 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.

Compiling third party libraries with Qt

I've been using OpenCV and Marble libraries compiled and linked with Qt. Every time I do it I have problems running cmake to make these libraries. it seems paths in the qt cmake files to other qt cmake files are incorrect. I get errors like:
CMake Error at CMakeLists.txt:67 (find_package):
By not providing "FindQt5DBus.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Qt5DBus", but
CMake did not find one.
Could not find a package configuration file provided by "Qt5DBus" with any
of the following names:
Qt5DBusConfig.cmake
qt5dbus-config.cmake
Add the installation prefix of "Qt5DBus" to CMAKE_PREFIX_PATH or set
"Qt5DBus_DIR" to a directory containing one of the above files. If
"Qt5DBus" provides a separate development package or SDK, be sure it has
been installed.
I can fix this in Ubuntu by running
sudo apt-get install qt5-default
This is fine in Ubuntu, but now I am trying to compile these libraries on mac and windows now. Anyone know a way to get a Qt with all of these paths already correct? tried the installer on windows and mac, and brew on mac. I don't really have time to play with fixing each one of these errors one by one
At least Qt 5.5 on Windows (using the Qt installer) should work out of the box. It has DBus included. Which Qt version are you using currently?

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")

cygwin aspell installing new language

have a problem with adding new language to cygwin.
As source for language i tried using ubuntu dictionary files.
It would be interesting if anyone could install any non default languages in cygwin spell checker.
The Ubuntu packages use different directories (/usr/lib/aspell vs. /usr/lib/aspell-0.60 on Cygwin), so this isn't going to work. Instead, I suggest you build and install these from the source in one of the following ways:
Download the latest source tarball for your language from http://ftpmirror.gnu.org/aspell/dict/, unpack the tarball, then run ./configure, make, and make install.
Use cygport to build a package for you, then manually install it. For example, create an aspell-lt.cygport file with the following contents:
ASPELL_COMPAT=6
inherit aspell-dict
NAME="aspell-lt"
VERSION=1.2.1.0
RELEASE=1
CATEGORY="Text"
SUMMARY="Aspell Lithuanian dictionaries"
Then run cygport aspell-lt.cygport fetch prep build install package. Such a package would then be fit for contribution to the Cygwin distribution.

Resources