coin3d / quarter

Coin GUI binding for Qt
BSD 3-Clause "New" or "Revised" License
36 stars 26 forks source link

macOS Qt compilation errors apparently due to incorrect C++ standard #51

Open ljexplore opened 2 years ago

ljexplore commented 2 years ago

I'm trying to get Quarter to compile under macOS 10.15.7 (after running into X11 library issues with SoXt).

I have Coin3d installed via Homebrew, apparently version 4.0.0_1. I first tried automake configure, but that failed, then cmake. Cmake gets further, but I get a ton of Qt related compilation errors (see below) which appear to be due to the use of recent c++ language features. I tried setting the CXX_STANDARD in the CMakeLists.txt file and also setting the c++ standard also in Qmake .pro files but neither had any effect.

Any guidance would be much appreciated. Thanks!

make [ 1%] Generating moc_SignalThread.cpp [ 2%] Generating //include/Quarter/eventhandlers/moc_DragDropHandler.cpp [ 4%] Generating //include/Quarter/eventhandlers/moc_EventFilter.cpp [ 5%] Generating //include/Quarter/eventhandlers/moc_FocusHandler.cpp [ 7%] Generating //include/Quarter/moc_QuarterWidget.cpp [ 8%] Generating moc_ContextMenu.cpp [ 10%] Generating moc_InteractionMode.cpp [ 11%] Generating moc_SensorManager.cpp [ 13%] Building CXX object src/Quarter/CMakeFiles/Quarter.dir/ContextMenu.cpp.o In file included from /Users//Packages/src/quarter/src/Quarter/ContextMenu.cpp:34: In file included from /Users//Packages/src/quarter/src/Quarter/ContextMenu.h:36: In file included from /Users//Packages/homebrew/Cellar/qt@5/5.15.2/lib/QtCore.framework/Headers/QObject:1: In file included from /Users//Packages/homebrew/Cellar/qt@5/5.15.2/lib/QtCore.framework/Headers/qobject.h:46: In file included from /Users//Packages/homebrew/include/QtCore/qobjectdefs.h:48: In file included from /Users//Packages/homebrew/include/QtCore/qnamespace.h:44: /Users//Packages/homebrew/include/QtCore/qglobal.h:675: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 && std::is_arithmetic_v &&


/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/type_traits:451:63: note: 'enable_if'
      declared here
template <bool, class _Tp = void> struct _LIBCPP_TEMPLATE_VIS enable_if {};
                                                              ^
In file included from /Users/<uname>/Packages/src/quarter/src/Quarter/ContextMenu.cpp:34:
In file included from /Users/<uname>/Packages/src/quarter/src/Quarter/ContextMenu.h:36:
In file included from /Users/<uname>/Packages/homebrew/Cellar/qt@5/5.15.2/lib/QtCore.framework/Headers/QObject:1:
In file included from /Users/<uname>/Packages/homebrew/Cellar/qt@5/5.15.2/lib/QtCore.framework/Headers/qobject.h:46:
In file included from /Users/<uname>/Packages/homebrew/include/QtCore/qobjectdefs.h:48:
In file included from /Users/<uname>/Packages/homebrew/include/QtCore/qnamespace.h:44:
/Users/<uname>/Packages/homebrew/include/QtCore/qglobal.h:675:43: error: no template named 'is_arithmetic_v' in namespace 'std'; did you mean
      'is_arithmetic'?
         typename = std::enable_if_t<std::is_arithmetic_v<T> && std::is_arithmetic_v<U> &&
VolkerEnderlein commented 2 years ago

Did you followed the instructions from BuildWithCMake wiki page? I never experienced such errors when compiling SoQt or Quarter.

ljexplore commented 2 years ago

Did you followed the instructions from BuildWithCMake wiki page? I never experienced such errors when compiling SoQt or Quarter.

Close to it, but not exactly... e.g., I didn't clone Quarter from the repo, I just downloaded latest, and Coin3d was installed with Homebrew, again not cloned/built from the repo. I was able to compile SoXt using those instructions, but then lost track of the page, thanks for the link! Oh, and I just see the default version of Qt in Homebrew is 6, not 5... that's probably the main problem. I'll try explicitly pointing at Qt5. Thanks.

Edit: actually I take that back, at one point I did explicitly point it at Qt 5.15.2... sorry tried so many things I lost track. Anyway, I'll try to exactly replicate the steps on that page.

ljexplore commented 2 years ago

Ok, I tried the steps in BuildWithCmake exactly. Same result... only difference at this point I believe is that Coin3d is from Homebrew and not cloned/built myself. Note the Apple compiler is 11.0.3... so a little out of date. I didn't include the initial cmake output before:

-- The CXX compiler identification is AppleClang 11.0.3.11030032 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found OpenGL: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/OpenGL.framework
-- Configuring done -- Generating done CMake Warning: Manually-specified variables were not used by the project:

QUARTER_BUILD_MAC_FRAMEWORK
VolkerEnderlein commented 2 years ago

Back on track. Can you have a look into Quarter's github actions script? Under section macos-latest (according to documentation this means macOS 10.15 at present time) Quarter is build against the latest Qt5 version (5.15.2) with the default compiler (clang). Please check whether your build command is similar to this. You might need to download the Coin 4.0.0 version build on macos-latest from the CI builds section. Hope that gets you further.