googleprojectzero / TinyInst

A lightweight dynamic instrumentation library
Apache License 2.0
1.18k stars 119 forks source link

Build failed with vs 2022 error MSB8066 #59

Closed Vincebye closed 2 months ago

Vincebye commented 2 years ago
D:\fuzzing\TinyInst>git submodule update --init --recursive
Submodule 'third_party/mbuild' (https://github.com/intelxed/mbuild) registered for path 'third_party/mbuild'
Submodule 'third_party/xed' (https://github.com/intelxed/xed) registered for path 'third_party/xed'
Cloning into 'D:/fuzzing/TinyInst/third_party/mbuild'...
Cloning into 'D:/fuzzing/TinyInst/third_party/xed'...
fatal: unable to access 'https://github.com/intelxed/xed/': OpenSSL SSL_read: Connection was reset, errno 10054
fatal: clone of 'https://github.com/intelxed/xed' into submodule path 'D:/fuzzing/TinyInst/third_party/xed' failed
Failed to clone 'third_party/xed'. Retry scheduled
Cloning into 'D:/fuzzing/TinyInst/third_party/xed'...
Submodule path 'third_party/mbuild': checked out '03ee9d52adb7f01d476ced0dba1534cfc7edff36'
Submodule path 'third_party/xed': checked out '5976632eeaaaad7890c2109d0cfaf4012eaca3b8'
Submodule path 'third_party/xed': checked out '5976632eeaaaad7890c2109d0cfaf4012eaca3b8'

D:\fuzzing\TinyInst>mkdir build

D:\fuzzing\TinyInst>cd build

D:\fuzzing\TinyInst\build>cmake -G "Visual Studio 17 2022" -A x64 ..
-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.19044.
-- The C compiler identification is MSVC 19.31.31104.0
-- The CXX compiler identification is MSVC 19.31.31104.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: D:/VS/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.31.31103/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: D:/VS/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Python3: C:/Lan/Python/Python310/python.exe (found version "3.10.2") found components: Interpreter
-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.19044.
-- Configuring done
-- Generating done
-- Build files have been written to: D:/fuzzing/TinyInst/build

D:\fuzzing\TinyInst\build>cmake --build . --config Release
用于 .NET Framework 的 Microsoft (R) 生成引擎版本 17.1.0+ae57d105c
版权所有(C) Microsoft Corporation。保留所有权利。

  Checking Build System
  Building Xed
  [MBUILD ERROR] Did not find MSVS version!

    File "D:\fuzzing\TinyInst\third_party\xed\mfile.py", line 109, in <module>
      retval = work()
    File "D:\fuzzing\TinyInst\third_party\xed\mfile.py", line 103, in work
      retval = xed_mbuild.execute()
    File "D:\fuzzing\TinyInst\third_party\xed\xed_mbuild.py", line 2804, in execute
      xed_args(env)  # parse command line knobs
    File "D:\fuzzing\TinyInst\third_party\xed\xed_mbuild.py", line 965, in xed_args
      env.parse_args(env['xed_defaults'])
    File "C:\Lan\Python\Python310\lib\site-packages\mbuild\env.py", line 1082, in parse_args
      self.process_user_settings()
    File "C:\Lan\Python\Python310\lib\site-packages\mbuild\env.py", line 988, in process_user_settings
      self.set_compiler_env()
    File "C:\Lan\Python\Python310\lib\site-packages\mbuild\env.py", line 1309, in set_compiler_env
      build_env.set_env_ms(self)
    File "C:\Lan\Python\Python310\lib\site-packages\mbuild\build_env.py", line 417, in set_env_ms
      find_ms_toolchain(env)
    File "C:\Lan\Python\Python310\lib\site-packages\mbuild\build_env.py", line 255, in find_ms_toolchain
      env['vc_dir'] = msvs.set_msvs_env(env)
    File "C:\Lan\Python\Python310\lib\site-packages\mbuild\msvs.py", line 1417, in set_msvs_env
      die("Did not find MSVS version!")
D:\VS\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(245,5): error MSB8066: “D:\fuzzing\TinyInst\build\CMakeFiles\d6e37e99e96048e7237ea1122
0acc1c7\xed.lib.rule;D:\fuzzing\TinyInst\build\CMakeFiles\b7a948e40366c8aff482e0195f570b40\xed.rule;D:\fuzzing\TinyInst\third_party\CMakeLists.txt”的自定义生成已退出,代码为 1。 [D:\fuzzing\TinyInst\bui
ld\third_party\xed.vcxproj]
ifratric commented 2 years ago

Thanks for reporting. I'll take a look next week when I return from vacation. It looks like third_party/xed and third_party/mbuild need to be updated from https://github.com/intelxed/xed and https://github.com/intelxed/mbuild

Vincebye commented 2 years ago

Thanks for your responses.I try it again,delete the mbuild and xed,and download the lasted code from https://github.com/intelxed/xed and https://github.com/intelxed/mbuild.But it not worked.It's still the error


➜ cmake -G "Visual Studio 17 2022" -A x64 ..
-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.19044.
-- The C compiler identification is MSVC 19.31.31104.0
-- The CXX compiler identification is MSVC 19.31.31104.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: D:/VS/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.31.31103/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: D:/VS/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Python3: C:/Lan/Python/Python310/python.exe (found version "3.10.2") found components: Interpreter
-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.19044.
-- Configuring done
-- Generating done
-- Build files have been written to: D:/fuzzing/TinyInst/build
build on master ≡  ~2
➜ cmake --build . --config Release
用于 .NET Framework 的 Microsoft (R) 生成引擎版本 17.1.0+ae57d105c
版权所有(C) Microsoft Corporation。保留所有权利。

Checking Build System Building Xed [INVOKED] D:/fuzzing/TinyInst/third_party/xed/mfile.py [START TIME] 2022-04-23 18_46_27 中国标准时间 [CURRENT DIRECTORY] D:\fuzzing\TinyInst\build\third_party [UNAME] ('Windows', 'vincebye', '10', '10.0.19044', 'AMD64') [SYSTEM] Windows [HOSTNAME] vincebye [BUILD_OS] win [BUILD_CPU] x86-64 [HOST_OS] win [HOST_CPU] x86-64 [MBUILD ERROR] Did not find MSVS version!

File "D:\fuzzing\TinyInst\third_party\xed\mfile.py", line 106, in <module>
  retval = work()
File "D:\fuzzing\TinyInst\third_party\xed\mfile.py", line 100, in work
  retval = xed_mbuild.execute()
File "D:\fuzzing\TinyInst\third_party\xed\xed_mbuild.py", line 2774, in execute
  xed_args(env)  # parse command line knobs
File "D:\fuzzing\TinyInst\third_party\xed\xed_mbuild.py", line 964, in xed_args
  env.parse_args(env['xed_defaults'])
File "C:\Lan\Python\Python310\lib\site-packages\mbuild\env.py", line 1082, in parse_args
  self.process_user_settings()
File "C:\Lan\Python\Python310\lib\site-packages\mbuild\env.py", line 988, in process_user_settings
  self.set_compiler_env()
File "C:\Lan\Python\Python310\lib\site-packages\mbuild\env.py", line 1309, in set_compiler_env
  build_env.set_env_ms(self)
File "C:\Lan\Python\Python310\lib\site-packages\mbuild\build_env.py", line 417, in set_env_ms
  find_ms_toolchain(env)
File "C:\Lan\Python\Python310\lib\site-packages\mbuild\build_env.py", line 255, in find_ms_toolchain
  env['vc_dir'] = msvs.set_msvs_env(env)
File "C:\Lan\Python\Python310\lib\site-packages\mbuild\msvs.py", line 1417, in set_msvs_env
  die("Did not find MSVS version!")

D:\VS\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(245,5): error MSB 8066: “D:\fuzzing\TinyInst\build\CMakeFiles\d6e37e99e96048e7237ea11220acc1c7\xed.lib.rule;D:\fuzzing\TinyInst\build\CMa keFiles\b7a948e40366c8aff482e0195f570b40\xed.rule;D:\fuzzing\TinyInst\third_party\CMakeLists.txt”的自定义生成已退出,代 码为 1。 [D:\f uzzing\TinyInst\build\third_party\xed.vcxproj]

ifratric commented 2 years ago

Perhaps this mbuild patch is needed https://github.com/intelxed/mbuild/pull/35/files

ifratric commented 2 years ago

(From a pull request that's unfortunately not merged)

Vincebye commented 2 years ago

(From a pull request that's unfortunately not merged)

It not worked,There are no code about the vs2022 in mssvs.py.The mbuild project need to be updated.I would better use old version vs

Vincebye commented 2 years ago

Finally,I solve this error.I install the vs2019 and reset the fold of windows kit.

ifratric commented 2 years ago

I am reopening the issue as building with VS2022 is something I'd like to support. Do you remember, when you tried to compile it, if you were running from VS command prompt or from "normal" command prompt? When I attempted to build from x64 Native Tools Command Prompt for VS 2022 command prompt I got an error, but a different error than the one you got.

ifratric commented 2 years ago

With the latest commit (https://github.com/googleprojectzero/TinyInst/commit/b50d1f8fc3eadb715fae13e7fd6278e040004f2d) building with VS2022 works for me, but note that it requires running from a VS command prompt.

Vincebye commented 2 years ago

I am reopening the issue as building with VS2022 is something I'd like to support. Do you remember, when you tried to compile it, if you were running from VS command prompt or from "normal" command prompt? When I attempted to build from x64 Native Tools Command Prompt for VS 2022 command prompt I got an error, but a different error than the one you got.

from "normal" command prompt.Thanks for your udapte.

sdt27 commented 2 years ago

With the latest commit (b50d1f8) building with VS2022 works for me, but note that it requires running from a VS command prompt.

This method solved my problem(vs2022).Thanks.