Can't compile for android #1

Open
opened 2021-09-23 17:51:24 -04:00 by dolanor · 7 comments
First-time contributor

I'm trying to compile this program for android (I have an idea of an app requiring android + BLE and I wanted to make it in Gio, and this seemed the best example)

I get:

go run gioui.org/cmd/gogio -target android .
go: downloading gioui.org/cmd v0.0.0-20200829162755-829ee4559c5a
gogio: go build -ldflags=-w -s -X gioui.org/app/internal/log.appID=git.wow.st.hrm -buildmode=c-shared -tags  -o /tmp/gogio-807187917/jni/armeabi-v7a/libgio.so . failed: # git.wow.st/gmp/ble
In file included from _cgo_export.c:4:
cgo-gcc-export-header-prolog:49:101: error: cannot combine with previous 'type-name' declaration specifier
cgo-gcc-export-header-prolog:50:72: error: cannot combine with previous 'type-name' declaration specifier
_cgo_export.c:148:94: error: cannot combine with previous 'type-name' declaration specifier
_cgo_export.c:148:98: error: parameter name omitted
_cgo_export.c:164:14: error: expected expression
_cgo_export.c:173:65: error: cannot combine with previous 'type-name' declaration specifier
_cgo_export.c:173:69: error: parameter name omitted
_cgo_export.c:187:14: error: expected expression

exit status 1

Do you have any idea what's happening?

I'm trying to compile this program for android (I have an idea of an app requiring android + BLE and I wanted to make it in Gio, and this seemed the best example) I get: ``` go run gioui.org/cmd/gogio -target android . go: downloading gioui.org/cmd v0.0.0-20200829162755-829ee4559c5a gogio: go build -ldflags=-w -s -X gioui.org/app/internal/log.appID=git.wow.st.hrm -buildmode=c-shared -tags -o /tmp/gogio-807187917/jni/armeabi-v7a/libgio.so . failed: # git.wow.st/gmp/ble In file included from _cgo_export.c:4: cgo-gcc-export-header-prolog:49:101: error: cannot combine with previous 'type-name' declaration specifier cgo-gcc-export-header-prolog:50:72: error: cannot combine with previous 'type-name' declaration specifier _cgo_export.c:148:94: error: cannot combine with previous 'type-name' declaration specifier _cgo_export.c:148:98: error: parameter name omitted _cgo_export.c:164:14: error: expected expression _cgo_export.c:173:65: error: cannot combine with previous 'type-name' declaration specifier _cgo_export.c:173:69: error: parameter name omitted _cgo_export.c:187:14: error: expected expression exit status 1 ``` Do you have any idea what's happening?
Owner

Let me take a look and see where this is going wrong. Can you let me know what OS and version you are working on?

Let me take a look and see where this is going wrong. Can you let me know what OS and version you are working on?
Author
First-time contributor

I'm on Ubuntu 20.04.
a fresh clone from this repo.
I must be on Go 1.16.
The latest android SDK/ndk installed.

I'm on Ubuntu 20.04. a fresh clone from this repo. I must be on Go 1.16. The latest android SDK/ndk installed.
Owner

Hi, this error should be fixed, there was a name conflict where an exported Go variable name conflicted with a C type. Not sure why this worked before but this probably was never supported and stopped working in the newer versions of Go.

Hi, this error should be fixed, there was a name conflict where an exported Go variable name conflicted with a C type. Not sure why this worked before but this probably was never supported and stopped working in the newer versions of Go.
Author
First-time contributor

Hi,

I tried a go build, and I got:

$ go build
# git.wow.st/gmp/ble
../../../../../pkg/mod/git.wow.st/gmp/ble@v0.0.0-20211115204235-6da0474e59d6/ble.go:13:14: undefined: bleState
../../../../../pkg/mod/git.wow.st/gmp/ble@v0.0.0-20211115204235-6da0474e59d6/ble.go:16:9: undefined: bleHandle
../../../../../pkg/mod/git.wow.st/gmp/ble@v0.0.0-20211115204235-6da0474e59d6/ble.go:25:7: undefined: Peripheral
../../../../../pkg/mod/git.wow.st/gmp/ble@v0.0.0-20211115204235-6da0474e59d6/ble.go:35:8: undefined: Peripheral
../../../../../pkg/mod/git.wow.st/gmp/ble@v0.0.0-20211115204235-6da0474e59d6/ble.go:45:37: undefined: Peripheral
../../../../../pkg/mod/git.wow.st/gmp/ble@v0.0.0-20211115204235-6da0474e59d6/ble.go:57:30: undefined: Peripheral
../../../../../pkg/mod/git.wow.st/gmp/ble@v0.0.0-20211115204235-6da0474e59d6/ble.go:102:13: undefined: Peripheral
../../../../../pkg/mod/git.wow.st/gmp/ble@v0.0.0-20211115204235-6da0474e59d6/ble.go:108:13: undefined: Peripheral
../../../../../pkg/mod/git.wow.st/gmp/ble@v0.0.0-20211115204235-6da0474e59d6/ble.go:110:10: undefined: Service
../../../../../pkg/mod/git.wow.st/gmp/ble@v0.0.0-20211115204235-6da0474e59d6/ble.go:116:13: undefined: Peripheral
../../../../../pkg/mod/git.wow.st/gmp/ble@v0.0.0-20211115204235-6da0474e59d6/ble.go:116:13: too many errors

