0
votes

I am trying to build husky from source in windows with the repo from https://github.com/ms-iot/husky/tree/melodic-devel,but when i run catkin_make_isolated ,windows is unable to build it because husky use "unistd.h" and i couldnt get that header in windows,is there any workaound for this?

Error: ==> Processing catkin package: 'husky_base' ==> Building with env: 'C:\Users\catkin_ws\devel_isolated\husky_msgs\env.bat' Makefile exists, skipping explicit cmake invocation... ==> nmake cmake_check_build_system in 'C:\Users\catkin_ws\build_isolated\husky_base'

Microsoft (R) Program Maintenance Utility Version 14.25.28614.0 Copyright (C) Microsoft Corporation. All rights reserved.

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

Microsoft (R) Program Maintenance Utility Version 14.25.28614.0 Copyright (C) Microsoft Corporation. All rights reserved.

[ 11%] Built target husky_base__setup_util.py_exec_install_python [ 17%] Building CXX object CMakeFiles/horizon_legacy.dir/src/horizon_legacy/Logger.cpp.obj cl : Command line warning D9002 : ignoring unknown option '-std=c++11' Logger.cpp C:\Users\catkin_ws\src\husky\husky_base\src\horizon_legacy\Logger.cpp(50): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory NMAKE : fatal error U1077: 'C:\PROGRA~2\MICROS~1\2019\COMMUN~1\VC\Tools\MSVC\1425~1.286\bin\Hostx64\x64\cl.exe' : return code '0x2' Stop. NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX64\x64\nmake.exe"' : return code '0x2' Stop. NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX64\x64\nmake.exe"' : return code '0x2' Stop. <== Failed to process package 'husky_base': Command '['C:\Users\catkin_ws\devel_isolated\husky_msgs\env.bat', 'nmake']' returned non-zero exit status 2

Reproduce this error by running: ==> cd 'C:\Users\catkin_ws\build_isolated\husky_base' && 'C:\Users\catkin_ws\devel_isolated\husky_msgs\env.bat' nmake

Command failed, exiting.

1

1 Answers

1
votes

I downloaded the latest version of the repo, found out that there was a mismatched #if/#endif pair in file '\husky-melodic\husky_base\src\horizon_legacy\Logger.cpp'. I built the repo successfully after modified the Logger.cpp file.

#include <iostream>
#include <fstream>
#include <signal.h>

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