gen2brain / raylib-go

Go bindings for raylib, a simple and easy-to-use library to enjoy videogames programming.
zlib License
1.6k stars 164 forks source link

add toturial to new android ndk #235

Closed MatejMagat305 closed 11 months ago

MatejMagat305 commented 1 year ago

I was trying to compile library, but new parth of ndk was chalange, all headers seems is included, but I do not know why it write error with ";", maybe will hood to add next example ...

export ndk=/home/matejmag/Android/Sdk/ndk/25.1.8937393
export ANDROID_SYSROOT=${ndk}/toolchains/llvm/prebuilt/linux-x86_64/sysroot
export ANDROID_PLATFORM=${ndk}/platforms/android-16/arch-arm
export ANDROID_TOOLCHAIN=${ANDROID_SYSROOT}/usr/lib/aarch64-linux-android
GOOS=android \
GOARCH=arm64 \
CC=${ndk}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang \
CXX=${ndk}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang++ \
CGO_CFLAGS="-I${ANDROID_SYSROOT}/usr/include -I${ANDROID_SYSROOT}/usr/include/arm-linux-androideabi --sysroot=${ANDROID_SYSROOT}" \
CGO_LDFLAGS="-L${ANDROID_SYSROOT}/usr/lib/arm-linux-androideabi
-I${ANDROID_SYSROOT}usr/include/GLES
 -I${ANDROID_SYSROOT}usr/include/GLES2
 -I${ANDROID_SYSROOT}usr/include/GLES3
 -I${ANDROID_SYSROOT}usr/include/EGL
 -I${ndk}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/aarch64-linux-android/asm
 -I${ndk}/toolchains/llvm/prebuilt/linux-x86_64/include/c++/4.9.x
 -I${ANDROID_TOOLCHAIN}
  -lpthread
 -I${ANDROID_TOOLCHAIN}/33 --sysroot=${ANDROID_TOOLCHAIN}/33" \
CGO_ENABLED=1 \
go build -buildmode=c-shared -ldflags="-s -w" \
-o=android/libs/armeabi-v7a/libexample.so
gen2brain commented 1 year ago

@MatejMagat305 I didn't try to build but looks like you are mixing arm and arm64 everywhere. The compiler is set for arm64, include and libs for arm, GOARCH=arm64 but the output is set to armeabi-v7a, etc.

gen2brain commented 11 months ago

Updated in https://github.com/gen2brain/raylib-go/commit/3120f5fb0851f8569e85000e6db90f96e152b195.