ftdi icon indicating copy to clipboard operation
ftdi copied to clipboard

Fix build as static library

Open rasky opened this issue 4 years ago • 1 comments

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 https://github.com/golang/go/issues/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.

rasky avatar Jul 26 '21 15:07 rasky

Can you make a pull request with changes that will add support for static_build tag?

ziutek avatar Jul 30 '21 11:07 ziutek