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

Gotify CLI on Termux #26

Open
mskian opened this issue May 20, 2019 · 24 comments

Comments

3 participants
@mskian
Copy link

commented May 20, 2019

I am trying to Run Gotify CLI on Termux Terminal Emulator for Android but Endup with this Below Error while init the CLI

Error: Get https://push.example.com/version: dial tcp: lookup google.com on [::1]:53: read udp [::1]:48773->[::1]:53: read: connection refused

@mskian mskian changed the title Gotlify CLI on Termux Gotify CLI on Termux May 20, 2019

@eternal-flame-AD

This comment has been minimized.

Copy link
Member

commented May 20, 2019

As far as I know, binary built for linux will have name resolving problems on android, and you will need to build the program with GOOS=android and try again

@mskian

This comment has been minimized.

Copy link
Author

commented May 20, 2019

How example pls

@eternal-flame-AD

This comment has been minimized.

Copy link
Member

commented May 20, 2019

Try building with:

CGO_ENABLED=0 GOOS=android GOARCH=amd64 go build
@mskian

This comment has been minimized.

Copy link
Author

commented May 20, 2019

we need to Clone the Github Respo and Build the package for android right?

@mskian

This comment has been minimized.

Copy link
Author

commented May 20, 2019

Got this error

/tmp/go-link-001157295/go.o: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
@eternal-flame-AD

This comment has been minimized.

Copy link
Member

commented May 20, 2019

Sorry I specified the wrong GOARCH, you need GOARCH=arm64

If it still does not work, try building on termux directly without any extra environment variable.

@mskian

This comment has been minimized.

Copy link
Author

commented May 20, 2019

git clone https://github.com/gotify/cli.git
cd cli
$ CGO_ENABLED=0 GOOS=android GOARCH=arm64 go build

