Windows build instructions

Hello, guys

I’m aware on building windows suricata binary from source. Is there actual instructions on it? Seems that doc\INSTALL.WINDOWS is outdated (broken links, e.t.c).

I want to integrate suricata client with my server, that uses custom log transfer protocol. But initially I have problem with building it in Windows 10 environment (both cygwin and mingw). Is there any “Best practice” on building it (windows versions, cygwin\mingw versions, e.t.c)?

Thanks for the answers!

Not a full guide, but this is how we build in github-ci on msys/mingw:

1 Like

Can you also please try/confirm the build instructions from here - Eve.json windows timestamp field has "Eastern Daylight Time" appended to timestamp - #8 by pevma ?

1 Like

Thank you, guys!

I was inspired your both answers to write script of build automation for Windows (semi-automation, but who cares). So it satisfied my purposes.

Aware of PowerShell syntax:

msys2_shell.cmd -defterm -no-start -here -mingw64 -c "yes | pacman -Syuu"

msys2_shell.cmd -defterm -no-start -here -mingw64 -c $(@"
yes | pacman -S --noconfirm --needed base-devel \
mingw-w64-x86_64-toolchain subversion
"@ -replace "\\`n"," ")

msys2_shell.cmd -defterm -no-start -mingw64 -here -c $(@"
yes | pacman -S --noconfirm \
mingw64/mingw-w64-x86_64-libtool mingw64/mingw-w64-x86_64-pcre \
mingw64/mingw-w64-x86_64-lua mingw64/mingw-w64-x86_64-geoip \
mingw64/mingw-w64-x86_64-luajit-git wget jansson  jansson-devel libpcre pcre \
pcre-devel gcc  gcc-libs  make autoconf autogen automake git libyaml \
libyaml-devel zlib zlib-devel pkg-config mingw64/mingw-w64-x86_64-nspr \
mingw64/mingw-w64-x86_64-nss mingw64/mingw-w64-x86_64-rust \
mingw64/mingw-w64-x86_64-python3-yaml mingw64/mingw-w64-x86_64-jansson \
msys/jansson-devel msys/jansson mingw-w64-x86_64-toolchain automake1.16 \
automake-wrapper autoconf libtool libyaml-devel pcre-devel jansson-devel \
make mingw-w64-x86_64-libyaml mingw-w64-x86_64-pcre mingw-w64-x86_64-rust \
mingw-w64-x86_64-jansson unzip p7zip python-setuptools mingw-w64-x86_64-python-yaml \
mingw-w64-x86_64-jq mingw-w64-x86_64-libxml2
"@ -replace "\\`n"," ")

msys2_shell.cmd -defterm -no-start -mingw64 -here -c $(@"
mkdir /npcap-sdk \
&& curl -O \
&& unzip -d /npcap-sdk
"@ -replace "\\`n"," ")

msys2_shell.cmd -defterm -no-start -mingw64 -here -c  $(@"
git clone -b suricata-6.0.2 \
&& cd suricata \
&& git clone -b 0.5.x
"@ -replace "\\`n"," ")

msys2_shell.cmd -defterm -no-start -mingw64 -here -c  $(@"
cd suricata \
&& cargo install cbindgen
"@ -replace "\\`n"," ")

msys2_shell.cmd -defterm -no-start -mingw64 -here -c  $(@"
curl -s -O \
&& 7z -y x -o/npcap-bin npcap-1.00.exe && cp /npcap-bin/*.dll ./suricata
"@ -replace "\\`n"," ")

msys2_shell.cmd -defterm -no-start -mingw64 -here -c  $(@"
cd suricata \
&& export PATH=`$PATH:/c/Users/$env:USERNAME/.cargo/bin \
&& ./ \
&& ./configure \
--with-libpcap-includes=/npcap-sdk/Include/ --with-libpcap-libraries=/npcap-sdk/Lib/x64/ \
--with-libnss-libraries=/mingw64/lib/ --with-libnss-includes=/mingw64/include/nss3/ \
--with-libnspr-libraries=/mingw64/lib/ --with-libnspr-includes=/mingw64/include/nspr/ \
--enable-lua --disable-gccmarch-native --enable-gccprotect \
&& make clean \
&& make -j 2
"@ -replace "\\`n"," ")

msys2_shell.cmd -defterm -no-start -mingw64 -here -c  $(@"
mkdir -p /c/Program\ files/Suricata/{log,rules} \
&& cd suricata \
&& cp ./src/.libs/suricata.exe /c/Program\ files/Suricata \
&& cp ./suricata.yaml /c/Program\ files/Suricata \
&& cp ./rules/*.rules /c/Program\ files/Suricata/rules \
&& cp ./threshold.config /c/Program\ files/Suricata \
&& cp /c/msys64/mingw64/bin/{libGeoIP-1.dll,libssp-0.dll,libjansson-4.dll,libwinpthread-1.dll,\
nssutil3.dll,libplds4.dll,zlib1.dll} /c/Program\ files/Suricata
"@ -replace "\\`n","")

The link to the whole script:

It was tested on clean Azure Windows 10 Pro v20H2 (OS Build 19042.1052) image.

Thank you very much for sharing the script!

1 Like