Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows|macOS|Linux|BSD] - Qt6 version FTBFS on Clang due to C++17 #506

Open
OPNA2608 opened this issue Apr 29, 2024 · 3 comments
Open
Labels
bug Something isn't working

Comments

@OPNA2608
Copy link
Member

Checklist

  • I am reporting exactly 1 bug with this issue.
  • This bug hasn't already been reported.
  • This bug hasn't already been fixed in the latest development build.

Bug Description

Seeing this in Nixpkgs on the Qt6 macOS builds.

clang++ -c -pipe -stdlib=libc++ -O2 -std=gnu++1z -pthread -Wall -Wextra -Wall -Wextra -Werror -pedantic -pedantic-errors -fPIC -DQT_DEPRECATED_WARNINGS -D__UNIX_JACK__ -DJACK_HAS_PORT_RENAME -D__MACOSX_CORE__ -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE5COMPAT_LIB -DQT_CORE_LIB -I. -Iinstrument -Imodule -I../submodules/emu2149/src -I../submodules/RtAudio/src -I/nix/store/6iqp86xqgp9nnhdrxgnzbrdjj0frx6cw-rtmidi-5.0.0/include/rtmidi -I/nix/store/qkrjmjlabb70am2s9nr0d2fq98m7xjd3-qtbase-6.7.0/lib/QtWidgets.framework/Headers -I/nix/store/qkrjmjlabb70am2s9nr0d2fq98m7xjd3-qtbase-6.7.0/lib/QtGui.framework/Headers -I/nix/store/n5y9vx5jsilvdxgwaraffln9rg48g0ix-qt5compat-6.7.0/lib/QtCore5Compat.framework/Headers -I/nix/store/qkrjmjlabb70am2s9nr0d2fq98m7xjd3-qtbase-6.7.0/lib/QtCore.framework/Headers -I. -I/System/Library/Frameworks/OpenGL.framework/Headers -I/System/Library/Frameworks/AGL.framework/Headers/ -I. -I/System/Library/Frameworks/OpenGL.framework/Headers -I/System/Library/Frameworks/AGL.framework/Headers/ -I/nix/store/qkrjmjlabb70am2s9nr0d2fq98m7xjd3-qtbase-6.7.0/mkspecs/macx-clang -F/nix/store/qkrjmjlabb70am2s9nr0d2fq98m7xjd3-qtbase-6.7.0/lib -F/nix/store/n5y9vx5jsilvdxgwaraffln9rg48g0ix-qt5compat-6.7.0/lib -o instruments_manager.o instrument/instruments_manager.cpp
In file included from instrument/instruments_manager.cpp:35:
./utils.hpp:96:26: error: 'result_of<(lambda at instrument/instruments_manager.cpp:733:2) &&(std::shared_ptr<AbstractInstrument>)>' is deprecated [-Werror,-Wdeprecated-declarations]
        using T = typename std::result_of<UnaryOperation&&(typename InputContainer::value_type)>::type;
                                ^
instrument/instruments_manager.cpp:732:16: note: in instantiation of function template specialization 'utils::transformIf<std::vector, std::array<std::shared_ptr<AbstractInstrument>, 128>, (lambda at instrument/instruments_manager.cpp:732:36), (lambda at instrument/instruments_manager.cpp:733:2)>' requested here
        return utils::transformIf(insts_, [](InstRef inst) { return inst; },
                      ^
/nix/store/xg2m3mbydbkvbg4zb86zvgg4c35hj1mi-libcxx-16.0.6-dev/include/c++/v1/__type_traits/result_of.h:24:34: note: 'result_of<(lambda at instrument/instruments_manager.cpp:733:2) &&(std::shared_ptr<AbstractInstrument>)>' has been explicitly marked deprecated here
template <class _Callable> class _LIBCPP_DEPRECATED_IN_CXX17 result_of;
                                 ^
/nix/store/xg2m3mbydbkvbg4zb86zvgg4c35hj1mi-libcxx-16.0.6-dev/include/c++/v1/__config:808:41: note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX17'
#    define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED
                                        ^
/nix/store/xg2m3mbydbkvbg4zb86zvgg4c35hj1mi-libcxx-16.0.6-dev/include/c++/v1/__config:781:49: note: expanded from macro '_LIBCPP_DEPRECATED'
#      define _LIBCPP_DEPRECATED __attribute__((deprecated))
                                                ^
1 error generated.
make[1]: *** [Makefile:5627: instruments_manager.o] Error 1

We request C++14, but Qt6 demands C++17 or greater. And Clang seems very strict about this deprecation, which triggers -Werror to abort the build.

There are already comments in the code that acknowledge this deprecation:

// std::result_of is deprecated in C++17 and obsoluted in C++20, use std::invoke_result after C++14
using T = typename std::result_of<UnaryOperation&&(typename InputContainer::value_type)>::type;

Example log: https://hydra.nixos.org/build/256589183/nixlog/1

How to reproduce

  1. nix-build -A nixpkgs.bambootracker-qt6 on macOS with Nix installed

System Information

  • Operating System: macOS
  • BambooTracker Version: 0.6.3
  • Build Type: Nix Package Manager
@OPNA2608 OPNA2608 added the bug Something isn't working label Apr 29, 2024
@rerrahkr
Copy link
Member

I think this is a problem that will be solved if we switch to C++17. I can't check now, but C++17 is not supported by the old systems used by appveyor and others?

@OPNA2608
Copy link
Member Author

The 32-bit Qt 5¹ Windows 7 builds use MinGW 8.1.0, which is the last version that Qt 5 gets tested with to this day. GCC 8.1.0 should support C++17 according to its docs, so it might be worth a try.

The AppVeyor environment only ships Qt 5.15.2, while the latest released version is 5.15.16. Not sure if any changes in the 3 years between those versions affects C++17 compatibility. At least the GitHub CI build should be upgradable to 5.15.16 if that's the case.

The only other build that could imagine maybe having issues is the Ubuntu GitHub CI build, which still uses Qt 5.12. But an update to ubuntu-22.04 is prolly warranted, which should bring it to 5.15.3.

@rerrahkr
Copy link
Member

rerrahkr commented May 1, 2024

For now, we try to make a MR using C++17. and let's see what happened.

To be honest, Windows is no longer officially supported up to 8.1, so I think it should be upgraded to 10, and to Monterey on macOS. wrt Ubuntu, 24.04 is out now, and I think it's okay to bump it up to 22.04.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants