Discover Packages
github.com/temorfeouz/gocl
android
directory
Version:
v0.0.0-...-08f7baa
Opens a new window with list of versions in this module.
Published: Dec 3, 2021
License: MIT
Opens a new window with license information.
README
README
¶
GOCL on Android
Install Ant.
install http://archive.apache.org/dist/ant/binaries/apache-ant-1.9.2-bin.tar.gz to /usr/local
"export ANT_HOME=/usr/local/apache-ant"
Install Android SDK.
install http://dl.google.com/android/android-sdk_r23.0.2-darwin.tgz to /usr/local
"export ANDROID_HOME=/usr/local/android-sdk"
"$ANDROID_HOME/tools/android update sdk --no-ui --all --filter build-tools-19.1.0"
"$ANDROID_HOME/tools/android update sdk --no-ui --all --filter platform-tools"
"$ANDROID_HOME/tools/android update sdk --no-ui --all --filter android-19"
Install Android NDK.
install http://dl.google.com/android/ndk/android-ndk-r9d-darwin-x86_64.tar.bz2 to /usr/local
"export NDK_ROOT=/usr/local/android-ndk"
"copy gocl/android/include/CL/. into $NDK_ROOT/platform/android-19/arch-arm/usr/include"
"copy gocl/android/lib/. into $NDK_ROOT/platform/android-19/arch-arm/usr/lib"
"$NDK_ROOT/build/tools/make-standalone-toolchain.sh --platform=android-19 --install-dir=$NDK_ROOT --system=darwin-x86_64"
Update PATH for the above.
"export PATH=$PATH:$ANDROID_HOME/tools"
"export PATH=$PATH:$ANDROID_HOME/platform-tools"
"export PATH=$PATH:$NDK_ROOT"
"export PATH=$PATH:$ANT_HOME/bin"
Install Go from source code.
"cd $GOROOT/src"
"CC=clang ./make.bash"
"CC_FOR_TARGET=$NDK_ROOT/bin/arm-linux-androideabi-gcc CGO_ENABLED=1 GOOS=android GOARCH=arm GOARM=7 ./make.bash"
"go env | grep CC="
Install Go.Mobile
go get -d -t golang.org/x/mobile/...
"cd $GOPATH/src/golang.org/x/mobile/example/basic"
build android: GO_ENABLED=1 GOOS=android GOARCH=arm GOARM=7 go build -tags="cl11" -ldflags="-shared" -o jni/armeabi/libbasic.so
build darwin: CC=clang go build -tags 'cl11' gocl/cl
Install GOCL into Go.Mobile
"copy gocl/cl into $GOPATH/src/golang.org/x/mobile/"
"copy gocl/android/example/goclinfo or libhello into $GOPATH/src/golang.org/x/mobile/example/"
"copy gocl/android/lib/* into your rooted Nexus 5 with Android 4.4.4 /system/lib/"
"cd $GOPATH/src/golang.org/x/mobile/goclinfo/ or libhello"
"./all.bash"
For goclinfo, If you can see Green background and Blue triangle, then OpenCL program is successfully running in your android device. Otherwise you will see Red background or crash. At lease my rooted Nexus 5 with Android 4.4.4 works. Or, if you use
"$ adb shell
logcat",
you may see the following log inforamtion:
I/GoStdio ( 6212): Number of platforms: 1
I/GoStdio ( 6212): CL_PLATFORM_PROFILE : EMBEDDED_PROFILE
I/GoStdio ( 6212): CL_PLATFORM_VERSION : OpenCL 1.1 QUALCOMM build: ()
I/GoStdio ( 6212): Build Date: 11/06/13 Wed
I/GoStdio ( 6212): Local Branch: hammerhead_klp
I/GoStdio ( 6212): Remote Branch:
I/GoStdio ( 6212): CL_PLATFORM_VENDOR : QUALCOMM
I/GoStdio ( 6212): CL_PLATFORM_EXTENSIONS :
I/GoStdio ( 6212): Number of devices: 2
I/GoStdio ( 6212): CL_DEVICE_TYPE : CL_DEVICE_TYPE_GPU
I/GoStdio ( 6212): CL_DEVICE_NAME : QUALCOMM Adreno(TM)
I/GoStdio ( 6212): CL_DEVICE_VENDOR : QUALCOMM
I/GoStdio ( 6212): CL_DEVICE_PROFILE : EMBEDDED_PROFILE
I/GoStdio ( 6212): CL_DEVICE_TYPE : CL_DEVICE_TYPE_CPU
I/GoStdio ( 6212): CL_DEVICE_NAME : QUALCOMM Krait(TM)
I/GoStdio ( 6212): CL_DEVICE_VENDOR : QUALCOMM
I/GoStdio ( 6212): CL_DEVICE_PROFILE : EMBEDDED_PROFILE
Expand ▾
Collapse ▴
Directories
¶
example
goclinfo
An app that draws a blue triangle on a red background.
An app that draws a blue triangle on a red background.
libhello
This is the Go entry point for the libhello app.
This is the Go entry point for the libhello app.
libhello/hi
Package hi provides a function for saying hello.
Package hi provides a function for saying hello.
Package go_hi is an autogenerated binder stub for package hi.
Click to show internal directories.
Click to hide internal directories.