# How to build beats in windows

**URL:** <https://discuss.elastic.co/t/how-to-build-beats-in-windows/141711>\
**Category:** Beats\
**Created:** [July 26, 2018, 8:04am UTC](https://discuss.elastic.co/t/how-to-build-beats-in-windows/141711 "2018-07-26T08:04:06Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manjukb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/manjukb/32/33758_2.png) [@Manjukb](https://discuss.elastic.co/u/Manjukb)\
**Post date:** [July 26, 2018, 8:04am UTC](https://discuss.elastic.co/t/how-to-build-beats-in-windows/141711/1 "2018-07-26T08:04:07Z")

</div>

i'm currently trying to build a beats plugin to get some windows specific info so trying to build it on windows

seams there is lot of dependency on Linux to develop the beats

if i try to do `make setup` it says `mkdir cmd not found` which is linux cmd

question is how to build any beats which pulls windows specific metrics like metric-beat

Thanks  
Manju

---

<div class="post-metadata">

**Author:** ![pierhugues](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pierhugues/32/48383_2.png) [@pierhugues](https://discuss.elastic.co/u/pierhugues)\
**Post date:** [July 26, 2018, 1:18pm UTC](https://discuss.elastic.co/t/how-to-build-beats-in-windows/141711/2 "2018-07-26T13:18:41Z")

</div>

Are you running a fresh copy of master? We recently did a lot of change in the build system.

---

<div class="post-metadata">

**Author:** ![Manjukb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/manjukb/32/33758_2.png) [@Manjukb](https://discuss.elastic.co/u/Manjukb)\
**Post date:** [August 6, 2018, 7:36am UTC](https://discuss.elastic.co/t/how-to-build-beats-in-windows/141711/3 "2018-08-06T07:36:16Z")

</div>

yes im using master

in new version can i build a beat in windows ??

---

<div class="post-metadata">

**Author:** ![pierhugues](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pierhugues/32/48383_2.png) [@pierhugues](https://discuss.elastic.co/u/pierhugues)\
**Post date:** [August 6, 2018, 2:09pm UTC](https://discuss.elastic.co/t/how-to-build-beats-in-windows/141711/4 "2018-08-06T14:09:15Z")

</div>

@Manjukb mkdir should work with and without powershell, I just tested it on a windows 2012 vm.  
Running `make setup` is usually verbose can you add the output of this command to this post?

What steps are your running to make your beats? I will try to reproduce the error.

---

<div class="post-metadata">

**Author:** ![Manjukb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/manjukb/32/33758_2.png) [@Manjukb](https://discuss.elastic.co/u/Manjukb)\
**Post date:** [August 7, 2018, 6:30am UTC](https://discuss.elastic.co/t/how-to-build-beats-in-windows/141711/5 "2018-08-07T06:30:54Z")

</div>

@pierhugues i fallowed below steps

cloned elastic beats under src\github\elastic\beats  
and created a folder under `src\github` with my github username

now i tried to generate sample beat using this cmd `python ``Traceback (most recent call last): File ``"C:\Users\ManjunathKB\go\src\github.com\elastic\beats\script\generate.py"`  
`project_name = raw_input("Beat Name [Examplebeat]: ") or ``"examplebeat"`  
`NameError: name 'raw_input' is not defined`

So i generated a sample beat in linux pushed it to git and cloned under Manjukb folder

now i tried to do make setup

`C:\Users\ManjunathKB\go\src\github.com\Manjukb\smartcenterBeat>make setup`

`FIND: Parameter format not correct`  
`FIND: Parameter format not correct`  
`FIND: Parameter format not correct`  
`mkdir -p vendor/github.com/elastic/`  
`The syntax of the command is incorrect.`  
`make: *** [copy-vendor] Error 1`

make update

`C:\Users\ManjunathKB\go\src\github.com\Manjukb\smartcenterBeat>make update`  
`FIND: Parameter format not correct`  
`FIND: Parameter format not correct`  
`FIND: Parameter format not correct`  
`process_begin: CreateProcess(NULL, pwd, ...) failed.`  
`process_begin: CreateProcess(NULL, pwd, ...) failed.`  
`process_begin: CreateProcess(NULL, pwd, ...) failed.`  
`process_begin: CreateProcess(NULL, pwd, ...) failed.`  
`process_begin: CreateProcess(NULL, pwd, ...) failed.`  
`'test' is not recognized as an internal or external command,`  
`operable program or batch file.`  
`'virtualenv' is not recognized as an internal or external command,`  
`operable program or batch file.`  
`make: *** [python-env] Error 1`

please let me know if need more info

Thanks

Manju

---

<div class="post-metadata">

**Author:** ![Charaf\_Ahmed](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/charaf_ahmed/32/30467_2.png) [@Charaf\_Ahmed](https://discuss.elastic.co/u/Charaf_Ahmed)\
**Post date:** [August 7, 2018, 7:17am UTC](https://discuss.elastic.co/t/how-to-build-beats-in-windows/141711/6 "2018-08-07T07:17:46Z")

</div>

Another solution will be to compile in Golang with `GOOS = windosws ...`

---

<div class="post-metadata">

**Author:** ![Manjukb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/manjukb/32/33758_2.png) [@Manjukb](https://discuss.elastic.co/u/Manjukb)\
**Post date:** [August 7, 2018, 7:19am UTC](https://discuss.elastic.co/t/how-to-build-beats-in-windows/141711/7 "2018-08-07T07:19:45Z")

</div>

> [@Charaf\_Ahmed](#):
>
> Another solution will be to compile in Golang with `GOOS = windosws ...`

do you mean do this in linux ??

---

<div class="post-metadata">

**Author:** ![Manjukb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/manjukb/32/33758_2.png) [@Manjukb](https://discuss.elastic.co/u/Manjukb)\
**Post date:** [August 7, 2018, 7:23am UTC](https://discuss.elastic.co/t/how-to-build-beats-in-windows/141711/8 "2018-08-07T07:23:39Z")

</div>

i just want to know how metric beat is developed

i think metric beat must be developed in windows env as it pulls windows specific data let me know if i'm wrong

please share how its built

Thanks

---

<div class="post-metadata">

**Author:** ![Manjukb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/manjukb/32/33758_2.png) [@Manjukb](https://discuss.elastic.co/u/Manjukb)\
**Post date:** [August 7, 2018, 7:26am UTC](https://discuss.elastic.co/t/how-to-build-beats-in-windows/141711/10 "2018-08-07T07:26:39Z")

</div>

why it was withdrawn ??

---

<div class="post-metadata">

**Author:** ![Charaf\_Ahmed](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/charaf_ahmed/32/30467_2.png) [@Charaf\_Ahmed](https://discuss.elastic.co/u/Charaf_Ahmed)\
**Post date:** [August 7, 2018, 7:27am UTC](https://discuss.elastic.co/t/how-to-build-beats-in-windows/141711/11 "2018-08-07T07:27:40Z")

</div>

the compilation in linux, yes, but the binary, you can use it after in windows. using Golang . voila

---

<div class="post-metadata">

**Author:** ![Charaf\_Ahmed](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/charaf_ahmed/32/30467_2.png) [@Charaf\_Ahmed](https://discuss.elastic.co/u/Charaf_Ahmed)\
**Post date:** [August 7, 2018, 7:28am UTC](https://discuss.elastic.co/t/how-to-build-beats-in-windows/141711/12 "2018-08-07T07:28:57Z")

</div>

the advantage with Golang is that you can compile, for example, your program and run it in an environment OS you want.

---

<div class="post-metadata">

**Author:** ![Charaf\_Ahmed](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/charaf_ahmed/32/30467_2.png) [@Charaf\_Ahmed](https://discuss.elastic.co/u/Charaf_Ahmed)\
**Post date:** [August 7, 2018, 7:33am UTC](https://discuss.elastic.co/t/how-to-build-beats-in-windows/141711/13 "2018-08-07T07:33:08Z")

</div>

1. [https://github.com/elastic/beats](https://github.com/elastic/beats)
2. [https://gist.github.com/asukakenji/f15ba7e588ac42795f421b48b8aede63](https://gist.github.com/asukakenji/f15ba7e588ac42795f421b48b8aede63)
3. [https://stackoverflow.com/questions/20829155/how-to-cross-compile-from-windows-to-linux](https://stackoverflow.com/questions/20829155/how-to-cross-compile-from-windows-to-linux)

---

<div class="post-metadata">

**Author:** ![Manjukb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/manjukb/32/33758_2.png) [@Manjukb](https://discuss.elastic.co/u/Manjukb)\
**Post date:** [August 7, 2018, 9:05am UTC](https://discuss.elastic.co/t/how-to-build-beats-in-windows/141711/14 "2018-08-07T09:05:04Z")

</div>

ok if i compile it on Linux how i will get windows specific data

i have mentioned that i'm trying to pull windows specific data like  
`os version`, `process info` and many more

please help

---

<div class="post-metadata">

**Author:** ![Charaf\_Ahmed](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/charaf_ahmed/32/30467_2.png) [@Charaf\_Ahmed](https://discuss.elastic.co/u/Charaf_Ahmed)\
**Post date:** [August 7, 2018, 9:11am UTC](https://discuss.elastic.co/t/how-to-build-beats-in-windows/141711/15 "2018-08-07T09:11:29Z")

</div>

A metricbeat compiler for example, you will have both the executable and a configuration file yml to which you specify what you want to collect as data.

---

<div class="post-metadata">

**Author:** ![andrewkroh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewkroh/32/3784_2.png) [@andrewkroh](https://discuss.elastic.co/u/andrewkroh)\
**Post date:** [August 7, 2018, 1:54pm UTC](https://discuss.elastic.co/t/how-to-build-beats-in-windows/141711/16 "2018-08-07T13:54:08Z")

</div>

> [@Manjukb](#):
>
> i just want to know how metric beat is developed

As someone who has developed lots of Go code that targets Windows I can share my process.

I run all of the `make` commands from a \*nix machine. This is for all of the things that are not actually Go, like generating the configuration files and other ancillary files. This is because the `make` targets are not all that portable in Beats. We're slowly addressing this by migrating build logic out of make an into Go so that it is much more portable and will run on Windows.

My daily development environment is not Windows. When it comes to developing Go code for Windows, I still write the actually code on my \*nix machine where I have my development environment. But I do my testing on Windows. So for code that does not require native compilers (your not using `cgo`) you can cross-compile a Windows binary by setting environment variables when building `GOOS=windows GOARCH=amd64 go build` then copy that .exe to Windows. But more frequently I will run a Windows VM and mount my GOPATH inside the VM so that I can simply run `go build` and `go test` from Windows.

---

<div class="post-metadata">

**Author:** ![pierhugues](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pierhugues/32/48383_2.png) [@pierhugues](https://discuss.elastic.co/u/pierhugues)\
**Post date:** [August 7, 2018, 2:19pm UTC](https://discuss.elastic.co/t/how-to-build-beats-in-windows/141711/17 "2018-08-07T14:19:42Z")

</div>

Thanks @andrewkroh, also I want to point out that we provide a [Vagrantfile](https://github.com/elastic/beats/blob/master/Vagrantfile) which I believe could help you getting started on \*nix machine.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 4, 2018, 4:19pm UTC](https://discuss.elastic.co/t/how-to-build-beats-in-windows/141711/18 "2018-09-04T16:19:45Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
