protos\thrift\thrift_idl.go:30: field.Id undefined (type *parser.Field has no field or method Id, but does have ID)
protos\thrift\thrift_idl.go:31: field.Id undefined (type *parser.Field has no field or method Id, but does have ID)
protos\thrift\thrift_idl.go:39: field.Id undefined (type *parser.Field has no field or method Id, but does have ID)
packetbeat is using godep for vendoring. The thrift library on your system is newer then the one used by packetbeat. In order to build packetbeat go to $GOPATH/src/github.com/elastic/packetbeat and type 'make'. This gets you the executable packetbeat in said directory.
I think you are hitting two issues: one is that you don't compile against the deps from Godep, like Steffen is saying, and the other is that you need a C compiler for the Cgo parts.
For the Godep part, if you don't want/can't use the Makefile, you can setup a custom GOPATH, that includes the Godeps/_worspace folder, e.g. GOPATH=c:\go;c:\go\src\github.com\elastic\packetbeat. Then you can use go build normally.
For the C compiler part, I recommend installing mingw, if you have chocolatey, it's as easy as choco.exe install mingw
Also, any reason for compiling it yourself? We do provide windows binaries.
I am really new to Go, and I can't figure out why make does not work:
C:\Go\src\github.com\elastic\packetbeat>make
Must run make.bat from Go src directory.
protos\thrift\thrift_idl.go:30: field.Id undefined (type *parser.Field has no field or method Id, but does have ID)
protos\thrift\thrift_idl.go:31: field.Id undefined (type *parser.Field has no field or method Id, but does have ID)
protos\thrift\thrift_idl.go:39: field.Id undefined (type *parser.Field has no field or method Id, but does have ID)
....\tsg\gopacket\pcap\pcap.go:18:18: fatal error: pcap.h: No such file or directory #include <pcap.h>
^
compilation terminated.
The reason why I want to compile myself is that I will try and add support for at second windows driver "Microsoft Network Monitor 3 Driver" so I don't have to install the Riverbed driver, hope that it makes sense
I just tried to compile packetbeat on my mac and it just works, can I compile the windows binary from my mac? Or how do you manage to compile the windows binaries?
@bering Yes, you can create the windows binary on your Mac. Use make crosscompile for this. It will run the scripts/crosscompile.sh script and built it for all available platforms.
I have just tried to build packetbeat again from my mac, I cloned the new beats with git clone https://github.com/elastic/beats
From src/github.com/elastic/beats/packetbeat I can run make without any errors but running make crosscompile for darwin and windows gives me this error:
We do not use make crosscompile to build Packetbeat because Packetbeat uses cgo, a golang command that enables go code to depend on C code. Because of this dependency you must have a C compiler for Windows, the required header files, and libraries in order to build.
Like @ruflin said, we use beats-packer to build for Windows. The beats-packer project has a docker container with a C cross-compiler and the required pcap libraries for Windows. Here's the command that does the build in the container. To use beats-packer you would just need to have docker setup and then run make xgo-image && make packetbeat.
To build Packetbeat on Windows you would need to have golang setup, install mingw, install winpcap developer pack to C:/WpdPack/Lib. Our Vagrant box in elastic/beats has all of this setup except for the winpcap developer pack (been meaning to fix this).
I downloaded the win2012 vigrant box and was able to build packetbeat on it by adding WpdPack 4.1.2 to c:\wpdpack\lib
I compared the setup from the vigrant box to my windows 10 setup and noticed that there was an additional environment variable set: GO15VENDOREXPERIMENT=1
With this variable set I am able to build packetbeat on my windows 10 this enables go to use the go files from the vendor directory.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.