未验证 提交 780bcac9 编写于 作者: A Alessandro Arzilli 提交者: GitHub

Documentation: update install instructions (#2352)

Remove OS specific install instructions that all repeat the same thing.
Since `go get ...` is being deprecated (to install executables)
recommend an install procedure that works on all supported versions of
go (`git clone && go install`) but also mention the new `go install`
mode in 1.16.
上级 540e63a5
# Installation
Directions for installing Delve on all supported platforms is provided here.
Clone the git repository and build:
Please note you *must* have **Go 1.10** or higher installed in order to compile Delve.
```
$ git clone https://github.com/go-delve/delve
$ cd delve
$ go install github.com/go-delve/delve/cmd/dlv
```
- [OSX](osx/install.md)
- [Linux](linux/install.md)
- [Windows](windows/install.md)
- [FreeBSD](freebsd/install.md)
\ No newline at end of file
On Go version 1.16 or later, this command will also work:
```
$ go install github.com/go-delve/delve/cmd/dlv@latest
```
See `go help install` for details on where the `dlv` executable is saved.
If during the install step you receive an error similar to this:
```
found packages native (proc.go) and your_operating_system_and_architecture_combination_is_not_supported_by_delve (support_sentinel.go) in /home/pi/go/src/github.com/go-delve/delve/pkg/proc/native
```
It means that your combination of operating system and CPU architecture is not supported, check the output of `go version`.
## macOS considerations
On macOS make sure you also install the command line developer tools:
```
$ xcode-select --install
```
If you didn't enable Developer Mode using Xcode you will be asked to authorize the debugger every time you use it. To enable Developer Mode and only have to authorize once per session use:
```
sudo /usr/sbin/DevToolsSecurity -enable
```
## Compiling macOS native backend
You do not need the macOS native backend and it [has known problems](https://github.com/go-delve/delve/issues/1112). If you still want to build it:
1. Run `xcode-select --install`
2. On macOS 10.14 manually install the legacy include headers by running `/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg`
3. Clone the repo into `$GOPATH/src/github.com/go-delve/delve`
4. Run `make install` in that directory (on some versions of macOS this requires being root, the first time you run it, to install a new certificate)
The makefile will take care of creating and installing a self-signed certificate automatically.
# Installation on FreeBSD
Please use the following steps to build and install Delve on FreeBSD.
There are two ways to install on FreeBSD. First is the standard `go get` method:
```
go get github.com/go-delve/delve/cmd/dlv
```
Note: if you are using Go in modules mode you must execute this command outside of a module directory or Delve will be added to your project as a dependency.
Alternatively make sure $GOPATH is set (e.g. as `~/.go`) and:
```
$ git clone https://github.com/go-delve/delve.git $GOPATH/src/github.com/go-delve/delve
$ cd $GOPATH/src/github.com/go-delve/delve
$ gmake install
```
See [general install instructions](../README.md).
\ No newline at end of file
# Installation on Linux
Please use the following steps to build and install Delve on Linux.
There are two ways to install on Linux. First is the standard `go get` method:
```
go get github.com/go-delve/delve/cmd/dlv
```
Note: if you are using Go in modules mode you must execute this command outside of a module directory or Delve will be added to your project as a dependency.
Alternatively make sure $GOPATH is set (e.g. as `~/.go`) and:
```
$ git clone https://github.com/go-delve/delve.git $GOPATH/src/github.com/go-delve/delve
$ cd $GOPATH/src/github.com/go-delve/delve
$ make install
```
See [general install instructions](../README.md).
# Installation on macOS
Ensure you have a proper compilation toolchain.
This should be as simple as:
`xcode-select --install`
Now you can install delve using `go get`:
```
$ go get github.com/go-delve/delve/cmd/dlv
```
Note: if you are using Go in modules mode you must execute this command outside of a module directory or Delve will be added to your project as a dependency.
With this method you will not be able to use delve's native backend, *but you don't need it anyway*: the native backend on macOS [has known problems](https://github.com/go-delve/delve/issues/1112) on recent issues of the OS and is not currently maintained.
If you didn't enable Developer Mode using Xcode you will be asked to authorize the debugger every time you use it. To enable Developer Mode and only have to authorize once per session use:
```
sudo /usr/sbin/DevToolsSecurity -enable
```
## Compiling the native backend
Only do this if you have a valid reason to use the native backend.
1. Run `xcode-select --install`
2. On macOS 10.14 manually install the legacy include headers by running `/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg`
3. Clone the repo into `$GOPATH/src/github.com/go-delve/delve`
4. Run `make install` in that directory (on some versions of macOS this requires being root, the first time you run it, to install a new certificate)
The makefile will take care of creating and installing a self-signed certificate automatically.
See [general install instructions](../README.md).
# Installation on Windows
Please use the standard `go get` command to build and install Delve on Windows.
```
go get github.com/go-delve/delve/cmd/dlv
```
Note: if you are using Go in modules mode you must execute this command outside of a module directory or Delve will be added to your project as a dependency.
Also, if not already set, you have to add the %GOPATH%\bin directory to your PATH variable.
See [general install instructions](../README.md).
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册