主要参考文章:https://blog.csdn.net/HW140701/article/details/119546019
参考文章中的过程比较详细,主要说说我在编译过程中遇到的问题:
- WARNING: Download from https://nodejs.org/dist/v16.19.0/node-v16.19.0-win-x64.zip failed: class java.io.IOException connect timed out
ERROR: Analysis of target ‘//mediapipe/examples/desktop/hello_world:hello_world’ failed; build aborted: Analysis failed
INFO: Elapsed time: 58.350s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (52 packages loaded, 182 targets configured)
currently loading: mediapipe/calculators/core … (2 packages)
Fetching @npm; Restarting. 55s
Fetching @yarn; Restarting. 55s
出现上述问题,主要是网络连接问题(connect timed out),在编译过程中会下载第三方库,这个需要科学上网, 有时候多试几次也可以成功
-
找不到 cl.exe, link.exe等
这个问题可以 参考 https://stackoverflow.com/questions/56970693/why-bazel-does-not-find-visual-c-build-tools/75744123#75744123; 主要是由于在msys 设置的bazel_vs 和bazel_vc没有效果,需要在环境变量中手动添加 高级系统设置—>环境变量-----> xxx用户变量:如下所是
-
在编译hand_tracking的时候 遇到错误 error LNK2019: 无法解析的外部符号 “private: static class RegistrationToken::RegistrationToken const mediapipe::tool::OptionsRegistry::registration_token” (??KaTeX parse error: Expected group after '_' at position 123: …ken@3@B),函数 "??_̲_E?registration_token@VInferenceCalculatorOptions@mediapipe@@@OptionsRegistry@tool@mediapipe@@YAXXZ" (??__E?$registration_token@VInferenceCalculatorOptions@mediapipe@@@OptionsRegistry@tool@mediapipe@@YAXXZ) 中引用了该符号
bazel-out\x64_windows-opt\bin\mediapipe\examples\desktop\hand_tracking\hand_tracking_cpu.exe : fatal error LNK1120: 1 个无法解析的外部命令
Target //mediapipe/examples/desktop/hand_tracking:hand_tracking_cpu failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 456.884s, Critical Path: 187.55s
INFO: 2592 processes: 660 internal, 1932 local.
FAILED: Build did NOT complete successfully
解决办法参考:https://github.com/google-ai-edge/mediapipe/issues/4060 ,注释了相关代码,最后运行成功 -
如果还有其他问题,可能还和bazel和mediapipe版本有关系, bazel-3.7.2 /4.2.2/5.3.2/6.5我都测试过最后成功的版本信息:
mediapipe0.10.9
bazle 6.5
vs2022
opencv-3.4.10-vc14_vc15
anaconda3.0 (python 3.9.13 tensorflow 2.9.0)