Open udhos opened 7 years ago
Yeah that's pretty sad. The known workaround is to get the previous version of the sdk tools, see https://github.com/NativeScript/nativescript-cli/issues/2583#issuecomment-283712933
This was the latest March release of SDK tools that removed the android utility without providing a fallback. https://developer.android.com/studio/releases/sdk-tools.html
longtran@longtran:~/go/src/github.com/xlab/android-go/example-egl$ make mkdir -p android/jni/lib CC="/home/longtran/go/src/github.com/xlab/android-go/example-egl/toolchain/bin/arm-linux-androideabi-gcc" \ CXX="/home/longtran/go/src/github.com/xlab/android-go/example-egl/toolchain/bin/arm-linux-androideabi-g++" \ CGO_CFLAGS="-march=armv7-a" \ GOOS=android \ GOARCH=arm \ GOARM=7 \ CGO_ENABLED=1 \ go build -buildmode=c-shared -o android/jni/lib/libexample.so
/tmp/go-build017993175/runtime/cgo/_obj/gcc_android.o:gcc_android.c:function fatalf: error: undefined reference to 'stderr' /tmp/go-build017993175/runtime/cgo/_obj/gcc_libinit.o:gcc_libinit.c:function x_cgo_sys_thread_create: error: undefined reference to 'stderr' /tmp/go-build017993175/runtime/cgo/_obj/gcc_util.o:gcc_util.c:function x_cgo_thread_start: error: undefined reference to 'stderr' collect2: error: ld returned 1 exit status Makefile:13: recipe for target 'build' failed make: *** [build] Error 2
@longtq6195-seta-international unfortunately I can't reproduce, tried both Go 1.8.1 and 1.9beta2. I'm using OS X, so this may be different from your setup. Probably a bug in Go compiler on this platform
I'm getting similar errors:
➜ example git:(master) ✗ make
mkdir -p android/jni/lib
CC="/home/tirithen/.go/src/github.com/xlab/android-go/example/toolchain/bin/arm-linux-androideabi-gcc" \
CXX="/home/tirithen/.go/src/github.com/xlab/android-go/example/toolchain/bin/arm-linux-androideabi-g++" \
CGO_CFLAGS="-march=armv7-a" \
GOOS=android \
GOARCH=arm \
GOARM=7 \
CGO_ENABLED=1 \
go build -buildmode=c-shared -o android/jni/lib/libexample.so
# runtime/cgo
/tmp/go-build521705144/runtime/cgo/_obj/gcc_android.o:gcc_android.c:function fatalf: error: undefined reference to 'stderr'
/tmp/go-build521705144/runtime/cgo/_obj/gcc_libinit.o:gcc_libinit.c:function x_cgo_sys_thread_create: error: undefined reference to 'stderr'
/tmp/go-build521705144/runtime/cgo/_obj/gcc_util.o:gcc_util.c:function x_cgo_thread_start: error: undefined reference to 'stderr'
collect2: error: ld returned 1 exit status
make: *** [Makefile:14: build] Fel 2
Go version
➜ example git:(master) ✗ go version
go version go1.8.3 linux/amd64
Oh, and my machine is running Arch Linux with the Android packages installed through AUR
CFLAGS=-D__ANDROID_API__=$API worked for me. But there are other problem.
make mkdir -p android/jni/lib CC="/mnt/data/GO/src/github.com/golang-ui/nuklear/cmd/nk-android/toolchain/bin/arm-linux-androideabi-gcc" \ CXX="/mnt/data/GO/src/github.com/golang-ui/nuklear/cmd/nk-android/toolchain/bin/arm-linux-androideabi-g++" \ CGO_CFLAGS="-march=armv7-a -std=c99 -D__ANDROID_API__=21" \ GOOS=android \ GOARCH=arm \ GOARM=7 \ CGO_ENABLED=1 \ go build -tags gles3 -buildmode=c-shared -o android/jni/lib/libnkactivity.so
github.com/xlab/android-go/android In file included from ../../../../xlab/android-go/android/types.go:25:0: /mnt/data/GO/src/github.com/golang-ui/nuklear/cmd/nk-android/toolchain/sysroot/usr/include/android/tts.h:99:8: error: expected identifier or '(' before string constant extern "C" android_tts_engine_t *getTtsEngine(); ^ make: *** [Makefile:15: build] Error 2
I fixed it by removing any "#include <android/tts.h>" lines. So the libnkactivity.so compiled.
I am reading guidelines from: https://github.com/xlab/android-go/tree/master/example
I hit this:
I noticed the need for the 'android' tool. However:
How can I get past such a point?