Cannot compile for Linux
It works well for windows and mac. But when I try to compile for Linux using this command: GOOS=linux GOARCH=arm64 go build -o ../bin/card-reader-driver-amd64-linux
I get:
github.com/ebfe/scard
../../../../go/pkg/mod/github.com/ebfe/[email protected]/scard.go:35:12: undefined: scardEstablishContext ../../../../go/pkg/mod/github.com/ebfe/[email protected]/scard.go:45:7: undefined: scardIsValidContext ../../../../go/pkg/mod/github.com/ebfe/[email protected]/scard.go:58:7: undefined: scardCancel ../../../../go/pkg/mod/github.com/ebfe/[email protected]/scard.go:67:7: undefined: scardReleaseContext ../../../../go/pkg/mod/github.com/ebfe/[email protected]/scard.go:76:15: undefined: scardListReaders ../../../../go/pkg/mod/github.com/ebfe/[email protected]/scard.go:81:14: undefined: strbuf ../../../../go/pkg/mod/github.com/ebfe/[email protected]/scard.go:271:11: undefined: strbuf ../../../../go/pkg/mod/github.com/ebfe/[email protected]/scard.go:275:11: undefined: strbuf ../../../../go/pkg/mod/github.com/ebfe/[email protected]/scard.go:291:37: undefined: strbuf ../../../../go/pkg/mod/github.com/ebfe/[email protected]/scard.go:304:21: undefined: strbuf ../../../../go/pkg/mod/github.com/ebfe/[email protected]/scard.go:81:14: too many errors
Any idea?
I tried to compile it from mac and linux machines.
same here
Unfortunately I have the same problem. I'm using MacOS as my day to day OS.
Native linux and macos build are working here. I suspect the issue is related to cross-compilation, the error suggest something off with the build tags. Independent of that I'm unsure if cross-compilation works with pkg-config (which is used on linux and mac to find the native libpcsc and headers).
same here, can't build on mac
Hi, thats a issue with cross compiling, you can try to link the needed libraries but the easiest option is to run a vm and compile it there. I used docker buildx for that and then in the docker install the needed libraries, this is what i needed to install for my case.
FROM golang:1.23-bullseye AS builder
RUN apt-get update && apt-get install -y
libpcsclite-dev
libpcsclite1
pcscd && apt-get -y upgrade
I hope it helps, sorry for my bad english is not my first language and I prefer not to use AI to write my messages :)