lcm-proj / lcm

Lightweight Communications and Marshalling
GNU Lesser General Public License v2.1
944 stars 385 forks source link

Problem building on MSys2/Mingw64 environment #493

Open sulemankm opened 4 months ago

sulemankm commented 4 months ago

Hi, I'm trying to build LCM on windows using MSYS2/MINGW64. I'm getting the following error:

$ cmake --build .
  [31/121] Building CXX object lcm/CMakeFiles/lcm-static.dir/windows/WinPorting.cpp.obj
  FAILED: lcm/CMakeFiles/lcm-static.dir/windows/WinPorting.cpp.obj
  C:\msys64\usr\bin\c++.exe -DLCM_STATIC -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_REENTRANT -IF:/workspaces/lcm-1.5.0/build/lcm -IF:/workspaces/lcm-1.5.0/lcm -isystem C:/msys64/mingw64/include/glib-2.0 -isystem C:/msys64/mingw64/lib/glib-2.0/include -Wno-format-zero-length -fvisibility=hidden -fno-keep-inline-dllexport -MD -MT lcm/CMakeFiles/lcm-static.dir/windows/WinPorting.cpp.obj -MF lcm\CMakeFiles\lcm-static.dir\windows\WinPorting.cpp.obj.d -o lcm/CMakeFiles/lcm-static.dir/windows/WinPorting.cpp.obj -c F:/workspaces/lcm-1.5.0/lcm/windows/WinPorting.cpp
  In file included from F:/workspaces/lcm-1.5.0/lcm/windows/WinPorting.cpp:3:
  F:/workspaces/lcm-1.5.0/lcm/windows/WinPorting.h:9:10: fatal error: direct.h: No such file or directory
      9 | #include <direct.h>
        |          ^~~~~~~~~~
  compilation terminated.
  [38/121] Building CXX object lcm/CMakeFiles/lcm.dir/windows/WinPorting.cpp.obj
  FAILED: lcm/CMakeFiles/lcm.dir/windows/WinPorting.cpp.obj
  C:\msys64\usr\bin\c++.exe -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_REENTRANT -Dlcm_EXPORTS -IF:/workspaces/lcm-1.5.0/build/lcm -IF:/workspaces/lcm-1.5.0/lcm -isystem C:/msys64/mingw64/include/glib-2.0 -isystem C:/msys64/mingw64/lib/glib-2.0/include -Wno-format-zero-length -fvisibility=hidden -fno-keep-inline-dllexport -MD -MT lcm/CMakeFiles/lcm.dir/windows/WinPorting.cpp.obj -MF lcm\CMakeFiles\lcm.dir\windows\WinPorting.cpp.obj.d -o lcm/CMakeFiles/lcm.dir/windows/WinPorting.cpp.obj -c F:/workspaces/lcm-1.5.0/lcm/windows/WinPorting.cpp
  In file included from F:/workspaces/lcm-1.5.0/lcm/windows/WinPorting.cpp:3:
  F:/workspaces/lcm-1.5.0/lcm/windows/WinPorting.h:9:10: fatal error: direct.h: No such file or directory
      9 | #include <direct.h>
        |          ^~~~~~~~~~
  compilation terminated.
  [40/121] Building CXX object lcm/CMakeFiles/lcm.dir/windows/WinLCM.cpp.obj
  ninja: build stopped: subcommand failed.

I've checked the include folder in MINGW64 and it does contain the header file "direct.h", but the build system can't find it.