go: finding github.com/go-openapi/errors v0.19.0
go: finding github.com/go-openapi/analysis v0.19.0
go: finding github.com/go-openapi/jsonreference v0.19.0
go: finding github.com/go-openapi/validate v0.19.0
go: finding github.com/go-openapi/strfmt v0.19.0
go: finding github.com/go-openapi/spec v0.19.0
go: finding github.com/go-openapi/runtime v0.19.0
go: finding github.com/go-openapi/jsonpointer v0.19.0
go: finding github.com/go-openapi/loads v0.19.0
go: finding golang.org/x/sys v0.0.0-20190412213103-97732733099d
go: finding golang.org/x/net v0.0.0-20181005035420-146acd28ed58
go: finding github.com/stretchr/testify v1.2.2
go: finding github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb
go: finding github.com/pmezard/go-difflib v1.0.0
go: finding github.com/davecgh/go-spew v1.1.1
go: finding golang.org/x/net v0.0.0-20190320064053-1272bf9dcd53
go: finding golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a
go: finding github.com/PuerkitoBio/purell v1.1.0
go: finding github.com/go-openapi/jsonreference v0.18.0
go: finding github.com/stretchr/testify v1.3.0
go: finding golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576
go: finding github.com/PuerkitoBio/purell v1.1.1
go: finding github.com/go-openapi/validate v0.18.0
go: finding golang.org/x/text v0.3.0
go: finding github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8
go: finding github.com/go-openapi/spec v0.18.0
go: finding github.com/go-openapi/errors v0.17.0
go: finding github.com/mailru/easyjson v0.0.0-20190403194419-1ea4449da983
go: finding github.com/go-openapi/spec v0.17.0
go: finding github.com/tj/go-spin v1.1.0
go: finding github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf
go: finding github.com/go-openapi/analysis v0.17.0
go: finding gopkg.in/yaml.v2 v2.2.2
go: finding github.com/go-openapi/loads v0.17.0
go: finding github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578
go: finding github.com/mitchellh/mapstructure v1.1.2
go: finding github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329
go: finding github.com/kr/pretty v0.1.0
go: finding github.com/go-openapi/strfmt v0.18.0
go: finding github.com/gotify/go-api-client/v2 v2.0.4
go: finding golang.org/x/sys v0.0.0-20190321052220-f7bb7a8bee54
go: finding github.com/go-openapi/swag v0.18.0
go: finding gopkg.in/yaml.v2 v2.2.1
go: finding github.com/go-openapi/errors v0.18.0
go: finding gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127
go: finding golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e
go: finding gopkg.in/urfave/cli.v1 v1.20.0
go: finding github.com/go-openapi/jsonpointer v0.18.0
go: finding github.com/davecgh/go-spew v1.1.0
go: finding github.com/go-openapi/analysis v0.18.0
go: finding github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277
go: finding github.com/stretchr/objx v0.1.0
go: finding golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
go: finding github.com/go-openapi/jsonpointer v0.17.0
go: finding github.com/pborman/uuid v1.2.0
go: finding golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2
go: finding github.com/go-openapi/swag v0.19.0
go: finding github.com/go-openapi/errors v0.17.2
go: finding github.com/docker/go-units v0.3.3
go: finding github.com/go-openapi/loads v0.18.0
go: finding github.com/google/uuid v1.1.1
go: finding github.com/stretchr/objx v0.1.1
go: finding github.com/go-openapi/jsonreference v0.17.0
go: finding github.com/kr/text v0.1.0
go: finding github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe
go: finding github.com/go-openapi/swag v0.17.0
go: finding golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3
go: finding github.com/go-openapi/strfmt v0.17.0
go: finding gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
go: finding github.com/go-openapi/runtime v0.0.0-20180920151709-4f900dc2ade9
go: finding github.com/google/uuid v1.0.0
go: finding github.com/go-openapi/runtime v0.17.2
go: finding github.com/kr/pty v1.1.1
go: finding github.com/go-openapi/validate v0.17.0
go: downloading gopkg.in/urfave/cli.v1 v1.20.0
go: downloading github.com/gotify/go-api-client/v2 v2.0.4
go: extracting gopkg.in/urfave/cli.v1 v1.20.0
go: extracting github.com/gotify/go-api-client/v2 v2.0.4
go: downloading github.com/tj/go-spin v1.1.0
go: downloading github.com/go-openapi/strfmt v0.19.0
go: downloading github.com/go-openapi/swag v0.19.0
go: downloading github.com/go-openapi/runtime v0.19.0
go: downloading golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a
go: extracting github.com/tj/go-spin v1.1.0
go: extracting github.com/go-openapi/strfmt v0.19.0
go: downloading github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf
go: extracting github.com/go-openapi/swag v0.19.0
go: extracting github.com/go-openapi/runtime v0.19.0
go: downloading github.com/go-openapi/errors v0.19.0
go: downloading github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8
go: downloading gopkg.in/yaml.v2 v2.2.2
go: extracting github.com/go-openapi/errors v0.19.0
go: extracting github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf
go: downloading github.com/mailru/easyjson v0.0.0-20190403194419-1ea4449da983
go: extracting golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a
go: extracting gopkg.in/yaml.v2 v2.2.2
go: extracting github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8
go: downloading github.com/mitchellh/mapstructure v1.1.2
go: extracting github.com/mailru/easyjson v0.0.0-20190403194419-1ea4449da983
go: extracting github.com/mitchellh/mapstructure v1.1.2
go: downloading golang.org/x/sys v0.0.0-20190412213103-97732733099d
go: downloading github.com/go-openapi/loads v0.19.0
go: downloading github.com/go-openapi/analysis v0.19.0
go: downloading github.com/go-openapi/validate v0.19.0
go: downloading github.com/go-openapi/spec v0.19.0
go: extracting github.com/go-openapi/analysis v0.19.0
go: extracting github.com/go-openapi/loads v0.19.0
go: downloading github.com/go-openapi/jsonpointer v0.19.0
go: extracting github.com/go-openapi/jsonpointer v0.19.0
go: extracting github.com/go-openapi/spec v0.19.0
go: downloading github.com/go-openapi/jsonreference v0.19.0
go: extracting github.com/go-openapi/jsonreference v0.19.0
go: downloading github.com/PuerkitoBio/purell v1.1.1
go: extracting golang.org/x/sys v0.0.0-20190412213103-97732733099d
go: extracting github.com/go-openapi/validate v0.19.0
go: extracting github.com/PuerkitoBio/purell v1.1.1
go: downloading golang.org/x/text v0.3.0
go: downloading golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3
go: downloading github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578
go: extracting github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578
go: extracting golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3
go: extracting golang.org/x/text v0.3.0
# github.com/gotify/cli/v2
/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: /tmp/go-link-961218562/go.o: Relocations in generic ELF (EM: 183)
/usr/bin/ld: /tmp/go-link-961218562/go.o: Relocations in generic ELF (EM: 183)
/usr/bin/ld: /tmp/go-link-961218562/go.o: Relocations in generic ELF (EM: 183)
/usr/bin/ld: /tmp/go-link-961218562/go.o: Relocations in generic ELF (EM: 183)
/usr/bin/ld: /tmp/go-link-961218562/go.o: Relocations in generic ELF (EM: 183)
/usr/bin/ld: /tmp/go-link-961218562/go.o: Relocations in generic ELF (EM: 183)
/usr/bin/ld: /tmp/go-link-961218562/go.o: Relocations in generic ELF (EM: 183)
/usr/bin/ld: /tmp/go-link-961218562/go.o: Relocations in generic ELF (EM: 183)
/usr/bin/ld: /tmp/go-link-961218562/go.o: Relocations in generic ELF (EM: 183)
/usr/bin/ld: /tmp/go-link-961218562/go.o: Relocations in generic ELF (EM: 183)
/usr/bin/ld: /tmp/go-link-961218562/go.o: Relocations in generic ELF (EM: 183)
/usr/bin/ld: /tmp/go-link-961218562/go.o: Relocations in generic ELF (EM: 183)
/usr/bin/ld: /tmp/go-link-961218562/go.o: Relocations in generic ELF (EM: 183)
/usr/bin/ld: /tmp/go-link-961218562/go.o: Relocations in generic ELF (EM: 183)
/usr/bin/ld: /tmp/go-link-961218562/go.o: Relocations in generic ELF (EM: 183)
/usr/bin/ld: /tmp/go-link-961218562/go.o: Relocations in generic ELF (EM: 183)
/tmp/go-link-961218562/go.o: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status

