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

Building catch fails #59

Open
vid512 opened this issue Jul 19, 2022 · 2 comments
Open

Building catch fails #59

vid512 opened this issue Jul 19, 2022 · 2 comments

Comments

@vid512
Copy link

vid512 commented Jul 19, 2022

It seems that building [email protected] via PMM fails.

CMakeLists.txt:

cmake_minimum_required(VERSION 3.15)
project(MyProject)

include(pmm.cmake)
pmm(DDS DEPENDS [email protected])

add_library(mylib mylib.cpp)

mylib.cpp:

#include <vector>

std::vector<int> name() {
	return {1,2};
}

Trying to build this, I get following errors:

d:\dev\testbed\cmake-pmm>mkdir build

d:\dev\testbed\cmake-pmm>cd build

d:\dev\testbed\cmake-pmm\build>cmake --version
cmake version 3.24.0-rc3

CMake suite maintained and supported by Kitware (kitware.com/cmake).

d:\dev\testbed\cmake-pmm\build>cmake ..
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.
-- The C compiler identification is MSVC 19.29.30130.2
-- The CXX compiler identification is MSVC 19.29.30130.2
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/VC/Tools/MSVC/14.29.30130/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/VC/Tools/MSVC/14.29.30130/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- [pmm] [warn   ] The DDS subcommand is being replaced with BPT! Update soon!
-- [pmm] [warn   ] Using pmm+bpt with multi-conf builds is not yet fully supported.
[info ] Loading 1 dependencies
[info ] Dependency: [email protected]
[info ] NOTE: A prior version of the project build database was found.
[info ] This is not an error, but incremental builds will be invalidated.
[info ] The database is being upgraded, and no further action is necessary.
[info ] [catch2/catch2] Compile: catch2\catch_approx.cpp
[info ] [catch2/catch2] Compile: catch2\catch_assertion_result.cpp
[info ] [catch2/catch2] Compile: catch2\benchmark\detail\catch_stats.cpp
[info ] [catch2/catch2] Compile: catch2\benchmark\internal\catch_benchmark_combined_tu.cpp
[info ] [catch2/catch2] Compile: catch2\catch_config.cpp
[info ] [catch2/catch2] Compile: catch2\catch_message.cpp
[info ] [catch2/catch2] Compile: catch2\catch_assertion_result.cpp   -     332ms [ 3/66]
[info ] [catch2/catch2] Compile: catch2\benchmark\detail\catch_stats.cpp -     332ms [ 2/66]
[info ] [catch2/catch2] Compile: catch2\catch_approx.cpp             -     332ms [ 1/66]
[error] Compilation failed: C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2\catch_assertion_result.cpp
[error] Compilation failed: C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2\benchmark\detail\catch_stats.cpp
[info ] [catch2/catch2] Compile: catch2\benchmark\internal\catch_benchmark_combined_tu.cpp -     332ms [ 4/66]
[error] Compilation failed: C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2\catch_approx.cpp
[info ] [catch2/catch2] Compile: catch2\catch_config.cpp             -     332ms [ 5/66]
[error] Subcommand FAILED [Exited 2]: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/VC/Tools/MSVC/14.29.30130/bin/Hostx64/x64/cl.exe" /MD /EHsc /nologo /permissive- /I "C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src" /showIncludes /c "C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2\catch_assertion_result.cpp" "/FoD:\dev\testbed\cmake-pmm\build\_deps\[email protected]\obj\catch2\catch_assertion_result.cpp.obj" /DWIN32 /D_WINDOWS /GR /EHsc
Note: including file: C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2/catch_assertion_result.hpp
C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2/catch_assertion_result.hpp(11): fatal error C1083: Cannot open include file: 'string': No such file or directory

[error] Compilation failed: C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2\catch_config.cpp
[error] Subcommand FAILED [Exited 2]: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/VC/Tools/MSVC/14.29.30130/bin/Hostx64/x64/cl.exe" /MD /EHsc /nologo /permissive- /I "C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src" /showIncludes /c "C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2\benchmark\detail\catch_stats.cpp" "/FoD:\dev\testbed\cmake-pmm\build\_deps\[email protected]\obj\catch2\benchmark\detail\catch_stats.cpp.obj" /DWIN32 /D_WINDOWS /GR /EHsc
Note: including file: C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2/benchmark/detail/catch_stats.hpp
Note: including file:  C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2/benchmark/catch_estimate.hpp
Note: including file:  C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2/benchmark/catch_outlier_classification.hpp
C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2/benchmark/detail/catch_stats.hpp(16): fatal error C1083: Cannot open include file: 'algorithm': No such file or directory

[error] Subcommand FAILED [Exited 2]: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/VC/Tools/MSVC/14.29.30130/bin/Hostx64/x64/cl.exe" /MD /EHsc /nologo /permissive- /I "C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src" /showIncludes /c "C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2\catch_approx.cpp" "/FoD:\dev\testbed\cmake-pmm\build\_deps\[email protected]\obj\catch2\catch_approx.cpp.obj" /DWIN32 /D_WINDOWS /GR /EHsc
Note: including file: C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2/catch_approx.hpp
Note: including file:  C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2/catch_tostring.hpp
C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2/catch_tostring.hpp(12): fatal error C1083: Cannot open include file: 'vector': No such file or directory

[error] Subcommand FAILED [Exited 2]: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/VC/Tools/MSVC/14.29.30130/bin/Hostx64/x64/cl.exe" /MD /EHsc /nologo /permissive- /I "C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src" /showIncludes /c "C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2\catch_config.cpp" "/FoD:\dev\testbed\cmake-pmm\build\_deps\[email protected]\obj\catch2\catch_config.cpp.obj" /DWIN32 /D_WINDOWS /GR /EHsc
Note: including file: C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2/catch_config.hpp
Note: including file:  C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2/catch_test_spec.hpp
Note: including file:   C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2/internal/catch_unique_ptr.hpp
C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2/internal/catch_unique_ptr.hpp(11): fatal error C1083: Cannot open include file: 'cassert': No such file or directory

[error] Compilation failed: C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2\benchmark\internal\catch_benchmark_combined_tu.cpp
[info ] [catch2/catch2] Compile: catch2\catch_message.cpp            -     225ms [ 6/66]
[error] Compilation failed: C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2\catch_message.cpp
[error] Subcommand FAILED [Exited 2]: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/VC/Tools/MSVC/14.29.30130/bin/Hostx64/x64/cl.exe" /MD /EHsc /nologo /permissive- /I "C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src" /showIncludes /c "C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2\benchmark\internal\catch_benchmark_combined_tu.cpp" "/FoD:\dev\testbed\cmake-pmm\build\_deps\[email protected]\obj\catch2\benchmark\internal\catch_benchmark_combined_tu.cpp.obj" /DWIN32 /D_WINDOWS /GR /EHsc
Note: including file: C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2/benchmark/catch_chronometer.hpp
Note: including file:  C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2/benchmark/catch_clock.hpp
C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2/benchmark/catch_clock.hpp(13): fatal error C1083: Cannot open include file: 'chrono': No such file or directory

[error] Subcommand FAILED [Exited 2]: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/VC/Tools/MSVC/14.29.30130/bin/Hostx64/x64/cl.exe" /MD /EHsc /nologo /permissive- /I "C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src" /showIncludes /c "C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2\catch_message.cpp" "/FoD:\dev\testbed\cmake-pmm\build\_deps\[email protected]\obj\catch2\catch_message.cpp.obj" /DWIN32 /D_WINDOWS /GR /EHsc
Note: including file: C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2/catch_message.hpp
Note: including file:  C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2/internal/catch_result_type.hpp
Note: including file:  C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2/internal/catch_common.hpp
Note: including file:   C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2/internal/catch_compiler_capabilities.hpp
Note: including file:    C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2/internal/catch_platform.hpp
Note: including file:   C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2/internal/catch_stringref.hpp
C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2/internal/catch_stringref.hpp(11): fatal error C1083: Cannot open include file: 'cstddef': No such file or directory

[error] Compilation failed [C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2\catch_approx.cpp]
[error] Compilation failed [C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2\benchmark\detail\catch_stats.cpp]
[error] Compilation failed [C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2\catch_assertion_result.cpp]
[error] Compilation failed [C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2\catch_config.cpp]
[error] Compilation failed [C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2\benchmark\internal\catch_benchmark_combined_tu.cpp]
[error] Compilation failed [C:\Users\vid\AppData\Local\dds\pkg\[email protected]\src\catch2\catch_message.cpp]
[error] Source compilation failed.
[error]
Source compilation failed. Refer to the compiler output.

[error] Refer: https://vector-of-bool.github.io/docs/dds/err/compile-failure.html
CMake Error at build/_pmm/2.1.0/dds.cmake:298 (message):
  DDS failed to build our dependencies [1]
Call Stack (most recent call first):
  build/_pmm/2.1.0/main.cmake:55 (_pmm_dds)
  build/_pmm/2.1.0/main.cmake:66 (_pmm_project_fn)
  CMakeLists.txt:5 (pmm)


-- Configuring incomplete, errors occurred!
See also "D:/dev/testbed/cmake-pmm/build/CMakeFiles/CMakeOutput.log".

Note that this doesn't seem to be problem with the C++ toolchain or CMake. When I remove the pmm(...) call from CMakeList, I can build the example correctly. C++ headers are located correctly:

d:\dev\testbed\cmake-pmm\build>type ..\CMakeLists.txt
cmake_minimum_required(VERSION 3.15)
project(MyProject)

include(pmm.cmake)
#pmm(DDS DEPENDS [email protected])

add_library(mylib mylib.cpp)

d:\dev\testbed\cmake-pmm\build>cmake ..
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.
-- Configuring done
-- Generating done
-- Build files have been written to: D:/dev/testbed/cmake-pmm/build

d:\dev\testbed\cmake-pmm\build>cmake --build .
Microsoft (R) Build Engine version 16.11.0-preview-21302-05+5e37cc992 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

  Building Custom Rule D:/dev/testbed/cmake-pmm/CMakeLists.txt
  mylib.cpp
  mylib.vcxproj -> D:\dev\testbed\cmake-pmm\build\Debug\mylib.lib
  Building Custom Rule D:/dev/testbed/cmake-pmm/CMakeLists.txt

d:\dev\testbed\cmake-pmm\build>dir /b Debug
mylib.lib
mylib.pdb
@vector-of-bool
Copy link
Owner

It looks like the VS environment isn't loaded correctly if executing CMake outside of that environment. Can you try running the CMake configuration again from a Visual Studio Developer Command Prompt?

@vid512
Copy link
Author

vid512 commented Jul 20, 2022

Correct. CMake configuration works correctly when run from VS developer shell, or after running "vcvarsall.bat x64" manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants