welle.io icon indicating copy to clipboard operation
welle.io copied to clipboard

[macOS] Compilation on MacOS and QT versions conflict

Open aerogus opened this issue 2 years ago • 6 comments

I couldn't compile anymore on MacOS Catalina. After few investigations, I've manage to understand the problem. In fact there is a conflict, or not well linked librairies when qt (v6) and qt@5 (v5) are installed at the same time with homebrew

We can install qt's with homebrew :

brew install qt@5
brew install qt

and it should be installed at /usr/local/Cellar/qt@5/5.15.2 and /usr/local/Cellar/qt/6.2.0

My commands to compile welle.io :

git clone https://github.com/AlbrechtL/welle.io
cd welle.io
git checkout next
mkdir build
cd build
cmake .. -DRTLSDR=1 -DBUILD_WELLE_IO=ON -DBUILD_WELLE_CLI=ON -DCMAKE_PREFIX_PATH=/usr/local/Cellar/qt\@5/5.15.2
make

It fail at 50% with this message :

In file included from /usr/local/Cellar/qt@5/5.15.2/lib/QtMultimedia.framework/Headers/qaudiooutput.h:44:
In file included from /usr/local/include/QtCore/qiodevice.h:43:
/usr/local/include/QtCore/qglobal.h:96:6: error: "Qt requires a C++17 compiler"
#    error "Qt requires a C++17 compiler"
     ^

When I uninstall qt (6) with brew uninstall qt, the welle.io compilation is completed well...

I don't know if it is a homebrew or welle.io bug, but glad to have find the solution !

aerogus avatar Oct 12 '21 07:10 aerogus

Note:

  • When qt (6) is installed, there's a lot of Qt* subdirectories under /usr/local/include
  • When v6 is not installed, there's no Qt* subdirectory under /usr/local/include

aerogus avatar Oct 12 '21 07:10 aerogus

I don't have a Mac so I cannot help. Anybody else?

AlbrechtL avatar Dec 28 '21 21:12 AlbrechtL

Haven't tried this myself but it looks like cmake is getting confused and picking up some files from Qt 5, and others from Qt 6. The Qt 6 files require a C++17 compiler, hence the error.

The Mac build on Travis uses qmake instead of cmake to build the GUI, so I would suggest trying that to see if the same issue occurs. Obviously make sure you use the Qt 5 version of qmake located at /usr/local/opt/qt@5/bin.

The Homebrew formula may need some changes as it also uses cmake, so I suspect it breaks in the same way on systems with Qt 6 installed.

orryverducci avatar Dec 31 '21 13:12 orryverducci

Today the qt homebrew is now 6.3.1. Hardware : Apple mac mini M1 OS : MacOS 12.3.1 (Monterey)

% brew info qt
==> qt: stable 6.3.1 (bottled), HEAD

I have compiled welle.io (current master branch) without error and without having to specify the qt path library

cmake .. -DRTLSDR=1 -DBUILD_WELLE_IO=ON -DBUILD_WELLE_CLI=ON

Maybe we can close this issue

aerogus avatar Aug 25 '22 17:08 aerogus

Can you also test the next branch because the master branch still requires Qt5.

AlbrechtL avatar Aug 25 '22 18:08 AlbrechtL

ok I understand !

  • master branch -> Qt5
  • next branch -> Qt6

my working commands :

brew install cmake mpg123 fftw
git clone https://github.com/AlbrechtL/welle.io
mkdir build
cd build

and wether I want to compile master or next :

brew install qt@5
git checkout master
cmake .. -DCMAKE_PREFIX_PATH=/opt/homebrew/opt/qt5//lib/cmake/Qt5
brew install qt@6
git checkout next
cmake ..

I didn't try yet with qmake.

aerogus avatar Aug 27 '22 08:08 aerogus