even with the latest ble it seems to fail on my machine.

Hi, I tried a `go build`, and I got: ``` $ go build # git.wow.st/gmp/ble ../../../../../pkg/mod/git.wow.st/gmp/ble@v0.0.0-20211115204235-6da0474e59d6/ble.go:13:14: undefined: bleState ../../../../../pkg/mod/git.wow.st/gmp/ble@v0.0.0-20211115204235-6da0474e59d6/ble.go:16:9: undefined: bleHandle ../../../../../pkg/mod/git.wow.st/gmp/ble@v0.0.0-20211115204235-6da0474e59d6/ble.go:25:7: undefined: Peripheral ../../../../../pkg/mod/git.wow.st/gmp/ble@v0.0.0-20211115204235-6da0474e59d6/ble.go:35:8: undefined: Peripheral ../../../../../pkg/mod/git.wow.st/gmp/ble@v0.0.0-20211115204235-6da0474e59d6/ble.go:45:37: undefined: Peripheral ../../../../../pkg/mod/git.wow.st/gmp/ble@v0.0.0-20211115204235-6da0474e59d6/ble.go:57:30: undefined: Peripheral ../../../../../pkg/mod/git.wow.st/gmp/ble@v0.0.0-20211115204235-6da0474e59d6/ble.go:102:13: undefined: Peripheral ../../../../../pkg/mod/git.wow.st/gmp/ble@v0.0.0-20211115204235-6da0474e59d6/ble.go:108:13: undefined: Peripheral ../../../../../pkg/mod/git.wow.st/gmp/ble@v0.0.0-20211115204235-6da0474e59d6/ble.go:110:10: undefined: Service ../../../../../pkg/mod/git.wow.st/gmp/ble@v0.0.0-20211115204235-6da0474e59d6/ble.go:116:13: undefined: Peripheral ../../../../../pkg/mod/git.wow.st/gmp/ble@v0.0.0-20211115204235-6da0474e59d6/ble.go:116:13: too many errors ``` even with the latest `ble` it seems to fail on my machine.
Owner

When you type "go build" it will try to build on your native environment (Linux). What happens when you compile the hrm app with "gogio -target android"?

When you type "go build" it will try to build on your native environment (Linux). What happens when you compile the hrm app with "gogio -target android"?
Author
First-time contributor
$ gogio -target android .
gogio: go list -f {{.Dir}} gioui.org/app/internal/wm failed: no required module provides package gioui.org/app/internal/wm; to add it:
	go get gioui.org/app/internal/wm
``` $ gogio -target android . gogio: go list -f {{.Dir}} gioui.org/app/internal/wm failed: no required module provides package gioui.org/app/internal/wm; to add it: go get gioui.org/app/internal/wm ```
Owner

This seems to be a gioui.org issue, or a go package cache issue related to old packages that were renamed or removed. You might try to delete the go package cache (rm -rf ~/go/pkg/mod/gioui*) and reinstall the gioui command. Alternately you can try "$ go clean -modcache", which will delete your entire go module cache.

Can you confirm you are on go 1.16?

What happens when you do "$ go get $gioui.org/app/internal/wm")?

This seems to be a gioui.org issue, or a go package cache issue related to old packages that were renamed or removed. You might try to delete the go package cache (rm -rf ~/go/pkg/mod/gioui*) and reinstall the gioui command. Alternately you can try "$ go clean -modcache", which will delete your entire go module cache. Can you confirm you are on go 1.16? What happens when you do "$ go get $gioui.org/app/internal/wm")?
Sign in to join this conversation.
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: gmp/hrm#1
No description provided.