seladb / PcapPlusPlus

PcapPlusPlus is a multiplatform C++ library for capturing, parsing and crafting of network packets. It is designed to be efficient, powerful and easy to use. It provides C++ wrappers for the most popular packet processing engines such as libpcap, Npcap, WinPcap, DPDK, AF_XDP and PF_RING.
https://pcapplusplus.github.io/
The Unlicense
2.63k stars 641 forks source link

MSVC Conan builds fail #584

Closed notzain closed 3 years ago

notzain commented 3 years ago

Trying to install PcapPlusPlus on Windows using Conan. Building on Linux worked fine, but am having issues on Windows. I'm on MSVC2019, tried both x86 and x64 Debug.

pcapplusplus/20.08@bincrafters/stable: Configuring sources in C:\Users\Zain\.conan\data\pcapplusplus\20.08\bincrafters\stable\source
1> [CMake] 
1> [CMake] pcapplusplus/20.08@bincrafters/stable: Copying sources to build folder
1> [CMake] pcapplusplus/20.08@bincrafters/stable: Building your package in C:\Users\Zain\.conan\data\pcapplusplus\20.08\bincrafters\stable\build\21058dd938549dcbd1b5d2b5b903eb7a2f8c60e8
1> [CMake] pcapplusplus/20.08@bincrafters/stable: Generator make created conanbuildinfo.mak
1> [CMake] pcapplusplus/20.08@bincrafters/stable: Generator visual_studio created conanbuildinfo.props
1> [CMake] pcapplusplus/20.08@bincrafters/stable: Calling build()
1> [CMake] 
1> [CMake] ***********************************************
1> [CMake] PcapPlusPlus Visual Studio configuration script 
1> [CMake] ***********************************************
1> [CMake] 
1> [CMake] Unkown parameter --winpcap-home
1> [CMake] pcapplusplus/20.08@bincrafters/stable: 
1> [CMake] boost/1.75.0: WARN: Patching user-config.jam
1> [CMake] boost/1.75.0: WARN: 
1> [CMake] using zlib : 1.2.11 : <include>"C:/Users/Zain/.conan/data/zlib/1.2.11/_/_/package/9ffec4a59d60a2ccf636e06ba57253e21417f01b/include" <search>"C:/Users/Zain/.conan/data/zlib/1.2.11/_/_/package/9ffec4a59d60a2ccf636e06ba57253e21417f01b/lib" <name>zlib ;
1> [CMake] using bzip2 : 1.0.8 : <include>"C:/Users/Zain/.conan/data/bzip2/1.0.8/_/_/package/8334c588c229b05feb8ace75d0841c244f0e0e92/include" <search>"C:/Users/Zain/.conan/data/bzip2/1.0.8/_/_/package/8334c588c229b05feb8ace75d0841c244f0e0e92/lib" <name>bz2 ;
1> [CMake] using "msvc" : 14.2 :   : 
1> [CMake]  ;
1> [CMake] boost/1.75.0: WARN: b2.exe -q target-os=windows architecture=x86 address-model=32 binary-format=pe abi=ms --layout=system --user-config=C:\.conan\440be8\1\source_subfolder\tools\build\user-config.jam -sNO_ZLIB=0 -sNO_BZIP2=0 -sNO_LZMA=1 -sNO_ZSTD=1 boost.locale.iconv=on boost.locale.icu=off --disable-icu runtime-link=shared runtime-debugging=on threading=multi visibility=hidden link=static variant=debug --with-atomic --with-chrono --with-container --with-context --with-contract --with-coroutine --with-date_time --with-exception --with-fiber --with-filesystem --with-graph --with-iostreams --with-json --with-locale --with-log --with-math --with-nowide --with-program_options --with-random --with-regex --with-serialization --with-stacktrace --with-system --with-test --with-thread --with-timer --with-type_erasure --with-wave toolset=msvc pch=on -sICONV_PATH=C:\Users\Zain\.conan\data\libiconv\1.16\_\_\package\9ffec4a59d60a2ccf636e06ba57253e21417f01b   install --prefix=C:\.conan\54b871\1 -j4 --abbreviate-paths -d0 --debug-configuration --build-dir="C:\.conan\12fa50\1"
1> [CMake] WARN: replace_in_file didn't find pattern '/MTd ' in 'Configurations\10-main.conf' file.
1> [CMake] WARN: replace_in_file didn't find pattern '/MTd"' in 'Configurations\10-main.conf' file.
1> [CMake] pcapplusplus/20.08@bincrafters/stable: ERROR: Package '21058dd938549dcbd1b5d2b5b903eb7a2f8c60e8' build failed
1> [CMake] pcapplusplus/20.08@bincrafters/stable: WARN: Build folder C:\Users\Zain\.conan\data\pcapplusplus\20.08\bincrafters\stable\build\21058dd938549dcbd1b5d2b5b903eb7a2f8c60e8
1> [CMake] ERROR: pcapplusplus/20.08@bincrafters/stable: Error in build() method, line 99
1> [CMake]  self.run("configure-windows-visual-studio.bat --vs-version %s --winpcap-home %s --pthreads-home %s" % (vs_version, winpcap_path, pthreads_path))
1> [CMake]  ConanException: Error 1 while executing configure-windows-visual-studio.bat --vs-version vs2019 --winpcap-home C:\Users\Zain\.conan\data\winpcap\4.1.3\bincrafters\stable\package\9ffec4a59d60a2ccf636e06ba57253e21417f01b --pthreads-home C:\Users\Zain\.conan\data\pthreads4w\3.0.0\_\_\package\c0788c4f9fe1fd52656fa6b16760bd85a9f9b38d
1> [CMake] CMake Error at out/build/x86-Debug/conan.cmake:402 (message):
1> [CMake]   Conan install failed='1'
1> [CMake] Call Stack (most recent call first):
1> [CMake]   out/build/x86-Debug/conan.cmake:497 (conan_cmake_install)
1> [CMake]   CMakeLists.txt:26 (conan_cmake_run)
1> [CMake] -- Configuring incomplete, errors occurred!
1> [CMake] See also "C:/Users/Zain/Workspace/cpp-grcp-testground/out/build/x86-Debug/CMakeFiles/CMakeOutput.log".
1> 'cmd.exe' '/c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe"  -G "Ninja"  -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="C:\Users\Zain\Workspace\cpp-grcp-testground\out\install\x86-Debug" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx86/x86/cl.exe"  -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" "C:\Users\Zain\Workspace\cpp-grcp-testground" 2>&1"' execution failed with error: ''cmd.exe' '/c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe"  -G "Ninja"  -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="C:\Users\Zain\Workspace\cpp-grcp-testground\out\install\x86-Debug" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx86/x86/cl.exe"  -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" "C:\Users\Zain\Workspace\cpp-grcp-testground" 2>&1"' returned with exit code: 1'.
seladb commented 3 years ago

I think I know the root case, it's because in version 20.08 the --winpcap-home configuration flag was replaced with --pcap-sdk.

Let me open a PR to fix this issue.

seladb commented 3 years ago

I opened this PR: https://github.com/bincrafters/conan-pcapplusplus/pull/4

Hopefully the bincrafters team can merge it soon

ericLemanissier commented 3 years ago

It's now merged, and the fix should be available on the stable channel. @notzain can you retry ?

notzain commented 3 years ago

@seladb @ericLemanissier Thank you, it works now! Just to note: Conan did not automatically fetch the newest update, even when deleting cache like so conan remove pcapplusplus/* -b -s -f. I had to manually go into the {home dir}/.conan/data/, delete the pcapplusplus folder, and finally reconfigure cmake & conan install.

seladb commented 3 years ago

Just to note: Conan did not automatically fetch the newest update, even when deleting cache

I'm not an expert in Conan, maybe @ericLemanissier can elaborate more on why this happens. Since the problem is resolved I'm closing this issue now.

ericLemanissier commented 3 years ago

@notzain you missed the -p argument to conan remove. Alternatively you could just have used the -u argument to conan create or conan install to force conan updating the recipe