How to compile Istio?

This article will guide you on how to compile Istio binaries on macOS.

Preparation before building

Before officially starting the build, refer to this document
, here is my build environment info:

  • macOS 12.3.1 Darwin AMD64
  • Docker Desktop 4.8.1(78998)
  • Docker Engine v20.10.14

start building

refer to this document
Compile Istio.

First on GitHub
Download the Istio code and download the code to the $GOPATH/src/istio.io/istio directory. The commands below are executed in this root directory.

Execute the following command to download the packages that Istio depends on. These packages will be downloaded to the vendor directory:

 go mod vendor

Then execute the following command to build Istio:

 sudo make build

If you don’t sudo to the command, you may still get the following error:

 fatal: unsafe repository ('/work' is owned by someone else) To add an exception for this directory, call: git config --global --add safe.directory /work fatal: unsafe repository ('/work' is owned by someone else) To add an exception for this directory, call: git config --global --add safe.directory /work Makefile.core.mk:170: *** "TAG cannot be empty". Stop. make: *** [build] Error 2

The built binary file will be saved in the out directory, and its directory structure is as follows:

 out ├── darwin_amd64 │ ├── bug-report │ ├── client │ ├── envoy │ ├── extauthz │ ├── install-cni │ ├── istio-cni │ ├── istio-cni-taint │ ├── istio-iptables │ ├── istio_is_init │ ├── istioctl │ ├── logs │ ├── operator │ ├── pilot-agent │ ├── pilot-discovery │ ├── release │ └── server └── linux_amd64 ├── envoy ├── envoy-centos ├── logs └── release

At the same time, the binaries for the linux_amd64 and darwin_amd64 architectures are built.

Summarize

The above is the process of building Istio on macOS. If you have downloaded the Docker image required for the build, the build time will not exceed a minute.

refer to

This article is reprinted from https://jimmysong.io/blog/how-to-build-istio/
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment