periph / host

Go·Hardware·Lean - Host drivers
https://periph.io
Apache License 2.0
53 stars 27 forks source link

ftdi depends on cgo #17

Closed schmidtw closed 1 year ago

schmidtw commented 1 year ago

Describe the bug The host package depends on periph/d2xx which depends on cgo. https://github.com/periph/d2xx/blob/86eb5ae2a9f0cabc315eff6641cd8aea22df5b6c/d2xx_linux_amd64.go#L5

This dependency should probably be fixed or removed to maintain the No C dependency, doesn’t use cgo. policy.

To Reproduce

  1. Install go compiler on a fresh RPI install. Do not install c compiler.
  2. git clone https://github.com/periph/cmd.git
  3. cd cmd
  4. go build ./...
  5. See error:
    # periph.io/x/d2xx
    cgo: C compiler "gcc" not found: exec: "gcc": executable file not found in $PATH

Expected behavior Build succeeds.

Platform (please complete the following information):

Additional context The ftdi libraries are neat, but probably shouldn't be in the periph projects unless you segment out "here are projects that are related but use cgo".

maruel commented 1 year ago

d2xx depends on cgo only if cgo is enabled. Set the environment variable CGO_ENABLED=0 to not depend on the cgo enabled code. Is this good enough for you?

schmidtw commented 1 year ago

Yes, I missed that I could do that. Thank you.