Kraken User Guide
Search…
Cross-compiling for Windows
Cross-compiling Windows binaries from a Linux development machine is a slightly more complicated process. Firstly you will need to install MingW and some other dependencies:
1
$ sudo apt install gcc mingw-w64 automake libtool make go-bindata
Copied!
Next you will need to download Yara sources. Use the latest available version, which at the time of this writing is 4.0.1:
1
$ wget https://github.com/VirusTotal/yara/archive/v4.0.1.tar.gz
Copied!
Unpack the archive and export YARA_SRC to the newly-created folder:
1
$ export YARA_SRC=<folder>
Copied!
Next you need to bootstrap Yara sources and compile them with MingW. These are the instructions to compile it for 32bit:
1
$ cd ${YARA_SRC}
2
$ ./bootstrap.sh
3
$ ./configure --host=i686-w64-mingw32 --disable-magic --disable-cuckoo --without-crypto --prefix=${YARA_SRC}/i686-w64-mingw32
4
$ make -C ${YARA_SRC}
5
$ make -C ${YARA_SRC} install
Copied!
Now we can download and build go-yara for 32bit using the following command:
1
$ go get -d -u github.com/hillu/go-yara
2
$ GOOS=windows GOARCH=386 CGO_ENABLED=1 \
3
CC=i686-w64-mingw32-gcc \
4
PKG_CONFIG_PATH=${YARA_SRC}/i686-w64-mingw32/lib/pkgconfig \
5
go install -ldflags '-extldflags "-static"' github.com/hillu/go-yara
Copied!
Now you can compile Kraken using:
1
$ BACKEND=example.com RULES=test/ make windows
Copied!
If you get errors such as undefined reference to 'yr_compiler_add_file' you might need to pass the PKG_CONFIG_PATH variable:
1
$ PKG_CONFIG_PATH=${YARA_SRC}/i686-w64-mingw32/lib/pkgconfig BACKEND=example.com RULES=test/ make windows
Copied!
Last modified 1yr ago
Copy link