mgbowen/windows-fido-bridge

Build error when checking out mingw_stdthreads-src

Erisa opened this issue · 2 comments

Erisa commented

Small note that I am doing this on Debian 10 Buster, following the instructions in the readme, and I have essentially no experience with CMake myself. I originally used WSL1 but tested with WSL2 and on a different machine to verify the bug.

The error seems to indicate it likely isn't related to any specific Debian release.

The important part seems to be:

[ 11%] Creating directories for 'mingw_stdthreads-populate'
[ 22%] Performing download step (git clone) for 'mingw_stdthreads-populate'
Cloning into 'mingw_stdthreads-src'...
fatal: reference is not a tree: c01463398bd2b09c2afa0cd06c12d7b1cc8a470d
CMake Error at mingw_stdthreads-subbuild/mingw_stdthreads-populate-prefix/tmp/mingw_stdthreads-populate-gitclone.cmake:40 (message):
  Failed to checkout tag: 'c01463398bd2b09c2afa0cd06c12d7b1cc8a470d'

And for completeness here's the full log:

Click to view full log
erisa@Tuturu:~/windows-fido-bridge/build$ cmake -DCMAKE_BUILD_TYPE=Release ..
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Executing inside WSL: ON
-- Version: 7.0.1
-- Build type: Release
-- CXX_STANDARD: 20
-- Performing Test has_std_20_flag
-- Performing Test has_std_20_flag - Failed
-- Performing Test has_std_2a_flag
-- Performing Test has_std_2a_flag - Success
-- Performing Test SUPPORTS_USER_DEFINED_LITERALS
-- Performing Test SUPPORTS_USER_DEFINED_LITERALS - Success
-- Performing Test FMT_HAS_VARIANT
-- Performing Test FMT_HAS_VARIANT - Success
-- Required features: cxx_variadic_templates
-- Looking for strtod_l
-- Looking for strtod_l - not found
-- Build spdlog: 1.7.0
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Build type: Release
-- Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/erisa/windows-fido-bridge/build
erisa@Tuturu:~/windows-fido-bridge/build$ make -j16
Scanning dependencies of target nested_windows
Scanning dependencies of target fmt
Scanning dependencies of target gtest
[  2%] Creating directories for 'nested_windows'
[  7%] Building CXX object _deps/fmt-build/CMakeFiles/fmt.dir/src/format.cc.o
[  7%] Building CXX object _deps/fmt-build/CMakeFiles/fmt.dir/src/os.cc.o
[  9%] No download step for 'nested_windows'
[ 11%] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
[ 14%] No update step for 'nested_windows'
[ 16%] No patch step for 'nested_windows'
[ 19%] Performing configure step for 'nested_windows'
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/x86_64-w64-mingw32-gcc
-- Check for working C compiler: /usr/bin/x86_64-w64-mingw32-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/x86_64-w64-mingw32-g++
[ 21%] Linking CXX static library libfmt.a
-- Check for working CXX compiler: /usr/bin/x86_64-w64-mingw32-g++ -- works
-- Detecting CXX compiler ABI info
[ 21%] Built target fmt
Scanning dependencies of target spdlog
[ 26%] Building CXX object _deps/spdlog-build/CMakeFiles/spdlog.dir/src/spdlog.cpp.o
[ 26%] Building CXX object _deps/spdlog-build/CMakeFiles/spdlog.dir/src/stdout_sinks.cpp.o
[ 30%] Building CXX object _deps/spdlog-build/CMakeFiles/spdlog.dir/src/file_sinks.cpp.o
[ 30%] Building CXX object _deps/spdlog-build/CMakeFiles/spdlog.dir/src/color_sinks.cpp.o
[ 33%] Building CXX object _deps/spdlog-build/CMakeFiles/spdlog.dir/src/async.cpp.o
[ 35%] Building CXX object _deps/spdlog-build/CMakeFiles/spdlog.dir/src/cfg.cpp.o
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Executing inside WSL: ON
make[3]: Entering directory '/home/erisa/windows-fido-bridge/build/nested-windows-build/src/nested_windows-build/_deps/mingw_stdthreads-subbuild'
make[4]: Entering directory '/home/erisa/windows-fido-bridge/build/nested-windows-build/src/nested_windows-build/_deps/mingw_stdthreads-subbuild'
make[5]: Entering directory '/home/erisa/windows-fido-bridge/build/nested-windows-build/src/nested_windows-build/_deps/mingw_stdthreads-subbuild'
Scanning dependencies of target mingw_stdthreads-populate
make[5]: Leaving directory '/home/erisa/windows-fido-bridge/build/nested-windows-build/src/nested_windows-build/_deps/mingw_stdthreads-subbuild'
make[5]: Entering directory '/home/erisa/windows-fido-bridge/build/nested-windows-build/src/nested_windows-build/_deps/mingw_stdthreads-subbuild'
[ 11%] Creating directories for 'mingw_stdthreads-populate'
[ 22%] Performing download step (git clone) for 'mingw_stdthreads-populate'
Cloning into 'mingw_stdthreads-src'...
fatal: reference is not a tree: c01463398bd2b09c2afa0cd06c12d7b1cc8a470d
CMake Error at mingw_stdthreads-subbuild/mingw_stdthreads-populate-prefix/tmp/mingw_stdthreads-populate-gitclone.cmake:40 (message):
  Failed to checkout tag: 'c01463398bd2b09c2afa0cd06c12d7b1cc8a470d'


make[5]: *** [CMakeFiles/mingw_stdthreads-populate.dir/build.make:92: mingw_stdthreads-populate-prefix/src/mingw_stdthreads-populate-stamp/mingw_stdthreads-populate-download] Error 1
make[5]: Leaving directory '/home/erisa/windows-fido-bridge/build/nested-windows-build/src/nested_windows-build/_deps/mingw_stdthreads-subbuild'
make[4]: *** [CMakeFiles/Makefile2:76: CMakeFiles/mingw_stdthreads-populate.dir/all] Error 2
make[4]: Leaving directory '/home/erisa/windows-fido-bridge/build/nested-windows-build/src/nested_windows-build/_deps/mingw_stdthreads-subbuild'
make[3]: *** [Makefile:84: all] Error 2
make[3]: Leaving directory '/home/erisa/windows-fido-bridge/build/nested-windows-build/src/nested_windows-build/_deps/mingw_stdthreads-subbuild'

CMake Error at /usr/share/cmake-3.16/Modules/FetchContent.cmake:915 (message):
  Build step for mingw_stdthreads failed: 2
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FetchContent.cmake:1006 (__FetchContent_directPopulate)
  cmake/BuildMingwStdThreads.cmake:16 (FetchContent_Populate)
  CMakeLists.txt:34 (include)


-- Configuring incomplete, errors occurred!
See also "/home/erisa/windows-fido-bridge/build/nested-windows-build/src/nested_windows-build/CMakeFiles/CMakeOutput.log".
make[2]: *** [CMakeFiles/nested_windows.dir/build.make:107: nested-windows-build/src/nested_windows-stamp/nested_windows-configure] Error 1
make[1]: *** [CMakeFiles/Makefile2:202: CMakeFiles/nested_windows.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 38%] Linking CXX static library ../../../lib/libgtest.a
[ 38%] Built target gtest
[ 40%] Linking CXX static library libspdlog.a
[ 40%] Built target spdlog
make: *** [Makefile:163: all] Error 2
erisa@Tuturu:~/windows-fido-bridge/build$

Seems like probably an upstream issue with mingw_stdthreads-populate but I can't find a whole lot of information on that.
Normally if it was something I understood I would have gone down my own rabbit hole of debugging but this is entirely out of my understanding and I can't find sufficient information to get started with it.

See below comment.

Erisa commented

It was pointed out to me by @spotlightishere that these lines are the culprit:

FetchContent_Declare(mingw_stdthreads
GIT_REPOSITORY https://github.com/meganz/mingw-std-threads.git
GIT_TAG c01463398bd2b09c2afa0cd06c12d7b1cc8a470d # HEAD as of 2020/10/28
GIT_SHALLOW ON
)

As far as we understand it fails to checkout the commit c01463398bd2b09c2afa0cd06c12d7b1cc8a470d because its configured to pull shallow (GIT_SHALLOW ON) and the newer commit 6 days ago (meganz/mingw-std-threads@f6365f9) is the only one present in that clone.

I imagine this would be fixed by either adjusting GIT_SHALLOW or constantly updating the commit hash to a newer one whenever one is pushed to meganz/mingw-std-threads.
In my testing, changing GIT_TAG to f6365f900fb9b1cd6014c8d1cf13ceacf8faf3de made it build fine.

Thanks for root-causing the issue! I think this pattern works fine in the other dependency installers because I use pinned release tags, but std-mingw-threads hasn't had a release since 2019 and I need some changes to master since then. I just ended up removing the GIT_SHALLOW option; it'd be nice to keep it, but mingw-std-threads' entire repo is only ~400KB, so it's not a huge deal.

I'll go ahead and close this; let me know if you run into any other issues! 🙂