Fix build as static library
Opened this issue · 1 comments
rasky commented
To build ftdi
as part of a static binary, there is a fix required. The line #cgo pkg-config: libftdi1
in device.go must be changed to #cgo pkg-config: --static libftdi1
. This tells go build
to invoke pkg-config
with the --static
argument to provide the correct library list for the static linking case.
This is a known shortcoming of Go, documented in golang/go#26492. The same issue (in the description) reports an example of a common workaround: using two Go files to switch the different pkg-config
invocation, guarded by the static_build
build tag which seems to be the de-facto standard.
ziutek commented
Can you make a pull request with changes that will add support for static_build tag?