Skip to content

Commit 4ea4d50

Browse files
committed
Simplify static build.
It's simpler than I initially thought! We just have to use -tags static, there's no need to pass linker flags as we can set LDFLAGS for cgo right from go source file. See golang/go#12058 (comment) for discussion about it. Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent 0abf74a commit 4ea4d50

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

README.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,7 @@ After installing OpenVZ, you might need to run:
3232
## Building
3333

3434
If you are going to build a binary that uses this package statically,
35-
i.e. you have something like `--ldflags '-extldflags "-static"'` or
36-
`--gccgoflags "-static"` in your `go build` command line, make sure
37-
to add `static` build tag, too, otherwise the linker will fail.
38-
Example:
39-
40-
go build --ldflags '-extldflags "-static"' -tags static
35+
you need to add `static` build tag to your `go build` command.
4136

4237
## Usage
4338

ploop_link_static.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
package ploop
44

55
// #cgo pkg-config: --static ploop
6+
// #cgo LDFLAGS: -static
67
import "C"

0 commit comments

Comments
 (0)