pavel-odintsov / fastnetmon

FastNetMon - very fast DDoS sensor with sFlow/Netflow/IPFIX/SPAN support
https://fastnetmon.com
GNU General Public License v2.0
3.44k stars 569 forks source link

Cap'n'Proto binding for C++ fails to build on Windows #978

Closed pavel-odintsov closed 1 year ago

pavel-odintsov commented 1 year ago

Error:

[31/59] Build Cap'n'Proto binding for C++
FAILED: C:/Users/pavel/fastnetmon/src/simple_packet_capnp/simple_packet.capnp.c++
cmd.exe /C "cd /D C:\Users\pavel\fastnetmon\src\build && LD_LIBRARY_PATH= "PATH=C:\tools\msys64\mingw64\bin;C:\tools\msys64\usr\local\bin;C:\tools\msys64\usr\bin;C:\tools\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\ProgramData\GooGet;C:\Program Files\Google\Compute Engine\metadata_scripts;C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin;C:\Program Files\PowerShell\7;C:\Program Files\Google\Compute Engine\sysprep;C:\Program Files\Git\cmd;C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Conan\conan;C:\Users\pavel\AppData\Local\Microsoft\WindowsApps;C:\Program Files\CMake\bin;C:\Program Files\Vim\vim90;C:\Users\pavel\vcpkg;C:\tools\msys64\;C:\tools\msys64\usr\bin\site_perl;C:\tools\msys64\usr\bin\vendor_perl;C:\tools\msys64\usr\bin\core_perl:/opt/fastnetmon-community/libraries/capnproto_0_8_0/bin" C:/tools/msys64/mingw64/bin/capnp.exe compile --output c++:C:/Users/pavel/fastnetmon/src/simple_packet_capnp --src-prefix=C:/Users/pavel/fastnetmon/src/simple_packet_capnp C:/Users/pavel/fastnetmon/src/simple_packet_capnp/simple_packet.capnp"
'LD_LIBRARY_PATH' is not recognized as an internal or external command,
operable program or batch file.
pavel-odintsov commented 1 year ago

Following fix worked just fine:

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d0fc204..18407dd 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -255,7 +255,7 @@ endif()
 ADD_CUSTOM_COMMAND(
     OUTPUT ${PROJECT_SOURCE_DIR}/simple_packet_capnp/simple_packet.capnp.c++
     DEPENDS ${PROJECT_SOURCE_DIR}/simple_packet_capnp/simple_packet.capnp
-    COMMAND "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}" "PATH=$ENV{PATH}:${CAPNP_CUSTOM_INSTALL_PATH}/bin" ${CAPNP_BINARY} compile --output c++:${PROJECT_SOURCE_DIR}/simple_packet_capnp --src-prefix=${PROJECT_SOURCE_DIR}/simple_packet_capnp ${PROJECT_SOURCE_DIR}/simple_packet_capnp/simple_packet.capnp
+    COMMAND ${CAPNP_BINARY} compile --output c++:${PROJECT_SOURCE_DIR}/simple_packet_capnp --src-prefix=${PROJECT_SOURCE_DIR}/simple_packet_capnp ${PROJECT_SOURCE_DIR}/simple_packet_capnp/simple_packet.capnp
     COMMENT "Build Cap'n'Proto binding for C++"
 )
pavel-odintsov commented 1 year ago

Well, Linux did not like it:

[ 17%] Linking CXX static library libpatricia.a
c++: no such plugin (executable should be 'capnpc-c++')
c++: plugin failed: exit code 1
make[2]: *** [CMakeFiles/simple_packet_capnp.dir/build.make:74: ../simple_packet_capnp/simple_packet.capnp.c++] Error 1
make[1]: *** [CMakeFiles/Makefile2:208: CMakeFiles/simple_packet_capnp.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 17%] Built target patricia
pavel-odintsov commented 1 year ago

It did not work: https://github.com/pavel-odintsov/fastnetmon/commit/aef1fb5510c2e8f968540ae18bd5bb5ed8622346

pavel-odintsov commented 1 year ago

Failed again. Life is sad.

pavel-odintsov commented 1 year ago

Whoa it worked.