だから私はWindows 10でCMakeプロジェクトを構築しようとしています.Visual Studio 2019がCMakeとすべてのC++ツールとともにインストールされています. ただし、Visual Studio Developer コマンド プロンプトまたは Visual Studio Developer PowerShell で cmake -S external\ebpf-verifier -B external\ebpf-verifier\build を実行しようとすると、奇妙な動作が発生します。これは、Developer PowerShell で実行した結果です。コマンド ライン バージョンでも同様の結果が得られます。コマンド プロンプトでの実行との主な違いの 1 つは、pwd の結果が現在のディレクトリとして /d/ebpf-for-windows になり、PS の結果が D:\ebpf-for-windows になることです。これは、/c/ と /d/ がある理由である Devkitpro がインストールされているためだと思いますが、devkitpro バージョンを実行していないため、それを指す構成変数または環境変数が必要です。
D:\ebpf-for-windows>cmake -S external\ebpf-verifier -B external\ebpf-verifier\build -- C コンパイラの識別は MSVC 19.28.29915.0 です -- CXX コンパイラの識別は MSVC 19.28.29915.0 です -- C コンパイラの動作を確認します: /c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.28.29910/bin/HostX86/x86/cl.exe -- C コンパイラの動作を確認します: /c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.28.29910/bin/HostX86/x86/cl.exe - /opt/devkitpro/msys2/usr/ で壊れた CMake エラーshare/cmake-3.17.3/Modules/CMakeTestCCompiler.cmake:60 (メッセージ): C コンパイラ
"/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.28.29910/bin/HostX86/x86/cl.exe"
簡単なテスト プログラムをコンパイルすることはできません。
次の出力で失敗します。
Change Dir: /d/ebpf-for-windows/external/ebpf-verifier/build/CMakeFiles/CMakeTmp
Run Build Command(s):/opt/devkitpro/msys2/usr/bin/make.exe cmTC_42b2b/fast && /opt/devkitpro/msys2/usr/bin/make -f CMakeFiles/cmTC_42b2b.dir/build.make CMakeFiles/cmTC_42b2b.dir/build
make[1]: Entering directory '/d/ebpf-for-windows/external/ebpf-verifier/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_42b2b.dir/testCCompiler.c.o
"/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.28.29910/bin/HostX86/x86/cl.exe" -o CMakeFiles/cmTC_42b2b.dir/testCCompiler.c.o -c /d/ebpf-for-windows/external/ebpf-verifier/build/CMakeFiles/CMakeTmp/testCCompiler.c
Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29915 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release
testCCompiler.c
Linking C executable cmTC_42b2b.exe
/opt/devkitpro/msys2/usr/bin/cmake.exe -E cmake_link_script CMakeFiles/cmTC_42b2b.dir/link.txt --verbose=1
"/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.28.29910/bin/HostX86/x86/cl.exe" CMakeFiles/cmTC_42b2b.dir/testCCompiler.c.o -o cmTC_42b2b.exe
Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29915 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release
cl : Command line warning D9024 : unrecognized source file type 'CMakeFiles/cmTC_42b2b.dir/testCCompiler.c.o', object file assumed
Microsoft (R) Incremental Linker Version 14.28.29915.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:testCCompiler.c.exe
/out:cmTC_42b2b.exe
CMakeFiles/cmTC_42b2b.dir/testCCompiler.c.o
LINK : fatal error LNK1181: cannot open input file 'CMakeFiles\cmTC_42b2b.dir\testCCompiler.c.o'
make[1]: *** [CMakeFiles/cmTC_42b2b.dir/build.make:107: cmTC_42b2b.exe] Error 2
make[1]: Leaving directory '/d/ebpf-for-windows/external/ebpf-verifier/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:141: cmTC_42b2b/fast] Error 2
CMake は、このプロジェクトを正しく生成できません。コール スタック (最新の呼び出しが最初): CMakeLists.txt:4 (プロジェクト)
-- 設定が不完全です。エラーが発生しました! 「/d/ebpf-for-windows/external/ebpf-verifier/build/CMakeFiles/CMakeOutput.log」も参照してください。「/d/ebpf-for-windows/external/ebpf-verifier/build/CMakeFiles/CMakeError.log」も参照してください。