veandco / go-sdl2

SDL2 binding for Go
https://godoc.org/github.com/veandco/go-sdl2
BSD 3-Clause "New" or "Revised" License
2.23k stars 225 forks source link

Dep. problem cross-compiling to Android. #252

Open billyninja opened 7 years ago

billyninja commented 7 years ago

Having a hard time cross-compiling a program to android/arm. It complains about missing X11/Xlib.h. While a regular x86_64 build works just fine. Sure it is more related to the SDL2 itself, but either way if you guys could lend me a hand.

The program itself doesn't do anything special, it's a regular ~100 loc go-sdl2 program.

/usr/include/SDL2/SDL_syswm.h:72:10: fatal error: 'X11/Xlib.h' file not found
#include <X11/Xlib.h>
         ^~~~~~~~~~~~

[joao@joao-pc runegrid]$ gomobile init -x -ndk ~/Android/Sdk/ndk-bundle

GOMOBILE=/home/joao/go/pkg/gomobile
rm -r -f "$GOMOBILE"
mkdir -p $GOMOBILE
WORK=/home/joao/go/pkg/gomobile/work-880765961
GOOS=android GOARCH=arm CC=$HOME/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang CXX=$HOME/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ CGO_CFLAGS=-target armv7a-none-linux-androideabi --sysroot $HOME/Android/Sdk/ndk-bundle/platforms/android-15/arch-arm -gcc-toolchain $HOME/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 -I$GOMOBILE/include CGO_CPPFLAGS=-target armv7a-none-linux-androideabi --sysroot $HOME/Android/Sdk/ndk-bundle/platforms/android-15/arch-arm -gcc-toolchain $HOME/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 -I$GOMOBILE/include CGO_LDFLAGS=-target armv7a-none-linux-androideabi --sysroot $HOME/Android/Sdk/ndk-bundle/platforms/android-15/arch-arm -gcc-toolchain $HOME/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 -L$HOME/Android/Sdk/ndk-bundle/platforms/android-15/arch-arm/usr/lib -L$GOMOBILE/lib/arm CGO_ENABLED=1 GOARM=7 go install -gcflags=-shared -ldflags=-shared -pkgdir=$GOMOBILE/pkg_android_arm -x std
GOOS=android GOARCH=arm64 CC=$HOME/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang CXX=$HOME/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ CGO_CFLAGS=-target aarch64-none-linux-android --sysroot $HOME/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain $HOME/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I$GOMOBILE/include CGO_CPPFLAGS=-target aarch64-none-linux-android --sysroot $HOME/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain $HOME/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I$GOMOBILE/include CGO_LDFLAGS=-target aarch64-none-linux-android --sysroot $HOME/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain $HOME/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -L$HOME/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64/usr/lib -L$GOMOBILE/lib/arm64 CGO_ENABLED=1 go install -gcflags=-shared -ldflags=-shared -pkgdir=$GOMOBILE/pkg_android_arm64 -x std
GOOS=android GOARCH=386 CC=$HOME/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang CXX=$HOME/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ CGO_CFLAGS=-target i686-none-linux-android --sysroot $HOME/Android/Sdk/ndk-bundle/platforms/android-15/arch-x86 -gcc-toolchain $HOME/Android/Sdk/ndk-bundle/toolchains/x86-4.9/prebuilt/linux-x86_64 -I$GOMOBILE/include CGO_CPPFLAGS=-target i686-none-linux-android --sysroot $HOME/Android/Sdk/ndk-bundle/platforms/android-15/arch-x86 -gcc-toolchain $HOME/Android/Sdk/ndk-bundle/toolchains/x86-4.9/prebuilt/linux-x86_64 -I$GOMOBILE/include CGO_LDFLAGS=-target i686-none-linux-android --sysroot $HOME/Android/Sdk/ndk-bundle/platforms/android-15/arch-x86 -gcc-toolchain $HOME/Android/Sdk/ndk-bundle/toolchains/x86-4.9/prebuilt/linux-x86_64 -L$HOME/Android/Sdk/ndk-bundle/platforms/android-15/arch-x86/usr/lib -L$GOMOBILE/lib/386 CGO_ENABLED=1 go install -gcflags=-shared -ldflags=-shared -pkgdir=$GOMOBILE/pkg_android_386 -x std
GOOS=android GOARCH=amd64 CC=$HOME/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang CXX=$HOME/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ CGO_CFLAGS=-target x86_64-none-linux-android --sysroot $HOME/Android/Sdk/ndk-bundle/platforms/android-21/arch-x86_64 -gcc-toolchain $HOME/Android/Sdk/ndk-bundle/toolchains/x86_64-4.9/prebuilt/linux-x86_64 -I$GOMOBILE/include CGO_CPPFLAGS=-target x86_64-none-linux-android --sysroot $HOME/Android/Sdk/ndk-bundle/platforms/android-21/arch-x86_64 -gcc-toolchain $HOME/Android/Sdk/ndk-bundle/toolchains/x86_64-4.9/prebuilt/linux-x86_64 -I$GOMOBILE/include CGO_LDFLAGS=-target x86_64-none-linux-android --sysroot $HOME/Android/Sdk/ndk-bundle/platforms/android-21/arch-x86_64 -gcc-toolchain $HOME/Android/Sdk/ndk-bundle/toolchains/x86_64-4.9/prebuilt/linux-x86_64 -L$HOME/Android/Sdk/ndk-bundle/platforms/android-21/arch-x86_64/usr/lib -L$GOMOBILE/lib/amd64 CGO_ENABLED=1 go install -gcflags=-shared -ldflags=-shared -pkgdir=$GOMOBILE/pkg_android_amd64 -x std
go version > $GOMOBILE/version
rm -r -f "$WORK"

gomobile build -x -target android/arm64

[joao@joao-pc runegrid]$ gomobile build -x -target android/arm64
GOMOBILE=/home/joao/go/pkg/gomobile
WORK=/tmp/gomobile-work-488840518
mkdir -p $WORK/lib/arm64-v8a
GOOS=android GOARCH=arm64 CC=$HOME/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang CXX=$HOME/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ CGO_CFLAGS=-target aarch64-none-linux-android --sysroot $HOME/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain $HOME/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I$GOMOBILE/include CGO_CPPFLAGS=-target aarch64-none-linux-android --sysroot $HOME/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain $HOME/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I$GOMOBILE/include CGO_LDFLAGS=-target aarch64-none-linux-android --sysroot $HOME/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain $HOME/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -L$HOME/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64/usr/lib -L$GOMOBILE/lib/arm64 CGO_ENABLED=1 go build -pkgdir=$GOMOBILE/pkg_android_arm64 -x -buildmode=c-shared -o $WORK/lib/arm64-v8a/librunegrid.so github.com/billyninja/runegrid
rm -r -f "$WORK"
gomobile: go build -pkgdir=/home/joao/go/pkg/gomobile/pkg_android_arm64 -x -buildmode=c-shared -o /tmp/gomobile-work-488840518/lib/arm64-v8a/librunegrid.so github.com/billyninja/runegrid failed: exit status 2
WORK=/tmp/go-build736509427
mkdir -p $WORK/github.com/veandco/go-sdl2/sdl/_obj/
mkdir -p $WORK/github.com/veandco/go-sdl2/
cd /home/joao/go/src/github.com/veandco/go-sdl2/sdl
pkg-config --cflags sdl2
mkdir -p $WORK/golang.org/x/mobile/event/key/_obj/
mkdir -p $WORK/golang.org/x/mobile/event/
mkdir -p $WORK/golang.org/x/mobile/app/internal/callfn/_obj/
mkdir -p $WORK/golang.org/x/mobile/app/internal/
cd /home/joao/go/src/golang.org/x/mobile/app/internal/callfn
/usr/lib/go/pkg/tool/linux_amd64/compile -o $WORK/golang.org/x/mobile/app/internal/callfn.a -trimpath $WORK -shared -goversion go1.9 -p golang.org/x/mobile/app/internal/callfn -installsuffix shared -buildid ddcb52447c56a7800ce45ac4a8dbe7be65d8ab0d -D _/home/joao/go/src/golang.org/x/mobile/app/internal/callfn -I $WORK -I /home/joao/go/pkg/gomobile/pkg_android_arm64 -pack -asmhdr $WORK/golang.org/x/mobile/app/internal/callfn/_obj/go_asm.h ./callfn.go
mkdir -p $WORK/golang.org/x/mobile/event/lifecycle/_obj/
cd /home/joao/go/src/golang.org/x/mobile/event/key
/usr/lib/go/pkg/tool/linux_amd64/compile -o $WORK/golang.org/x/mobile/event/key.a -trimpath $WORK -shared -goversion go1.9 -p golang.org/x/mobile/event/key -complete -installsuffix shared -buildid 01f33ca21a63397e2adee361e0e01bd9756bfc40 -D _/home/joao/go/src/golang.org/x/mobile/event/key -I $WORK -I /home/joao/go/pkg/gomobile/pkg_android_arm64 -pack ./code_string.go ./key.go
cd /home/joao/go/src/golang.org/x/mobile/event/lifecycle
/usr/lib/go/pkg/tool/linux_amd64/compile -o $WORK/golang.org/x/mobile/event/lifecycle.a -trimpath $WORK -shared -goversion go1.9 -p golang.org/x/mobile/event/lifecycle -complete -installsuffix shared -buildid bf99e994e78f1deb73471d264df699f19074d230 -D _/home/joao/go/src/golang.org/x/mobile/event/lifecycle -I $WORK -I /home/joao/go/pkg/gomobile/pkg_android_arm64 -pack ./lifecycle.go
cd /home/joao/go/src/github.com/veandco/go-sdl2/sdl
pkg-config --libs sdl2
cd /home/joao/go/src/golang.org/x/mobile/app/internal/callfn
/usr/lib/go/pkg/tool/linux_amd64/asm -trimpath $WORK -I $WORK/golang.org/x/mobile/app/internal/callfn/_obj/ -I /usr/lib/go/pkg/include -D GOOS_android -D GOARCH_arm64 -shared -o $WORK/golang.org/x/mobile/app/internal/callfn/_obj/callfn_arm64.o ./callfn_arm64.s
cd /home/joao/go/src/github.com/veandco/go-sdl2/sdl
CGO_LDFLAGS="-target" "aarch64-none-linux-android" "--sysroot" "/home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64" "-gcc-toolchain" "/home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64" "-L/home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64/usr/lib" "-L/home/joao/go/pkg/gomobile/lib/arm64" "-lSDL2" /usr/lib/go/pkg/tool/linux_amd64/cgo -objdir $WORK/github.com/veandco/go-sdl2/sdl/_obj/ -importpath github.com/veandco/go-sdl2/sdl -exportheader=$WORK/github.com/veandco/go-sdl2/sdl/_obj/_cgo_install.h -- -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -D_REENTRANT -I/usr/include/SDL2 -I $WORK/github.com/veandco/go-sdl2/sdl/_obj/ -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include audio.go blendmode.go clipboard.go cpuinfo.go endian.go error.go events.go filesystem.go gamecontroller.go gesture.go haptic.go hints.go joystick.go keyboard.go keycode.go loadso.go log.go mouse.go mutex.go pixels.go power.go rect.go render.go rwops.go scancode.go sdl.go surface.go sysrender.go system_android.go syswm.go timer.go touch.go version.go video.go
cd /home/joao/go/src/golang.org/x/mobile/app/internal/callfn
pack r $WORK/golang.org/x/mobile/app/internal/callfn.a $WORK/golang.org/x/mobile/app/internal/callfn/_obj/callfn_arm64.o # internal
mkdir -p $WORK/golang.org/x/mobile/event/paint/_obj/
cd /home/joao/go/src/golang.org/x/mobile/event/paint
/usr/lib/go/pkg/tool/linux_amd64/compile -o $WORK/golang.org/x/mobile/event/paint.a -trimpath $WORK -shared -goversion go1.9 -p golang.org/x/mobile/event/paint -complete -installsuffix shared -buildid 173805b21b7e96874215f3ce6f321e3d94f9f5c7 -D _/home/joao/go/src/golang.org/x/mobile/event/paint -I $WORK -I /home/joao/go/pkg/gomobile/pkg_android_arm64 -pack ./paint.go
mkdir -p $WORK/golang.org/x/mobile/geom/_obj/
mkdir -p $WORK/golang.org/x/mobile/
cd /home/joao/go/src/golang.org/x/mobile/geom
/usr/lib/go/pkg/tool/linux_amd64/compile -o $WORK/golang.org/x/mobile/geom.a -trimpath $WORK -shared -goversion go1.9 -p golang.org/x/mobile/geom -complete -installsuffix shared -buildid 5007f28c1ca9745cf973cb1206c0e152054c0b0c -D _/home/joao/go/src/golang.org/x/mobile/geom -I $WORK -I /home/joao/go/pkg/gomobile/pkg_android_arm64 -pack ./geom.go
mkdir -p $WORK/golang.org/x/mobile/event/touch/_obj/
cd /home/joao/go/src/golang.org/x/mobile/event/touch
/usr/lib/go/pkg/tool/linux_amd64/compile -o $WORK/golang.org/x/mobile/event/touch.a -trimpath $WORK -shared -goversion go1.9 -p golang.org/x/mobile/event/touch -complete -installsuffix shared -buildid 048f9cfc2777d2b7918974b068d8fd8a6da7e8eb -D _/home/joao/go/src/golang.org/x/mobile/event/touch -I $WORK -I /home/joao/go/pkg/gomobile/pkg_android_arm64 -pack ./touch.go
mkdir -p $WORK/golang.org/x/mobile/gl/_obj/
cd /home/joao/go/src/golang.org/x/mobile/gl
CGO_LDFLAGS="-target" "aarch64-none-linux-android" "--sysroot" "/home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64" "-gcc-toolchain" "/home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64" "-L/home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64/usr/lib" "-L/home/joao/go/pkg/gomobile/lib/arm64" "-lGLESv2" /usr/lib/go/pkg/tool/linux_amd64/cgo -objdir $WORK/golang.org/x/mobile/gl/_obj/ -importpath golang.org/x/mobile/gl -exportheader=$WORK/golang.org/x/mobile/gl/_obj/_cgo_install.h -- -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -I $WORK/golang.org/x/mobile/gl/_obj/ -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -Dos_android -Dos_linux work.go
mkdir -p $WORK/golang.org/x/mobile/internal/mobileinit/_obj/
mkdir -p $WORK/golang.org/x/mobile/internal/
cd /home/joao/go/src/golang.org/x/mobile/internal/mobileinit
CGO_LDFLAGS="-target" "aarch64-none-linux-android" "--sysroot" "/home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64" "-gcc-toolchain" "/home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64" "-L/home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64/usr/lib" "-L/home/joao/go/pkg/gomobile/lib/arm64" "-landroid" "-llog" /usr/lib/go/pkg/tool/linux_amd64/cgo -objdir $WORK/golang.org/x/mobile/internal/mobileinit/_obj/ -importpath golang.org/x/mobile/internal/mobileinit -exportheader=$WORK/golang.org/x/mobile/internal/mobileinit/_obj/_cgo_install.h -- -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -I $WORK/golang.org/x/mobile/internal/mobileinit/_obj/ -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include ctx_android.go mobileinit.go mobileinit_android.go
mkdir -p $WORK/golang.org/x/mobile/event/size/_obj/
cd /home/joao/go/src/golang.org/x/mobile/event/size
/usr/lib/go/pkg/tool/linux_amd64/compile -o $WORK/golang.org/x/mobile/event/size.a -trimpath $WORK -shared -goversion go1.9 -p golang.org/x/mobile/event/size -complete -installsuffix shared -buildid c1a86e39d39ab064c658dcf25bd3c8ff361b7d02 -D _/home/joao/go/src/golang.org/x/mobile/event/size -I $WORK -I /home/joao/go/pkg/gomobile/pkg_android_arm64 -pack ./size.go
cd $WORK
/home/joao/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -fdebug-prefix-map=a=b -c trivial.c
/home/joao/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -gno-record-gcc-switches -c trivial.c
cd $WORK/golang.org/x/mobile/gl/_obj
/home/joao/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -I /home/joao/go/src/golang.org/x/mobile/gl -fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -I ./ -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -Dos_android -Dos_linux -o ./_cgo_export.o -c _cgo_export.c
/home/joao/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -I /home/joao/go/src/golang.org/x/mobile/gl -fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -I ./ -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -Dos_android -Dos_linux -o ./work.cgo2.o -c work.cgo2.c
cd /home/joao/go/src/golang.org/x/mobile/gl
/home/joao/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -I . -fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -I $WORK/golang.org/x/mobile/gl/_obj/ -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -Dos_android -Dos_linux -o $WORK/golang.org/x/mobile/gl/_obj/work.o -c work.c
cd $WORK/golang.org/x/mobile/internal/mobileinit/_obj
/home/joao/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -I /home/joao/go/src/golang.org/x/mobile/internal/mobileinit -fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -I ./ -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -o ./_cgo_export.o -c _cgo_export.c
cd $WORK/golang.org/x/mobile/gl/_obj
/home/joao/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -I /home/joao/go/src/golang.org/x/mobile/gl -fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -I ./ -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -Dos_android -Dos_linux -o ./_cgo_main.o -c _cgo_main.c
cd $WORK/golang.org/x/mobile/internal/mobileinit/_obj
/home/joao/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -I /home/joao/go/src/golang.org/x/mobile/internal/mobileinit -fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -I ./ -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -o ./ctx_android.cgo2.o -c ctx_android.cgo2.c
cd /home/joao/go/src/golang.org/x/mobile/gl
/home/joao/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -I . -fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -o $WORK/golang.org/x/mobile/gl/_obj/_cgo_.o $WORK/golang.org/x/mobile/gl/_obj/_cgo_main.o $WORK/golang.org/x/mobile/gl/_obj/_cgo_export.o $WORK/golang.org/x/mobile/gl/_obj/work.cgo2.o $WORK/golang.org/x/mobile/gl/_obj/work.o -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -L/home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64/usr/lib -L/home/joao/go/pkg/gomobile/lib/arm64 -lGLESv2 -pie
cd $WORK/golang.org/x/mobile/internal/mobileinit/_obj
/home/joao/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -I /home/joao/go/src/golang.org/x/mobile/internal/mobileinit -fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -I ./ -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -o ./mobileinit.cgo2.o -c mobileinit.cgo2.c
cd /home/joao/go/src/golang.org/x/mobile/gl
/usr/lib/go/pkg/tool/linux_amd64/cgo -dynpackage gl -dynimport $WORK/golang.org/x/mobile/gl/_obj/_cgo_.o -dynout $WORK/golang.org/x/mobile/gl/_obj/_cgo_import.go
cd $WORK
/home/joao/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -no-pie -c trivial.c
/home/joao/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -nopie -c trivial.c
cd /home/joao/go/src/golang.org/x/mobile/gl
/home/joao/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -I . -fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -o $WORK/golang.org/x/mobile/gl/_obj/_all.o $WORK/golang.org/x/mobile/gl/_obj/_cgo_export.o $WORK/golang.org/x/mobile/gl/_obj/work.cgo2.o $WORK/golang.org/x/mobile/gl/_obj/work.o -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -L/home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64/usr/lib -L/home/joao/go/pkg/gomobile/lib/arm64 -Wl,-r -nostdlib -nopie -Wl,--build-id=none
cd $WORK/golang.org/x/mobile/internal/mobileinit/_obj
/home/joao/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -I /home/joao/go/src/golang.org/x/mobile/internal/mobileinit -fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -I ./ -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -o ./mobileinit_android.cgo2.o -c mobileinit_android.cgo2.c
cd /home/joao/go/src/golang.org/x/mobile/gl
/usr/lib/go/pkg/tool/linux_amd64/compile -o $WORK/golang.org/x/mobile/gl.a -trimpath $WORK -shared -goversion go1.9 -p golang.org/x/mobile/gl -installsuffix shared -buildid 92311864ce8958c36469cdc56b5edbe54ca3abeb -D _/home/joao/go/src/golang.org/x/mobile/gl -I $WORK -I /home/joao/go/pkg/gomobile/pkg_android_arm64 -pack ./consts.go ./doc.go ./fn.go ./gl.go ./interface.go ./types_prod.go $WORK/golang.org/x/mobile/gl/_obj/_cgo_gotypes.go $WORK/golang.org/x/mobile/gl/_obj/work.cgo1.go $WORK/golang.org/x/mobile/gl/_obj/_cgo_import.go
cd $WORK/golang.org/x/mobile/internal/mobileinit/_obj
/home/joao/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -I /home/joao/go/src/golang.org/x/mobile/internal/mobileinit -fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -I ./ -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -o ./_cgo_main.o -c _cgo_main.c
cd /home/joao/go/src/golang.org/x/mobile/internal/mobileinit
/home/joao/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -I . -fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -o $WORK/golang.org/x/mobile/internal/mobileinit/_obj/_cgo_.o $WORK/golang.org/x/mobile/internal/mobileinit/_obj/_cgo_main.o $WORK/golang.org/x/mobile/internal/mobileinit/_obj/_cgo_export.o $WORK/golang.org/x/mobile/internal/mobileinit/_obj/ctx_android.cgo2.o $WORK/golang.org/x/mobile/internal/mobileinit/_obj/mobileinit.cgo2.o $WORK/golang.org/x/mobile/internal/mobileinit/_obj/mobileinit_android.cgo2.o -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -L/home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64/usr/lib -L/home/joao/go/pkg/gomobile/lib/arm64 -landroid -llog -pie
/usr/lib/go/pkg/tool/linux_amd64/cgo -dynpackage mobileinit -dynimport $WORK/golang.org/x/mobile/internal/mobileinit/_obj/_cgo_.o -dynout $WORK/golang.org/x/mobile/internal/mobileinit/_obj/_cgo_import.go
/home/joao/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -I . -fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -o $WORK/golang.org/x/mobile/internal/mobileinit/_obj/_all.o $WORK/golang.org/x/mobile/internal/mobileinit/_obj/_cgo_export.o $WORK/golang.org/x/mobile/internal/mobileinit/_obj/ctx_android.cgo2.o $WORK/golang.org/x/mobile/internal/mobileinit/_obj/mobileinit.cgo2.o $WORK/golang.org/x/mobile/internal/mobileinit/_obj/mobileinit_android.cgo2.o -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -L/home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64/usr/lib -L/home/joao/go/pkg/gomobile/lib/arm64 -Wl,-r -nostdlib -nopie -Wl,--build-id=none
/usr/lib/go/pkg/tool/linux_amd64/compile -o $WORK/golang.org/x/mobile/internal/mobileinit.a -trimpath $WORK -shared -goversion go1.9 -p golang.org/x/mobile/internal/mobileinit -installsuffix shared -buildid 4da950f49d588c21d3fcf3b130f25402176d3b86 -D _/home/joao/go/src/golang.org/x/mobile/internal/mobileinit -I $WORK -I /home/joao/go/pkg/gomobile/pkg_android_arm64 -pack $WORK/golang.org/x/mobile/internal/mobileinit/_obj/_cgo_gotypes.go $WORK/golang.org/x/mobile/internal/mobileinit/_obj/ctx_android.cgo1.go $WORK/golang.org/x/mobile/internal/mobileinit/_obj/mobileinit.cgo1.go $WORK/golang.org/x/mobile/internal/mobileinit/_obj/mobileinit_android.cgo1.go $WORK/golang.org/x/mobile/internal/mobileinit/_obj/_cgo_import.go
pack r $WORK/golang.org/x/mobile/internal/mobileinit.a $WORK/golang.org/x/mobile/internal/mobileinit/_obj/_all.o # internal
cd /home/joao/go/src/golang.org/x/mobile/gl
pack r $WORK/golang.org/x/mobile/gl.a $WORK/golang.org/x/mobile/gl/_obj/_all.o # internal
mkdir -p $WORK/golang.org/x/mobile/app/_obj/
cd /home/joao/go/src/golang.org/x/mobile/app
CGO_LDFLAGS="-target" "aarch64-none-linux-android" "--sysroot" "/home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64" "-gcc-toolchain" "/home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64" "-L/home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64/usr/lib" "-L/home/joao/go/pkg/gomobile/lib/arm64" "-landroid" "-llog" "-lEGL" "-lGLESv2" /usr/lib/go/pkg/tool/linux_amd64/cgo -objdir $WORK/golang.org/x/mobile/app/_obj/ -importpath golang.org/x/mobile/app -exportheader=$WORK/golang.org/x/mobile/app/_obj/_cgo_install.h -- -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -I $WORK/golang.org/x/mobile/app/_obj/ -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include android.go
cd $WORK/golang.org/x/mobile/app/_obj
/home/joao/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -I /home/joao/go/src/golang.org/x/mobile/app -fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -I ./ -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -o ./_cgo_export.o -c _cgo_export.c
/home/joao/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -I /home/joao/go/src/golang.org/x/mobile/app -fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -I ./ -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -o ./android.cgo2.o -c android.cgo2.c
cd /home/joao/go/src/golang.org/x/mobile/app
/home/joao/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -I . -fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -I $WORK/golang.org/x/mobile/app/_obj/ -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -o $WORK/golang.org/x/mobile/app/_obj/android.o -c android.c
# golang.org/x/mobile/app
android.c:103:44: warning: incompatible pointer types assigning to 'void (*)(ANativeActivity *, int)' (aka 'void (*)(struct ANativeActivity *, int)') from 'void (ANativeActivity *, GoInt)' (aka 'void (struct ANativeActivity *, long long)') [-Wincompatible-pointer-types]
cd $WORK/golang.org/x/mobile/app/_obj
/home/joao/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -I /home/joao/go/src/golang.org/x/mobile/app -fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -I ./ -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -I/home/joao/go/pkg/gomobile/include -o ./_cgo_main.o -c _cgo_main.c
cd /home/joao/go/src/golang.org/x/mobile/app
/home/joao/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -I . -fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -o $WORK/golang.org/x/mobile/app/_obj/_cgo_.o $WORK/golang.org/x/mobile/app/_obj/_cgo_main.o $WORK/golang.org/x/mobile/app/_obj/_cgo_export.o $WORK/golang.org/x/mobile/app/_obj/android.cgo2.o $WORK/golang.org/x/mobile/app/_obj/android.o -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -L/home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64/usr/lib -L/home/joao/go/pkg/gomobile/lib/arm64 -landroid -llog -lEGL -lGLESv2 -pie
/usr/lib/go/pkg/tool/linux_amd64/cgo -dynpackage app -dynimport $WORK/golang.org/x/mobile/app/_obj/_cgo_.o -dynout $WORK/golang.org/x/mobile/app/_obj/_cgo_import.go
/home/joao/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -I . -fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -o $WORK/golang.org/x/mobile/app/_obj/_all.o $WORK/golang.org/x/mobile/app/_obj/_cgo_export.o $WORK/golang.org/x/mobile/app/_obj/android.cgo2.o $WORK/golang.org/x/mobile/app/_obj/android.o -target aarch64-none-linux-android --sysroot /home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -gcc-toolchain /home/joao/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -L/home/joao/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64/usr/lib -L/home/joao/go/pkg/gomobile/lib/arm64 -Wl,-r -nostdlib -nopie -Wl,--build-id=none
/usr/lib/go/pkg/tool/linux_amd64/compile -o $WORK/golang.org/x/mobile/app.a -trimpath $WORK -shared -goversion go1.9 -p golang.org/x/mobile/app -installsuffix shared -buildid acb6c8544e3ea04c1a93e58986eb732508003718 -D _/home/joao/go/src/golang.org/x/mobile/app -I $WORK -I /home/joao/go/pkg/gomobile/pkg_android_arm64 -pack ./app.go ./doc.go $WORK/golang.org/x/mobile/app/_obj/_cgo_gotypes.go $WORK/golang.org/x/mobile/app/_obj/android.cgo1.go $WORK/golang.org/x/mobile/app/_obj/_cgo_import.go
pack r $WORK/golang.org/x/mobile/app.a $WORK/golang.org/x/mobile/app/_obj/_all.o # internal
# github.com/veandco/go-sdl2/sdl
In file included from ../../veandco/go-sdl2/sdl/mouse.go:9:
/usr/include/SDL2/SDL_syswm.h:72:10: fatal error: 'X11/Xlib.h' file not found
#include <X11/Xlib.h>
         ^~~~~~~~~~~~
