Search code examples
c++mingwtbbvcpkg

Can't install library with vcpkg using MinGW compiler


I'm trying to install the tbb library on Windows using the MinGW C++ compiler g++ and the vcpkg package manager. However, running .\vcpkg install tbb --triplet=x64-mingw-static --host-triplet=x64-mingw-static gives the following error:

The C++ compiler "C:/msys64/mingw64/bin/x86_64-w64-mingw32-g++.exe" is not able to compile a simple test program.

Does anybody have an idea how to solve this issue?


GitHub Bug Report: https://github.com/microsoft/vcpkg/issues/40664


The output of .\vcpkg --version in C:\Users\<user>\vcpkg is:

vcpkg package management program version 2024-08-01-fd884a0d390d12783076341bd43d77c3a6a15658

See LICENSE.txt for license information.

The output of .\g++ --version in C:\msys64\mingw64\bin is:

g++ (Rev3, Built by MSYS2 project) 14.1.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The output of .\x86_64-w64-mingw32-g++.exe --version in C:\msys64\mingw64\bin is:

x86_64-w64-mingw32-g++.exe (Rev3, Built by MSYS2 project) 14.1.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The output of .\vcpkg install tbb --triplet=x64-mingw-static --host-triplet=x64-mingw-static in C:\Users\<user>\vcpkg is:

Computing installation plan...
The following packages will be built and installed:
    tbb:[email protected]
Detecting compiler hash for triplet x64-mingw-static...
Compiler found: C:/msys64/mingw64/bin/x86_64-w64-mingw32-g++.exe
Restored 0 package(s) from C:\Users\<user>\AppData\Local\vcpkg\archives in 226 us. Use --debug to see more details.
Installing 1/1 tbb:[email protected]...
Building tbb:[email protected]...
C:\Users\<user>\vcpkg\triplets\community\x64-mingw-static.cmake: info: loaded community triplet from here. Community triplets are not built in the curated registry and are thus less likely to succeed.
-- Using cached oneapi-src-oneTBB-v2021.13.0.tar.gz.
-- Cleaning sources at C:/Users/<user>/vcpkg/buildtrees/tbb/src/v2021.13.0-c5ed208c36.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source C:/Users/<user>/vcpkg/downloads/oneapi-src-oneTBB-v2021.13.0.tar.gz
-- Using source at C:/Users/<user>/vcpkg/buildtrees/tbb/src/v2021.13.0-c5ed208c36.clean
-- Configuring x64-mingw-static
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:127 (message):
    Command failed: C:/Users/<user>/vcpkg/downloads/tools/ninja/1.10.2-windows/ninja.exe -v
    Working Directory: C:/Users/<user>/vcpkg/buildtrees/tbb/x64-mingw-static-rel/vcpkg-parallel-configure
    Error code: 1
    See logs for more information:
      C:\Users\<user>\vcpkg\buildtrees\tbb\config-x64-mingw-static-dbg-CMakeCache.txt.log
      C:\Users\<user>\vcpkg\buildtrees\tbb\config-x64-mingw-static-rel-CMakeCache.txt.log
      C:\Users\<user>\vcpkg\buildtrees\tbb\config-x64-mingw-static-dbg-CMakeConfigureLog.yaml.log
      C:\Users\<user>\vcpkg\buildtrees\tbb\config-x64-mingw-static-rel-CMakeConfigureLog.yaml.log
      C:\Users\<user>\vcpkg\buildtrees\tbb\config-x64-mingw-static-out.log

Call Stack (most recent call first):
  installed/x64-mingw-static/share/vcpkg-cmake/vcpkg_cmake_configure.cmake:269 (vcpkg_execute_required_process)
  ports/tbb/portfile.cmake:17 (vcpkg_cmake_configure)
  scripts/ports.cmake:192 (include)


error: building tbb:x64-mingw-static failed with: BUILD_FAILED
See https://learn.microsoft.com/vcpkg/troubleshoot/build-failures?WT.mc_id=vcpkg_inproduct_cli for more information.
Elapsed time to handle tbb:x64-mingw-static: 6.3 s
Please ensure you're using the latest port files with `git pull` and `vcpkg update`.
Then check for known issues at:
  https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+tbb
You can submit a new issue at:
  https://github.com/microsoft/vcpkg/issues/new?title=[tbb]+Build+error+on+x64-mingw-static&body=Copy+issue+body+from+C%3A%2FUsers%2F<user>%2Fvcpkg%2Finstalled%2Fvcpkg%2Fissue_body.md

Here are the log files:

File PasteBin Link
C:/Users/<user>/vcpkg/installed/vcpkg/issue_body.md https://pastebin.com/KGhPaR1r
C:\Users\<user>\vcpkg\buildtrees\tbb\config-x64-mingw-static-rel-CMakeConfigureLog.yaml.log https://pastebin.com/CM3kysi8
C:\Users\<user>\vcpkg\buildtrees\tbb\config-x64-mingw-static-rel-CMakeCache.txt.log https://pastebin.com/bkJkstb2
C:\Users\<user>\vcpkg\buildtrees\tbb\config-x64-mingw-static-out.log https://pastebin.com/GkbrQwYs
C:\Users\<user>\vcpkg\buildtrees\tbb\config-x64-mingw-static-dbg-CMakeConfigureLog.yaml.log https://pastebin.com/UZDx7Wnt
C:\Users\<user>\vcpkg\buildtrees\tbb\config-x64-mingw-static-dbg-CMakeCache.txt.log https://pastebin.com/qgDL3vJc

The relevant part of C:\Users\<user>\vcpkg\buildtrees\tbb\config-x64-mingw-static-out.log appears to be the following:

-- The CXX compiler identification is GNU 14.1.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: C:/msys64/mingw64/bin/x86_64-w64-mingw32-g++.exe
-- Check for working CXX compiler: C:/msys64/mingw64/bin/x86_64-w64-mingw32-g++.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.30/Modules/CMakeTestCXXCompiler.cmake:73 (message):
  The C++ compiler

    "C:/msys64/mingw64/bin/x86_64-w64-mingw32-g++.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: 'C:/Users/<user>/vcpkg/buildtrees/tbb/x64-mingw-static-rel/CMakeFiles/CMakeScratch/TryCompile-cvmmjb'
    
    Run Build Command(s): C:/Users/<user>/vcpkg/downloads/tools/ninja/1.10.2-windows/ninja.exe -v cmTC_ef730
    [1/2] C:\msys64\mingw64\bin\x86_64-w64-mingw32-g++.exe    -o CMakeFiles/cmTC_ef730.dir/testCXXCompiler.cxx.obj -c C:/Users/<user>/vcpkg/buildtrees/tbb/x64-mingw-static-rel/CMakeFiles/CMakeScratch/TryCompile-cvmmjb/testCXXCompiler.cxx
    [2/2] C:\WINDOWS\system32\cmd.exe /C "cd . && C:\msys64\mingw64\bin\x86_64-w64-mingw32-g++.exe   CMakeFiles/cmTC_ef730.dir/testCXXCompiler.cxx.obj -o cmTC_ef730.exe -Wl,--out-implib,libcmTC_ef730.dll.a -Wl,--major-image-version,0,--minor-image-version,0  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
    FAILED: cmTC_ef730.exe 
    C:\WINDOWS\system32\cmd.exe /C "cd . && C:\msys64\mingw64\bin\x86_64-w64-mingw32-g++.exe   CMakeFiles/cmTC_ef730.dir/testCXXCompiler.cxx.obj -o cmTC_ef730.exe -Wl,--out-implib,libcmTC_ef730.dll.a -Wl,--major-image-version,0,--minor-image-version,0  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
    Das System kann den angegebenen Pfad nicht finden.
    ninja: build stopped: subcommand failed.

The main error seems to be

Das System kann den angegebenen Pfad nicht finden.

which literally translates to

The system cannot find the path specified.

However, I don't know which path this is referring to. As shown above, the file C:\msys64\mingw64\bin\x86_64-w64-mingw32-g++.exe does exist.


Solution

  • I was able to resolve the question by deleting the following registry entries:

    • HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun
    • HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun

    The following questions seem to be related: