github.com/google/cadvisor@v0.49.1/docs/development/build.md (about) 1 # Building and Testing cAdvisor 2 3 **Note**: cAdvisor only builds on Linux since it uses Linux-only APIs. 4 5 ## Installing Dependencies 6 7 cAdvisor is written in the [Go](http://golang.org) programming language. If you haven't set up a Go development environment, please follow [these instructions](http://golang.org/doc/code.html) to install go tool and set up GOPATH. Note that the version of Go in package repositories of some operating systems is outdated, so please [download](https://golang.org/dl/) the latest version. 8 9 **Note**: cAdvisor requires Go 1.14 to build. 10 11 After setting up Go, you should be able to `go get` cAdvisor as expected (we use `-d` to only download): 12 13 ``` 14 $ go get -d github.com/google/cadvisor 15 ``` 16 17 ## Building from Source 18 19 At this point you can build cAdvisor from the source folder: 20 21 ``` 22 $GOPATH/src/github.com/google/cadvisor $ make build 23 ``` 24 25 or run only unit tests: 26 27 ``` 28 $GOPATH/src/github.com/google/cadvisor $ make test 29 ``` 30 31 For integration tests, see the [integration testing](integration_testing.md) page. 32 33 ### Non-volatile Memory Support 34 35 cAdvisor can be linked against [libipmctl](https://github.com/intel/ipmctl) library that allows to gather information about Intel® Optane⢠DC Persistent memory. If you want to build cAdvisor with libipmctl support you must meet following requirements: 36 * `libipmctl-devel` must be installed on build system. 37 * `libipmctl` must be installed on all systems where cAdvisor is running. 38 39 Detailed information about building `libipmctl` can be found in the project's [README](https://github.com/intel/ipmctl#build). Make sure to use the most up to date released version. Functionality that relies on `libipmctl` was tested against version 02.00.00.3820 of the library. 40 41 To enable `libipmctl` support `GO_FLAGS` variable must be set: 42 43 ``` 44 $GOPATH/src/github.com/google/cadvisor $ GO_FLAGS="-tags=libipmctl,netgo" make build 45 ``` 46 47 ### Perf Support 48 49 cAdvisor can be linked against [libpfm4](http://perfmon2.sourceforge.net/) library that allows to gather information about performance monitoring events. 50 If you want to build cAdvisor with libpfm4 support you must meet following requirements: 51 * `libpfm4-dev` must be installed on build system. 52 * `libpfm4` must be installed on all systems where cAdvisor is running. 53 54 libpfm4 packages are available in Debian- and RHEL-derivatives distributions. 55 56 libpfm4 can be installed using apt package manager: 57 ``` 58 apt-get install libpfm4 libpfm4-dev 59 ``` 60 or yum package manager: 61 ``` 62 yum install libpfm libpfm-devel 63 ``` 64 65 To enable `libpfm4` support `GO_FLAGS` variable must be set: 66 67 ``` 68 $GOPATH/src/github.com/google/cadvisor $ GO_FLAGS="-tags=libpfm,netgo" make build 69 ``` 70 71 ## Running Built Binary 72 73 Now you can run the built binary: 74 75 ``` 76 $GOPATH/src/github.com/google/cadvisor $ sudo ./cadvisor 77 ``` 78 79 ### Perf Support 80 81 It is required to include perf config (examplary config is available [here](../../perf/testing/perf-non-hardware.json)) to run cAdvisor with performance monitoring events: 82 ``` 83 $GOPATH/src/github.com/google/cadvisor $ sudo ./cadvisor -perf_events_config=perf/testing/perf-non-hardware.json 84 85 ```