cli / gh-extension-precompile

Action for publishing binary GitHub CLI extensions
MIT License
93 stars 41 forks source link

feat: Android support #19

Closed luisdavim closed 2 years ago

luisdavim commented 2 years ago

The gh cli is packaged in the oficial Termux repos so it would make sense to support this platlorm and create binaries for it.

Relates to: https://github.com/dlvhdr/gh-dash/pull/137#issuecomment-1144778803

dlvhdr commented 2 years ago

@mislav @vilmibm

andyfeller commented 1 year ago

@luisdavim @dlvhdr : could you share insight into the move from cli/gh-extension-precompile in https://github.com/dlvhdr/gh-dash/pull/139 and the removing android support from gh-dash release process?

I ask because as a extension author myself I wanted to understand whether this use case, which causes local building issues on Mac, should continue to be supported out of the box or removed.

luisdavim commented 1 year ago

I'm not sure I understand the question. The use case for android is that some people, like myself, use it with termux.

How does it affect the MacOS builds?

andyfeller commented 1 year ago

I'm not sure I understand the question. The use case for android is that some people, like myself, use it with termux.

How does it affect the MacOS builds?

Apologies, let me elaborate.

These changes were merged in and used for a time in https://github.com/dlvhdr/gh-dash/pull/139, however cli/gh-extension-precompile would be replaced by goreleaser/goreleaser-action with no explicit android target in the .goreleaser.yaml:

builds:
  - env:
      - CGO_ENABLED=0
    goos:
      - freebsd
      - linux
      - windows
      - darwin
    goarch:
      - amd64
      - arm64
      - arm
      - "386"
    goarm:
      - 6
      - 7
    ldflags:
      - -s -w
      - -X github.com/dlvhdr/gh-dash/cmd.Version={{.Version}}
      - -X github.com/dlvhdr/gh-dash/cmd.Commit={{.Commit}}
      - -X github.com/dlvhdr/gh-dash/cmd.Date={{.CommitDate}}
      - -X github.com/dlvhdr/gh-dash/cmd.BuiltBy=goreleaser

So my question is trying to understand:

  1. Whether there are use cases for building for android explicitly in cli/gh-extension-precompile?
  2. Is there something that goreleaser does that cli/gh-extension-precompile does not that is worth considering?

I ask because I've been fighting with cross-compile linking issues on MacOS Ventura with android/* on my personal workstation and being unable to figure out how to work around this, making me question whether extension truly need to be built specifically for android or if linux works for Android.

+ GOOS=android
+ GOARCH=amd64
+ CGO_ENABLED=0
+ go build -trimpath '-ldflags=-v -s -w -X .../build.Version=7.7.7 -X .../build.Date=2023-10-13 -X .../build.Sha=3f232f7078d02b078d653066e23b432994788971' -o dist/android-amd64
# github.com/.../...
HEADER = -H5 -T0x401000 -R0x1000
loadinternal: cannot find runtime/cgo
host link: "cc" "-m64" "-s" "-Wl,-z,relro" "-pie" "-o" "/var/folders/xb/svzskj1x77x3qsmwx1d84nqc0000gn/T/go-build3592177814/b001/exe/a.out" "-rdynamic" "-Qunused-arguments" "/var/folders/xb/svzskj1x77x3qsmwx1d84nqc0000gn/T/go-link-1527271618/go.o"
/usr/local/Cellar/go/1.20.7/libexec/pkg/tool/darwin_amd64/link: running cc failed: exit status 1
ld: warning: -s is obsolete
ld: unknown options: -z 
clang: error: linker command failed with exit code 1 (use -v to see invocation)