diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-07-08 09:28:58 +0200 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-07-08 09:29:53 +0200 |
commit | 955e1314ebfd83d6f44d88547159e6492035681e (patch) | |
tree | 11fd116f62c1aa8caaf49b5d250e1d8b82da54fd | |
parent | 64948b6840032b04ef00bfe207baa29dd445d141 (diff) | |
download | libquotient-955e1314ebfd83d6f44d88547159e6492035681e.tar.gz libquotient-955e1314ebfd83d6f44d88547159e6492035681e.zip |
CI: use GCC 11 and (therefore) ubuntu-22.04
GCC 10 ICE's[1] in qt_connection_util.h code; and ubuntu-20.04 doesn't
have GCC 11.
Also: patch a Qt 5.15 header when compiling with GCC because a
combination of Qt 5.15 and GCC 11 in turn triggers QTBUG-91909/90568...
Which in turn required moving Qt setup before the build environment
setup. Life's fun.
[1] Internal Compiler Error
-rw-r--r-- | .github/workflows/ci.yml | 41 | ||||
-rw-r--r-- | README.md | 41 | ||||
-rw-r--r-- | lib/qt_connection_util.h | 5 |
3 files changed, 58 insertions, 29 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d619385f..f84356b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,12 +47,12 @@ jobs: compiler: LLVM e2ee: e2ee static-analysis: codeql - - os: ubuntu-latest + - os: ubuntu-22.04 qt-version: '5.15.2' compiler: GCC e2ee: e2ee static-analysis: sonar - - os: ubuntu-20.04 + - os: ubuntu-22.04 qt-version: '5.15.2' compiler: GCC e2ee: e2ee @@ -82,11 +82,30 @@ jobs: with: fetch-depth: 0 + - name: Cache Qt + id: cache-qt + uses: actions/cache@v2 + with: + path: ${{ runner.workspace }}/Qt + key: ${{ runner.os }}${{ matrix.platform }}-Qt${{ matrix.qt-version }}-cache + + - name: Install Qt + uses: jurplel/install-qt-action@v2.14.0 + with: + version: ${{ matrix.qt-version }} + arch: ${{ matrix.qt-arch }} + cached: ${{ steps.cache-qt.outputs.cache-hit }} + - name: Setup build environment run: | if [ '${{ matrix.compiler }}' == 'GCC' ]; then - echo "CC=gcc-10" >>$GITHUB_ENV - echo "CXX=g++-10" >>$GITHUB_ENV + echo "CC=gcc" >>$GITHUB_ENV + echo "CXX=g++" >>$GITHUB_ENV + if [ '${{ startsWith(matrix.qt-version, '5') }}' == 'true' ]; then + # Patch Qt to avoid GCC tumbling over QTBUG-90568/QTBUG-91909 + sed -i 's/ThreadEngineStarter<void>(ThreadEngine<void> \*_threadEngine)/ThreadEngineStarter(ThreadEngine<void> \*_threadEngine)/' \ + $Qt5_DIR/include/QtConcurrent/qtconcurrentthreadengine.h + fi elif [[ '${{ runner.os }}' != 'Windows' ]]; then echo "CC=clang" >>$GITHUB_ENV echo "CXX=clang++" >>$GITHUB_ENV @@ -124,20 +143,6 @@ jobs: cmake -E make_directory ${{ runner.workspace }}/build echo "BUILD_PATH=${{ runner.workspace }}/build/libQuotient" >>$GITHUB_ENV - - name: Cache Qt - id: cache-qt - uses: actions/cache@v2 - with: - path: ${{ runner.workspace }}/Qt - key: ${{ runner.os }}${{ matrix.platform }}-Qt${{ matrix.qt-version }}-cache - - - name: Install Qt - uses: jurplel/install-qt-action@v2.14.0 - with: - version: ${{ matrix.qt-version }} - arch: ${{ matrix.qt-arch }} - cached: ${{ steps.cache-qt.outputs.cache-hit }} - - name: Install Ninja (macOS/Windows) if: ${{ !startsWith(matrix.os, 'ubuntu') }} uses: seanmiddleditch/gha-setup-ninja@v3 @@ -43,7 +43,7 @@ your application, as described below. - CMake 3.16 or newer (from your package management system or [the official website](https://cmake.org/download/)) - A C++ toolchain with that supports at least some subset of C++20: - - GCC 10 (Windows, Linux, macOS), Clang 11 (Linux), Apple Clang 12 (macOS) + - GCC 11 (Windows, Linux, macOS), Clang 11 (Linux), Apple Clang 12 (macOS) and Visual Studio 2019 (Windows) are the oldest officially supported. - Any build system that works with CMake should be fine: GNU Make and ninja on any platform, NMake and jom on Windows are known to work. @@ -165,14 +165,37 @@ by setting `Quotient_INSTALL_TESTS` to `OFF`. #### Building fails -If `cmake` fails with... -``` -CMake Warning at CMakeLists.txt:11 (find_package): - By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project - has asked CMake to find a package configuration file provided by - "Qt5Widgets", but CMake did not find one. -``` -...then you need to set the right `-DCMAKE_PREFIX_PATH` variable, see above. +- If `cmake` fails with + ``` + CMake Warning at CMakeLists.txt:11 (find_package): + By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project + has asked CMake to find a package configuration file provided by + "Qt5Widgets", but CMake did not find one. + ``` + then you need to set the right `-DCMAKE_PREFIX_PATH` variable, see above. + +- If you use GCC and get an "unknown declarator" compilation error in the file +`qtconcurrentthreadengine.h` - unfortunately, it is an actual error in Qt 5.15 +sources, see https://bugreports.qt.io/browse/QTBUG-90568 (or +https://bugreports.qt.io/browse/QTBUG-91909). The Qt company did not make +an open source release with the fix, therefore: + + - if you're on Linux - try to use Qt from your package management system, as + most likely this bug is already fixed in the packages + - if you're on Windows, or if you have to use Qt (5.15) from download.qt.io + for any other reason, you should apply the fix to Qt sources: locate + the file (the GCC error message tells exactly where it is), find the line + with the (strange-looking) `ThreadEngineStarter` constructor definition: + ```cplusplus + ThreadEngineStarter<void>(ThreadEngine<void> \*_threadEngine) + ``` + and remove the template specialisation from the constructor name so that it + looks like + ```cplusplus + ThreadEngineStarter(ThreadEngine<void> \*_threadEngine) + ``` + This will fix your build (and any other build involving QtConcurrent from + this installation of Qt - the fix is not specific to Quotient in any way). #### Logging configuration diff --git a/lib/qt_connection_util.h b/lib/qt_connection_util.h index edcdc572..90bc3f9b 100644 --- a/lib/qt_connection_util.h +++ b/lib/qt_connection_util.h @@ -91,8 +91,9 @@ inline auto connectSingleShot(auto* sender, auto signal, ContextT* context, (context->*slot)(args...); }; # endif - return _impl::connect<_impl::SingleShot>(sender, signal, context, - std::move(boundSlot), connType); + return _impl::connect<_impl::SingleShot>( + sender, signal, context, + std::forward<decltype(boundSlot)>(boundSlot), connType); } else { return _impl::connect<_impl::SingleShot>(sender, signal, context, slot, connType); |