无法使用msiot/husky在windows中从源代码构建husky

Unable to build husky from source in windows using ms-iot/husky

本文关键字:husky windows 源代码 构建 msiot      更新时间:2024-05-09

我正试图在windows中使用repo从源代码构建huskyhttps://github.com/ms-iot/husky/tree/melodic-devel,但当我运行catkin_make_isolated时,windows无法构建它,因为husky使用"unistd.h",而我无法在windows中获取该标头,对此有什么解决办法吗?

错误:===>处理柳絮包装:'husty_base'===>使用env进行构建:'C:\Users\catkin_ws\devel_insolated\husty_msgs\env.bat'Makefile存在,正在跳过显式cmake调用。。。===>在'C:\Users\catkin_ws\build_isolated\husty_base'中设置cmake_check_build_system

Microsoft(R(程序维护实用程序版本14.25.28614.0版权所有(C(Microsoft Corporation。保留所有权利。

===>nmake in'C:\Users\catkin_ws\build_isolated\husty_base'

Microsoft(R(程序维护实用程序版本14.25.28614.0版权所有(C(Microsoft Corporation。保留所有权利。

[11%]已构建目标husty_base__setup_util.py_exec_install_python[17%]正在构建CXX对象CMakeFiles/horizon_legacy.dir/src/horizon_legacy/Logger.cpp.objcl:命令行警告D9002:忽略未知选项"-std=c++11"Logger.cppC: \Users\catkin_ws\src\husky\husky_base\src\horizon_legacy\Logger.cpp(50(:致命错误C1083:无法打开包含文件:'unistd.h':没有这样的文件或目录NMAKE:致命错误U1077:"C:\PROGRA~2\MICROS~1\2019\COMUN~1\VC\Tools\MSVC\1425~1.286\bin\Hostx64\x64\cl.exe":返回代码"0x2"停止NMAKE:致命错误U1077:"C:\Program Files(x86(\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX64\x64\NMAKE.exe":返回代码"0x2"停止NMAKE:致命错误U1077:"C:\Program Files(x86(\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX64\x64\NMAKE.exe":返回代码"0x2"停止<==无法处理包"husty_base":命令'['C:\Users\catkin_ws\devel_sisolate\husty_msgs\env.bat','nmake']'返回非零退出状态2

通过运行以下程序再现此错误:===>cd'C:\Users\catkin_ws\build_isolated\husty_base'&amp;'C: \Users\catkin_ws\devel_sisolated\husty_msgs\env.bat'nmake

命令失败,正在退出。

我下载了最新版本的repo,发现文件'\husky myodyc\husty_base\src\horizon_legacy\Logger.cpp'中有一个不匹配的#if/#endif对。我在修改Logger.cpp文件后成功构建了repo。

#include <iostream>
#include <fstream>
#include <signal.h>
#if !defined(_WIN32)
#  include <unistd.h>
#else
#  include <windows.h>
#endif