Skip to content

Commit b3aa770

Browse files
authored
Merge pull request #6738 from ipfs/doc/xc-cgo
doc(README): document requirements for cross-compiling with OpenSSL support
2 parents 3a793a4 + 55ea6ad commit b3aa770

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

+17
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,23 @@ Alternatively, you can run `make build` to build the go-ipfs binary (storing it
183183

184184
**NOTE:** If you get an error along the lines of "fatal error: stdlib.h: No such file or directory", you're missing a C compiler. Either re-run `make` with `CGO_ENABLED=0` or install GCC.
185185

186+
##### Cross Compiling
187+
188+
Compiling for a different platform is as simple as running:
189+
190+
```
191+
make build GOOS=myTargetOS GOARCH=myTargetArchitecture
192+
```
193+
194+
##### OpenSSL
195+
196+
To build go-ipfs with OpenSSL support, append `GOFLAGS=-tags=openssl` to your `make` invocation. Building with OpenSSL should significantly reduce the background CPU usage on nodes that frequently make or receive new connections.
197+
198+
Note: OpenSSL requires CGO support and, by default, CGO is disabled when cross compiling. To cross compile with OpenSSL support, you must:
199+
200+
1. Install a compiler toolchain for the target platform.
201+
2. Set the `CGO_ENABLED=1` environment variable.
202+
186203
#### Troubleshooting
187204

188205
- Separate [instructions are available for building on Windows](docs/windows.md).

0 commit comments

Comments
 (0)