DGtal-team / DGtal

Digital Geometry Tools and Algorithm Library
https://dgtal.org
GNU Lesser General Public License v3.0
370 stars 115 forks source link

Build issue on macOS with recent Qt5 package from homebrew #1556

Closed dcoeurjo closed 3 years ago

dcoeurjo commented 3 years ago

When building DGtal with an updated homebrew install, I get this error:

In file included from /usr/local/lib/QtCore.framework/Headers/qiterator.h:43:
/usr/local/lib/QtCore.framework/Headers/qglobal.h:667:26: error: no template named 'enable_if_t' in namespace 'std'; did you mean 'enable_if'?
         typename = std::enable_if_t<std::is_arithmetic_v<T> && std::is_arithmetic_v<U> &&
                    ~~~~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/type_traits:538:63: note: 'enable_if' declared here
template <bool, class _Tp = void> struct _LIBCPP_TEMPLATE_VIS enable_if {};
                                                              ^

Seems to be related to https://github.com/Homebrew/brew/issues/10841

dcoeurjo commented 3 years ago

Ok the bug is due to homebrew qt default version that is qt6 right now (even if you have used qt@5 in the cmake). A work around is to remove qt and only keep qt@5 (or unlink qt@6)

dcoeurjo commented 3 years ago

the unlink fixes the problem (macOS related)

fpaupier commented 3 years ago

I encountered the same problem on macOS Big Sur (version 11.4) - a brew update installed qt6 and messed up my local qt install.

By running brew list | grep qt I found out there was qt@5 and a qt formulae, the qt was the version 6. I ran brew remove qt and it solved the issue.