Running raylib examples in termux
Tyting to code some ideas with raylib inside termux but at first it fails to compile:
$ git clone https://github.com/gen2brain/raylib-go.git && go -C raylib-go/examples/games/life run .
# github.com/gen2brain/raylib-go/raylib
In file included from raudio.c:221:
./external/stb_vorbis.c:1404:75: warning: pointer comparison always evaluates to false [-Wtautological-compare]
# github.com/gen2brain/raylib-go/raylib
In file included from rcore.c:561:
./platforms/rcore_android.c:940:81: error: incompatible pointer to integer conversion passing 'ANativeWindow *' (aka 'struct ANativeWindow *') to parameter of type 'EGLNativeWindowType' (aka 'unsigned long') [-Wint-conversion]
../../../../../usr/bin/../../usr/include/EGL/egl.h:136:109: note: passing argument to parameter 'win' here
In file included from rcore.c:561:
./platforms/rcore_android.c:1004:97: error: incompatible pointer to integer conversion passing 'ANativeWindow *' (aka 'struct ANativeWindow *') to parameter of type 'EGLNativeWindowType' (aka 'unsigned long') [-Wint-conversion]
../../../../../usr/bin/../../usr/include/EGL/egl.h:136:109: note: passing argument to parameter 'win' here
It is possible to overcome this error turning it to warning but it fails to start with segfault
CGO_CFLAGS="-Wno-int-conversion -Wno-tautological-compare" go -C raylib-go/examples/games/life run .
signal: segmentation fault
Did i miss something simple to make it run?
The Android implementation is different than standard desktop. It has its own custom entry point, it uses NativeActivity, and it must be compiled to a dynamic library that is then loaded from the standard Android manifest. Check the Android example in this repository; what you are trying to do will, of course, not work like that.
in fact i was trying build it running as X11 application in termux-x11
CGO_CFLAGS="-Wno-int-conversion -Wno-tautological-compare" go -C raylib-go/examples/games/life run -tags x11 .
did segfault too
The build constraints/tags for Android in files are forcing it to use an Android path, not a desktop path.
The question is any way to run an example targeting termux-x11 ?
I.e., linux && !android and androd && !linux. The android is "special" in Go because it can be built for both linux and android tags. That is why it is done like that.
Now that I've explained it, you can make the necessary changes and test it yourself.
Just a note, if you can make it work, the current build tags should stay, but we can introduce, e.g., termux build tag that will use X11 on the Android platform and behave like on the desktop.