go-sdl2-android-example icon indicating copy to clipboard operation
go-sdl2-android-example copied to clipboard

[Question] Versions used

Open rennomarcus opened this issue 6 years ago • 2 comments

Hi, I'm trying to use the script, but I'm getting a few errors.

I fixed some of them (which I intend to do a PR when everything is working), but I'm hitting one that is beyond my knowledge on android or sdl.

What version of the NDK and SDL2 have you used?

Thanks!

rennomarcus avatar May 24 '18 01:05 rennomarcus

Hi,

I am not sure what versions were actual 2 years ago. Anyway, whole example can now be much simpler, -static tag for go-sdl2 supports Android since recently.

Not sure when will I have time to fix example though, but whole process should look like what I did here with raylib https://github.com/gen2brain/raylib-go/tree/master/examples/others/android/example , and I now know a much simpler way to fiddle with main function that is expected, and much simpler .gradle and ant build files.

gen2brain avatar May 24 '18 22:05 gen2brain

Thanks for the reply and showing this example. Things got indeed simpler, but I still cannot make it work :( I've tried to run the example but I got _cgo_export.c:2:20: fatal error: stdlib.h: No such file or directory

I've also tried to generate a new compiler with NDK-17

./make-standalone-toolchain.sh --platform=android-14 --install-dir=${INSTALL_DIR}/android-toolchain-arm --toolchain=arm-linux-androideabi-4.9 --use-llvm

but I still got an error after trying to compile with different files that were generated

CC=bin/arm-linux-androideabi-clang CXX=bin/arm-linux-androideabi-clang++ GOOS=android GOARCH=arm go build ~/workspace/hello/main.go 
# command-line-arguments
/usr/local/go/pkg/tool/linux_amd64/link: running bin/arm-linux-androideabi-clang failed: exit status 1
/tmp/go-link-701153181/go.o:go.go:_cgo_init: error: undefined reference to 'x_cgo_init'
/tmp/go-link-701153181/go.o:go.go:_cgo_notify_runtime_init_done: error: undefined reference to 'x_cgo_notify_runtime_init_done'
/tmp/go-link-701153181/go.o:go.go:_cgo_thread_start: error: undefined reference to 'x_cgo_thread_start'
/tmp/go-link-701153181/go.o:go.go:runtime._cgo_setenv: error: undefined reference to 'x_cgo_setenv'
/tmp/go-link-701153181/go.o:go.go:runtime._cgo_unsetenv: error: undefined reference to 'x_cgo_unsetenv'
/tmp/go-link-701153181/go.o:go.go:runtime.cgo_yield: error: undefined reference to '_cgo_yield'

That code didn't even have C code... (I also did with CGO_ENABLED=0)

rennomarcus avatar May 25 '18 01:05 rennomarcus