1 error generated.
veeableful commented 7 years ago

We don't have a nice out-of-the-box support for Android yet but @gen2brain has kindly provided an example of using go-sdl2 on Android for us plebs at https://github.com/gen2brain/go-sdl2-android-example. I personally haven't tried it but perhaps it can help you.

It's definitely something that can be improved so I can keep this issue open.

billyninja commented 7 years ago

Thank you! I will try to follow @gen2brain steps/organization. The content covering gomobile across the web is very scarce (and most of the non-official came to be by the time of the initial release and is kinda outdated), any sort of good example is very valuable!


Edit: Looking into @gen2brain go-sdl2-android-example looks like a "hack" project from times when gomobile didn't exist yet. It is quite complex and basically does what gomobile try to solve, but hasn't been updated in a while.

I will try to ask for help at golang/go/x as well and keep you informed in case of success!


Edit2: Here's the issue I just opened at golang repo.

https://github.com/golang/go/issues/21901

gen2brain commented 6 years ago

@billyninja now you can use prebuilt libraries for Android, and other arches, with static tag (just initialize submodules in repo). Error you are having here is fixed in go-sdl2-libs repo (and SDL_config files for different arches are added).

To build binary for Android, you need just NDK and something like this can be used: CGO_ENABLED=1 CC=arm-linux-androideabi-gcc GOOS=android GOARCH=arm go build -tags static -ldflags "-s -w"

But such binary is not much useful on Android. I will see these days if I can update https://github.com/gen2brain/go-sdl2-android-example and if that turns out nice maybe also to include it in official examples here. E.g. something like instructions here for raylib-go I think are simple and easy to follow, and with static tag there is no need for bootstrap, standalone toolchain, SDL compile etc. just NDK and SDK https://github.com/gen2brain/raylib-go/tree/master/examples/others/android/example .

Btw. gomobile is not useful for this, maybe just to compile shared lib in .aar file, but for that you cannot use you app as main package. Just go build -buildmode=c-shared is enough.

gen2brain commented 5 years ago

New Android example, much simpler https://github.com/veandco/go-sdl2-examples/tree/master/examples/android .