My System INFO - Ubuntu 18.04 LTS Golang version - go version go1.12.5 linux/amd64

@jmattheis

This comment has been minimized.

Copy link
Member

commented May 20, 2019

Here it is recommended to compile the go program in your termux environment termux/termux-app#210 (comment)

@mskian

This comment has been minimized.

Copy link
Author

commented May 20, 2019

Gotify CLI having any specific file to build the complete package?

@jmattheis

This comment has been minimized.

Copy link
Member

commented May 20, 2019

go build should be enough, there are no extra steps.

@mskian

This comment has been minimized.

Copy link
Author

commented May 20, 2019

Let me try and Update

@jmattheis

This comment has been minimized.

Copy link
Member

commented May 20, 2019

Dns lookup works if the cli is compiled on termux.
image

@mskian

This comment has been minimized.

Copy link
Author

commented May 20, 2019

Got this Error

$ go build

photo_2019-05-20_22-19-14

@mskian

This comment has been minimized.

Copy link
Author

commented May 20, 2019

@jmattheis Share your steps how you achieve in Termux

@jmattheis

This comment has been minimized.

Copy link
Member

commented May 20, 2019

I just did:

pkg install golang git
git clone https://github.com/gotify/cli
cd cli
go build
./cli init
@mskian

This comment has been minimized.

Copy link
Author

commented May 20, 2019

For me, it's not Building I am facing error check above screenshot

@jmattheis

This comment has been minimized.

Copy link
Member

commented May 20, 2019

Could you try a system upgrade (pkg upgrade) and try again. If it still doesn't work, could you paste the outputs of the following commands:

go env
go version
gcc --version

With android version do you have?

@mskian

This comment has been minimized.

Copy link
Author

commented May 20, 2019

photo_2019-05-20_23-24-55

Android Version - 8.1.0

@jmattheis

This comment has been minimized.

Copy link
Member

commented May 20, 2019

I've android 9.

I'm out of ideas now, could be a Go bug.

@mskian

This comment has been minimized.

Copy link
Author

commented May 20, 2019

@jmattheis yes may be
4 hours no proper solution for this issue

@mskian

This comment has been minimized.

Copy link
Author

commented May 21, 2019

This Method works well

pkg install golang
go get github.com/gotify/cli

Binary File Stored in Home /go/bin/cli

cd $HOME
cd go
cd bin
cp cli $HOME
cd $HOME
mv cli gotify
## Setup Gotify
./gotify init
mv gotify $PREFIX/bin
## test Gotify
gotify config

My issue ticket in Termux Respo termux/termux-app#1138

@mskian

This comment has been minimized.

Copy link
Author

commented May 21, 2019

Why these all three are unknown?

$ gotify version
version: unknown
commit: unknown
BuildDate: unknow
@eternal-flame-AD

This comment has been minimized.

Copy link
Member

commented May 21, 2019

These information are replaced on link time with a linker flag. You can refer to Makefile to see how we did that.

@mskian

This comment has been minimized.

Copy link
Author

commented May 21, 2019

Now got it Thanks
Kindly Release binary compiled for Android too (For Termux)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.