0
0
mirror of https://github.com/netdata/netdata.git synced 2024-11-24 00:19:42 +00:00
netdata_netdata/packaging/utils/compile-and-run-windows.sh
Costa Tsaousis f6141cc4f3
Log to windows (#18688)
* split netdata logger into multiple files - no acctual code changes

* move around some more code

* base for implementing windows events logging

* fix for the last commit

* working logging to windows events, but not pretty yet

* fix compilation on linux

* added scripts for compiling the resource file and importing the manifest

* added validation that the provider is available

* working manifest for ETW (Event Tracing for Windows)

* compile the messages dll with msys tools

* handle wevents configuration

* when starting under clion, do not start as service

* unify conversion to utf16

* fix bug in windows-events.plugin that was incorrectly not processing right the publishers that do not have a UUID

* enable wevents as default logging for all methods, under windows

* log to windows using EventCreate.exe for the messages

* do not log all the fields

* added log-forwarder to spawn-server-windows

* fix last character being cut-off when converting from utf-16

* updated info

* updated any_to_utf16() to be always consistent

* added utf16_to_utf8()

* external plugins inherit windows events

* fix wrong log source

* fix spawn server logs

* log to multiple event log sources

* generate custom messages dll for event viewer - working

* removed debugging code

* cleanup log forwarder entries from the thread, to avoid bad file descriptor in poll()

* .mc and its manifest are automatically generated

* sanitizers should not remove trailing underscores

* use the resources dll for the netdata directory; set the default maxSize to windows events

* do not set customer flag on event ids; use the same naming for channels and providers

* work to unify manifest and resources

* netdata now logs using ETW

* implemented etw and wel logging in netdata

* minor changes

* updated windows installer to install the manifest

* do not install etw if the manifest is not there

* allow loggings to WEL and ETW at the same time

* fix the installer conditions

* fix nsi

* detect ci paths for sys utils

* enable ETW is CI

* better integration of spawn server with logger

* use script to find SDK path

* use auto-discovery of sdk and visual studio

* fix overlapping link.exe with msys; do not escape percentage when it is not followed by a number; added more documentation about windows

* debug info for path

* fixes compilation scripts

* ETW and WEL are always required on Windows

* in progress for supporting full text search queries

* find mvc versions

* improve find-sdk-path.sh

* fix the script once again

* fetch event data for full text search

* fix script again

* fix script, yes again

* fts using event data

* code renames and cleanup for clarity

* update documentation

* full text search switches plugin to load everything synchronously

* full text search using the individual event data fields, without using XML

* close all idle provider handles after 5 mins

* added EventsAPI field

* supported exposing all system fields; started documentation about windows events plugin

* avoid crash because of unitialized memory

* remove debugging

* do not add qualifiers and version when they are zero

* updated docs

* copy the manifest too

* rework on installing manifest and dll

* completed documentation

* work on windows-events sources list

* fix windows installer logic

* removed unecessary include

* added image to documentation
2024-10-15 09:04:59 +03:00

93 lines
3.0 KiB
Bash

#!/bin/sh
# On MSYS2, install these dependencies to build netdata:
install_dependencies() {
pacman -S \
git cmake ninja clang base-devel msys2-devel \
libyaml-devel libzstd-devel libutil-linux libutil-linux-devel \
mingw-w64-x86_64-toolchain mingw-w64-ucrt-x86_64-toolchain \
mingw64/mingw-w64-x86_64-mold ucrt64/mingw-w64-ucrt-x86_64-mold \
msys/gdb ucrt64/mingw-w64-ucrt-x86_64-gdb mingw64/mingw-w64-x86_64-gdb \
msys/zlib-devel mingw64/mingw-w64-x86_64-zlib ucrt64/mingw-w64-ucrt-x86_64-zlib \
msys/libuv-devel ucrt64/mingw-w64-ucrt-x86_64-libuv mingw64/mingw-w64-x86_64-libuv \
liblz4-devel mingw64/mingw-w64-x86_64-lz4 ucrt64/mingw-w64-ucrt-x86_64-lz4 \
openssl-devel mingw64/mingw-w64-x86_64-openssl ucrt64/mingw-w64-ucrt-x86_64-openssl \
protobuf-devel mingw64/mingw-w64-x86_64-protobuf ucrt64/mingw-w64-ucrt-x86_64-protobuf \
msys/pcre2-devel mingw64/mingw-w64-x86_64-pcre2 ucrt64/mingw-w64-ucrt-x86_64-pcre2 \
msys/brotli-devel mingw64/mingw-w64-x86_64-brotli ucrt64/mingw-w64-ucrt-x86_64-brotli \
msys/ccache ucrt64/mingw-w64-ucrt-x86_64-ccache mingw64/mingw-w64-x86_64-ccache \
mingw64/mingw-w64-x86_64-go ucrt64/mingw-w64-ucrt-x86_64-go \
mingw64/mingw-w64-x86_64-nsis \
msys/libcurl msys/libcurl-devel
}
if [ "${1}" = "install" ]
then
install_dependencies || exit 1
exit 0
fi
BUILD_FOR_PACKAGING="Off"
if [ "${1}" = "package" ]
then
BUILD_FOR_PACKAGING="On"
fi
export PATH="/usr/local/bin:${PATH}"
WT_ROOT="$(pwd)"
BUILD_TYPE="Debug"
NULL=""
if [ -z "${MSYSTEM}" ]; then
build="${WT_ROOT}/build-${OSTYPE}"
else
build="${WT_ROOT}/build-${OSTYPE}-${MSYSTEM}"
fi
if [ "$USER" = "vk" ]; then
build="${WT_ROOT}/build"
fi
set -exu -o pipefail
if [ ! -d "${build}" ]
then
/usr/bin/cmake -S "${WT_ROOT}" -B "${build}" \
-G Ninja \
-DCMAKE_INSTALL_PREFIX="/opt/netdata" \
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
-DCMAKE_C_FLAGS="-fstack-protector-all -O0 -ggdb -Wall -Wextra -Wno-char-subscripts -Wa,-mbig-obj -pipe -DNETDATA_INTERNAL_CHECKS=1 -D_FILE_OFFSET_BITS=64 -D__USE_MINGW_ANSI_STDIO=1" \
-DBUILD_FOR_PACKAGING=${BUILD_FOR_PACKAGING} \
-DUSE_MOLD=Off \
-DNETDATA_USER="${USER}" \
-DDEFAULT_FEATURE_STATE=Off \
-DENABLE_H2O=Off \
-DENABLE_ML=On \
-DENABLE_BUNDLED_JSONC=On \
-DENABLE_BUNDLED_PROTOBUF=Off \
-DENABLE_PLUGIN_APPS=On \
${NULL}
fi
ninja -v -C "${build}" || ninja -v -C "${build}" -j 1
echo "Stopping service Netdata"
sc stop "Netdata" || echo "Failed"
ninja -v -C "${build}" install || ninja -v -C "${build}" -j 1
# register the event log publisher
cmd.exe //c "$(cygpath -w -a "/opt/netdata/usr/bin/wevt_netdata_install.bat")"
#echo
#echo "Compile with:"
#echo "ninja -v -C \"${build}\" install || ninja -v -C \"${build}\" -j 1"
echo "starting netdata..."
# enable JIT debug with gdb
export MSYS="error_start:$(cygpath -w /usr/bin/gdb)"
rm -rf /opt/netdata/var/log/netdata/*.log || echo
/opt/netdata/usr/bin/netdata -D