Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for linux armv7 #114

Closed
leejack1000 opened this issue Dec 22, 2022 · 3 comments
Closed

Support for linux armv7 #114

leejack1000 opened this issue Dec 22, 2022 · 3 comments

Comments

@leejack1000
Copy link

I want to build this project to linux armv7 device
cmd: env GOOS=linux GOARCH=arm GOARM=7 go build
got errors:
.../github.com/go-piv/piv-go@v1.10.0/piv/piv.go:103:7: undefined: scContext
.../github.com/go-piv/piv-go@v1.10.0/piv/piv.go:104:7: undefined: scHandle
.../github.com/go-piv/piv-go@v1.10.0/piv/piv.go:105:7: undefined: scTx
.../github.com/go-piv/piv-go@v1.10.0/piv/key.go:521:19: undefined: scTx
.../github.com/go-piv/piv-go@v1.10.0/piv/key.go:614:29: undefined: scTx
.../github.com/go-piv/piv-go@v1.10.0/piv/key.go:668:24: undefined: scTx
.../github.com/go-piv/piv-go@v1.10.0/piv/key.go:773:59: undefined: scTx
.../github.com/go-piv/piv-go@v1.10.0/piv/key.go:929:22: undefined: scTx
.../github.com/go-piv/piv-go@v1.10.0/piv/key.go:1085:22: undefined: scTx
.../github.com/go-piv/piv-go@v1.10.0/piv/key.go:1130:24: undefined: scTx
.../github.com/go-piv/piv-go@v1.10.0/piv/key.go:1130:24: too many errors

@ericchiang
Copy link
Collaborator

You'd have to add a build tag to one of the pcsc_*.go files, and potentially fix some of the cgo declarations https://github.com/go-piv/piv-go/tree/master/piv

I don't have an arm7 device to test, so I haven't added the tags. Feel free to send a PR!

@circa10a
Copy link

circa10a commented May 15, 2023

If anyone else comes across this issue, here is how I was able to build for linux arm in CI on debian 11. First need to install the required packages (this is on an x86 host):

apt-get update && apt-get install -y gcc gcc-aarch64-linux-gnu pkg-config pcscd pcsc-tools libpcsclite-dev
# For linux arm64 builds, we need the arm64 libs for the aarch64 gcc compiler
dpkg --add-architecture arm64 && apt-get update && apt-get install -y --no-install-recommends libpcsclite-dev:arm64

Then my goreleaser file (.goreleaser.yml) which required CGO_ENABLED=1 and CC=aarch64-linux-gnu-gcc at build time.

project_name: project
release:
  disable: true
builds:
  - binary: "{{.ProjectName}}"
    env:
      - CGO_ENABLED=1
    goos:
      - linux
    goarch:
      - amd64
      - arm64
    ldflags:
      - -X main.Version={{.Version}}
    flags:
      - -a
    overrides:
      - goos: linux
        goarch: arm64
        env:
          - CC=aarch64-linux-gnu-gcc
          - CGO_ENABLED=1
archives:
  - name_template: "{{.ProjectName}}_{{.Version}}_{{.Os}}_{{.Arch}}"
    format: tar.gz
snapshot:
  name_template: "{{ .Tag }}-next"

@leejack1000
Copy link
Author

Good, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants