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

ios? #2

Open
joeblew99 opened this issue Jun 27, 2017 · 13 comments
Open

ios? #2

joeblew99 opened this issue Jun 27, 2017 · 13 comments

Comments

@joeblew99
Copy link

have you managed to do an IOS build ?

gomobile build -target=ios github.com/udhos/fugo/demo/invader
gomobile: xcrun xcodebuild -configuration Release -project /var/folders/wp/ff6sz9qs6g71jnm12nj2kbyw0000gp/T/gomobile-work-992948897/main.xcodeproj failed: exit status 65
=== BUILD TARGET main OF PROJECT main WITH CONFIGURATION Release ===

Check dependencies
Signing for "main" requires a development team. Select a development team in the project editor.
Code signing is required for product type 'Application' in SDK 'iOS 10.3'

** BUILD FAILED **


The following build commands failed:
	Check dependencies
(1 failure)


@udhos
Copy link
Owner

udhos commented Jun 27, 2017

No, but I have found this. Do you have OS X host?

Building and deploying to iOS

Run gomobile build to build the package as an iOS application.

Note: target=ios requires the host machine running OS X. You need to obtain a signing identity and download provisioning profiles in order to continue.

https://github.com/golang/go/wiki/Mobile

@joeblew99
Copy link
Author

joeblew99 commented Jun 27, 2017

hey - yep i am on osx.
Its not as easy as the message on the gomobile wiki says. Heaps of others have hit this problem.
I am stuck on it at the moment. Others have had to edit the actual golang teams code and replace the BUNDLE_ID.

Your on linux or windows ?

Can you try this Makefile ?
Drop it in the demo/invader folder.
then "make windows", or "make linux"


BINARY = invader
VET_REPORT = vet.report
TEST_REPORT = tests.xml
GOARCH = amd64

VERSION=$(shell git describe --always --tags --abbrev=0)
COMMIT=$(shell git rev-parse HEAD)
BRANCH=$(shell git rev-parse --abbrev-ref HEAD)

# Symlink into GOPATH
GITHUB_USERNAME=gedw99
GO_PATH=github.com/udhos/fugo/demo/${BINARY}
BUILD_DIR=${GOPATH}/src/${GO_PATH}
CURRENT_DIR=$(shell pwd)
BUILD_DIR_LINK=$(shell readlink ${BUILD_DIR})

# Setup the -ldflags option for go build here, interpolate the variable values
LDFLAGS = -ldflags "-X ${GO_PATH}/cmd.VERSION=${VERSION} -X ${GO_PATH}/cmd.COMMIT=${COMMIT} -X ${GO_PATH}/cmd.BRANCH=${BRANCH}"



install:

	## Source: https://github.com/udhos/fugo/demo/invader

	dep init
	

#all: link clean test vet linux darwin windows

link:
	BUILD_DIR=${BUILD_DIR}; \
	BUILD_DIR_LINK=${BUILD_DIR_LINK}; \
	CURRENT_DIR=${CURRENT_DIR}; \
	if [ "$${BUILD_DIR_LINK}" != "$${CURRENT_DIR}" ]; then \
	    echo "Fixing symlinks for build"; \
	    rm -f $${BUILD_DIR}; \
	    ln -s $${CURRENT_DIR} $${BUILD_DIR}; \
	fi

linux: 

	# Fails due to dependency on golang.org/x/mobile/app/app.go:13:2: no buildable Go source files in /Users/apple/workspace/go/src/golang.org/x/mobile/internal/mobileinit
	cd ${BUILD_DIR}; \
	GOOS=linux GOARCH=${GOARCH} go build ${LDFLAGS} -o ${BINARY}-linux-${GOARCH} . ; \
	cd - >/dev/null

darwin:

	# Works
	cd ${BUILD_DIR}; \
	GOOS=darwin GOARCH=${GOARCH} go build ${LDFLAGS} -o ${BINARY}-darwin-${GOARCH} . ; \
	cd - >/dev/null

darwin-run:

	# Works
	./${BINARY}-darwin-${GOARCH}

windows:

	# Fails due to dependency on golang.org/x/mobile/app/app.go:13:2: no buildable Go source files in /Users/apple/workspace/go/src/golang.org/x/mobile/internal/mobileinit
	cd ${BUILD_DIR}; \
	GOOS=windows GOARCH=${GOARCH} go build ${LDFLAGS} -o ${BINARY}-windows-${GOARCH}.exe . ; \
	cd - >/dev/null

android:

	# Works
	cd ${BUILD_DIR}; \
	gomobile build -target=android . ; \
	cd - >/dev/null

android-run:

	# Works
	cd ${BUILD_DIR}; \
	gomobile install .
	cd - >/dev/null


ios:

	# Fails due to gomobile code signing error
	cd ${BUILD_DIR}; \
	gomobile build -target=ios . ; \

test:
	if ! hash go2xunit 2>/dev/null; then go install github.com/tebeka/go2xunit; fi
	cd ${BUILD_DIR}; \
	godep go test -v ./... 2>&1 | go2xunit -output ${TEST_REPORT} ; \
	cd - >/dev/null

vet:
	-cd ${BUILD_DIR}; \
	godep go vet ./... > ${VET_REPORT} 2>&1 ; \
	cd - >/dev/null

fmt:
	cd ${BUILD_DIR}; \
	go fmt $$(go list ./... | grep -v /vendor/) ; \
	cd - >/dev/null

clean:
	-rm -f ${TEST_REPORT}
	-rm -f ${VET_REPORT}
	-rm -f ${BINARY}-*
	-rm -f *.png

.PHONY: install link linux darwin windows test vet fmt clean

@joeblew99
Copy link
Author

In general i have noticed others bypass the gomobile building command and do what it does under the hood.

try

gomobile -x build .

you will see everything its doing under the hood.
I am still learning.

@udhos
Copy link
Owner

udhos commented Jun 28, 2017

I am on Linux. The Makefile issues this:

udhos@RickDeckard:~/go/src/github.com/udhos/fugo/demo/invader$ make linux
# Fails due to dependency on golang.org/x/mobile/app/app.go:13:2: no buildable Go source files in /Users/apple/workspace/go/src/golang.org/x/mobile/internal/mobileinit
cd /src/github.com/udhos/fugo/demo/invader; \
GOOS=linux GOARCH=amd64 go build -ldflags "-X github.com/udhos/fugo/demo/invader/cmd.VERSION=c0c297ad072b3d305f72c730b5c13aedd710e663 -X github.com/udhos/fugo/demo/invader/cmd.COMMIT=c0c297ad072b3d305f72c730b5c13aedd710e663 -X github.com/udhos/fugo/demo/invader/cmd.BRANCH=master" -o invader-linux-amd64 . ; \
cd - >/dev/null
/bin/sh: 1: cd: can't cd to /src/github.com/udhos/fugo/demo/invader
udhos@RickDeckard:~/go/src/github.com/udhos/fugo/demo/invader$ 

@udhos
Copy link
Owner

udhos commented Jun 28, 2017

I guess you meant 'gomobile build -x .'

gomobile -x build . ;# fail

gomobile build -x . ;# ok

Nice!

@udhos
Copy link
Owner

udhos commented Aug 10, 2017

Are you still looking at this issue?

@joeblew99
Copy link
Author

joeblew99 commented Aug 10, 2017

@udhos thanks :) sloppy typing.

The reason i brought up this issue was to do with how to sign the app for a Google or Apple store.
As far as i know you cant sign anything that is gomobile build.
You can sign a gomobile bind, because you actually signing it up at the android or xcode level if you know what i mean.
From the build.sh does not have any signing capacity from what i see.

So thats why i started to dig into the "gomobile build -x" to see whats happening under the hood.

Any ideas here ?

@udhos
Copy link
Owner

udhos commented Aug 10, 2017

@joeblew99 This doc gives hints on signing Google Play app with gomobile: https://pt.slideshare.net/takuyaueda967/go-for-mobile-games

@joeblew99
Copy link
Author

@udhos
The slide is really well done. thanks !!!
Seems that slide 58 is the way to go ?
https://docs.google.com/presentation/d/1PvlfcO5OU0Zlv3eISdIgUsRLpXsVaMvxX0C0c7iCvHg/edit#slide=id.g1530211a36_0_245

What about IOS though ?

@joeblew99
Copy link
Author

Btw have you seen ebiten ?
https://github.com/hajimehoshi/ebiten
Its pretty well advanced golang 2d game system.

@udhos
Copy link
Owner

udhos commented Aug 13, 2017

ebiten looks promising!! Thanks for the tip!

@udhos
Copy link
Owner

udhos commented Aug 14, 2017

@joeblew99 Btw, are you aware of a any gomobile specific community to share experiences? I am fighting some issues I would like help with. For instance, I am unable to hide the Android status bar from a pure Go native app.

@joeblew99
Copy link
Author

@odhos

its mostly a few devs doing gomobile.
xlabs
dskinner
ebiten

As far as turning off the status bar. Never done it myself.
Since its window related i reckon that you going to have to made JNI call to the java sdk level.
Your using gomobile build, rather than gomobile bind ?

There is another way to do IOs and Android development with go, and not be restricted by the gomobile tool chain.
https://github.com/xlab/android-go
Its a direct c <--> golang setup without all the heavy CGO that gomobile uses.
There is good JNI support. See https://github.com/xlab/android-go/blob/master/android/jni_util.go

Not sure if any of this really helps.... But its some of the things i have used.
At the moment i use gomobile because i mostly write GUI in Web or native, rather than opengl.
I have been using pure opengl one too but thats not what i am employed to work on right now

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

2 participants