Closed T-Dynamos closed 2 years ago
This is basically due to android/ndk#201.
XAllocClassHint
is defined in $PREFIX/lib/libX11.so
, so you need to
export LDFLAGS+=" -lX11"
before building.
Can you show an example of working kivy on termux?
@xtkoba I tried reinstalling with pip but it installed in like few seconds previous build took like an hour . I am now retrying with pip cache purge
[CRITICAL] [Window ] Unable to find any valuable Window provider. Please enable debug logging (e.g. add -d if running from the command line, or change the log level in the config) and re-run your app to identify potential causes
sdl2 - RuntimeError: b'OpenGL support is either not configured in SDL or not available in current SDL video driver (x11) or platform'
@xtkoba Thanks
No need to mention my name.
Note that currently sdl2
packages is not configured with OpenGL support: https://github.com/termux/x11-packages/issues/624.
Transferring to x11-packages repository.
Add mtdev also in requirements it was also giving error of dlopen failed unable to locate libmtdev.so.1 when I installed mtdev in termux it makes so file libmtdev.so so i made a symbolic link with ln -s libmtdev.so to libmtdev.so.1 and it worked . Same error as https://github.com/termux/x11-packages/issues/624#issuecomment-1057869114
As for mtdev,
--- a/kivy/lib/mtdev.py
+++ b/kivy/lib/mtdev.py
@@ -27,7 +27,7 @@
# load library
if 'KIVY_DOC' not in os.environ:
- libmtdev = cdll.LoadLibrary('libmtdev.so.1')
+ libmtdev = cdll.LoadLibrary('libmtdev.so')
# from linux/input.h
MTDEV_CODE_SLOT = 0x2f # MT slot being modified
Are you done with it ? If not can I test it?
You can test the artifacts in PR #637 and see what happens. Do not forget to uninstall pip-managed kivy
before installing the deb package. The PR is marked as draft because it is not going to be merged unless pip install kivy
on device is severely broken.
I cannot reproduce the XAllocClassHint
issue. (Maybe some dependencies are missing?)
In this build.sh this you have set ldflags to something else that you have suggest me ??
LDFLAGS+=" -lpython${_PYTHON_VERSION}"
You said that to keep it
export LDFLAGS+=" -lX11"
Getting same error of sdl2 not configured with opengl even after installing deb file
Do i have to install sdl2 again?
In reply to the former part: -lpython3.10
is yet another workaround for android/ndk#201 that is necessary for building every Python extension. With cross building (or with current dependency) -X11
is not needed thus "cannot reproduce."
In reply to the latter part: it is expected because sdl2
package in our x11 repo is not configured with OpenGL (#624):
These two parts are not much relevant to each other.
So now I have to rebuild sdl2 with --enable-video-opengl
?
Any why this can't be added in termux
Getting this after build
sdl2 - RuntimeError: b'SDL not configured with OpenGL/GLX support'
You can test the artifacts in PR #639 and see what happens when combined with mesa
.
Works fine and window work but gives error of cut buffer
[CRITICAL] [Cutbuffer ] Unable to find any valuable Cutbuffer provider. Please enable debug logging (e.g. add -d if running from the command line, or change the log level in the config) and re-run your app to identify potential causes
xclip - FileNotFoundError: [Errno 2] No such file or directory: 'xclip'
And window crashes Ok fixed it by building xclip from https://github.com/astrand/xclip here but still window crashes
@xtkoba
I think the error was the mesa update, kivy needs to use openGL in a basic way, the previous version of mesa worked without problems, but when you updated mesa, it was broken, when running any program that is going to use OpenGL, "Bad System call" appears, this did not happen before.
@Yisus7u7 But glxgears
works fine with huge fps
Segmentation Fault in kivy
But
glxgears
works fine with huge fps
Well, this may happen only in arm32
Not surprisingly.
I suggest you to check kivy python for Android recipes
https://github.com/kivy/python-for-android/tree/develop/pythonforandroid/recipes
Segmentation Fault in kivy
How do you know that the issue is in kivy and not in the project you are trying to run? Try running some minimal kivy example instead
I suggest you to check kivy python for Android recipes
https://github.com/kivy/python-for-android/tree/develop/pythonforandroid/recipes
Not sure what we are suppose to "check" there
Those recipes do not seem to be for Termux. Note that Termux is pretending not to be Androind in many situations. Building sdl2
is one of them:
Ok I am trying but I even tried running kivy on proot-distro Ubuntu arm64 have same segmentation fault error , but same project on arm32 proot-distro Ubuntu works well and One thing more my project was working fine on android with buildozer (kivy) apk architecture was https://github.com/T-Dynamos/SRAPS-App/blob/f95ca4d772b974d244b044398777874548839649/buildozer.spec#L222 armeabi-v7a , therefore I suggest to see kivy's python for android recipes here's my project link I was using kivymd module
https://github.com/T-Dynamos/SRAPS-App So i tried a simple program
import kivy
from kivy.app import App
from kivy.uix.label import Label
# Replace this with your
# current version
kivy.require('1.11.1')
# Defining a class
class MyFirstKivyApp(App):
# Function that returns
# the root widget
def build(self):
# Label with text Hello World is
# returned as root widget
return Label(text ="Hello World !")
# Here our class is initialized
# and its run() method is called.
# This initializes and starts
# our Kivy application.
MyFirstKivyApp().run()
It works so what's issue
Simple kivy programs seems to be work but including kivymd module just crashes with
fish: Job 1, 'python3 main.py' terminated by signal SIGSEGV (Address boundary error)
@Yisus7u7 TL;DR:
export LD_PRELOAD="libandroid-shmem.so"
A little bit detail:
A basic thing that you should do when encounteing with "Bad system call" or similar is to strace
the process.
With strace
ing the glxgears
process I get the following line in the trace log:
--- SIGSYS {si_signo=SIGSYS, si_code=SYS_SECCOMP, si_call_addr=0x797ede3430, si_syscall=__NR_shmget, si_arch=AUDIT_ARCH_AARCH64} ---
This reminded me of https://github.com/termux/termux-packages/issues/8162 immediately. If the process called the shmget
function defined in libandroid-shmem.so
, then the system call shmget
would never be called.
If I opened an issue about this, I would give it the title as follows:
[Bug]:
libandroid-shmem
not taking effect unless linked against main executable
[EDIT]: There is a workaround that makes LD_PRELOAD
unnecessary. A preceding example is for res_init
and res_search
in krb5
package. I'll work on it.
Looks like it is also Segfaulting somewere after mesa's blend_general_float() function. Due to an invalid memory acess. Dont think there is something to do with kivymd itself.
For now i am just watching how you guys will solve this, looks like pretty complicated.
This is very interesting, because the previous mesa version was working well with kivymd.
I think so kivymd uses pillow and there's problem with pillow
I think so kivymd uses pillow and there's problem with pillow
The problem is not Pillow. In fact it is mesa's fault. Kivy let you change kivy's image, font, and audio providers with the environment variables. Pillow is not a requirement.
export KIVY_GL_DEBUG=1
...
GL glClear( mask = 17664, )
GL glUseProgram( program = 1, )
GL glUniform1f( location = 3, x = 1.0, )
GL glUniform1i( location = 4, x = 0, )
GL glUniform4f( location = 2, x = 1.0, y = 1.0, z = 1.0, w = 1.0, )
GL glUniformMatrix4fv( location = 1, count = 1, transpose = 0, value*='0x7fedd72990', )
GL glUniformMatrix4fv( location = 0, count = 1, transpose = 0, value*='0x7fedd72990', )
GL glGetUniformLocation( program = 1, name*=b'frag_modelview_mat', )
GL glGetIntegerv( pname = 35725, params*='0x7fedd72584', )
GL glUniform4f( location = 2, x = 0.0, y = 0.0, z = 0.0, w = 0.0, )
GL glBindTexture( target = 3553, texture = 1, )
GL glGenBuffers( n = 1, buffers*='0x71953f6e78', )
GL glBindBuffer( target = 34963, buffer = 1, )
GL glBufferData( target = 34963, size = 96, data*='0x727b9beb70', usage = 35048, )
GL glGenBuffers( n = 1, buffers*='0x719565ed60', )
GL glBindBuffer( target = 34962, buffer = 2, )
GL glDrawElements( mode = 3, count = 74, type = 5123, indices*='0x0', )
Got a call trace, with the KIVY_GL_DEBUG environment variable, these are the last calls before crashing
Looks like there is something to do with the texturing or even shading.
But, Dont worry, this will be solved soon! Kivy is almost working!
The problem is neither of the python libraries.
Ah, I almost forgot this. Would you please open a new issue for the mesa
crash? As discussed above, it seems to be independent of kivy
. If possible, please provide a reproducing example that does not use kivy
. Thanks.
Couldn't believe on my eyes . I am @T-Dynamos termux-info
Application version:
0.117
Packages CPU architecture:
arm
Subscribed repositories:
# sources.list
deb https://packages-cf.termux.org/apt/termux-main stable main
# game-repo (sources.list.d/game.list)
deb https://packages.termux.org/apt/termux-games games stable
# science-repo (sources.list.d/science.list)
deb https://packages.termux.org/apt/termux-science science stable
# x11-repo (sources.list.d/x11.list)
deb https://packages.termux.org/apt/termux-x11 x11 main
Updatable packages:
apt/stable 2.4.1-2 arm [upgradable from: 2.3.6]
bash/stable 5.1.16-1 arm [upgradable from: 5.1.16]
curl/stable 7.82.0-1 arm [upgradable from: 7.82.0]
gzip/stable 1.12 arm [upgradable from: 1.11-3]
libcap-ng/stable 2:0.8.3 arm [upgradable from: 1:0.8.3-pre1-0]
libcurl/stable 7.82.0-1 arm [upgradable from: 7.82.0]
libexpat/stable 2.4.8 arm [upgradable from: 2.4.7]
libgcrypt/stable 1.10.1 arm [upgradable from: 1.9.4]
libsqlite/stable 3.38.2 arm [upgradable from: 3.38.1]
perl/stable 5.34.1-1 arm [upgradable from: 5.34.1]
termux-keyring/stable 3.1 all [upgradable from: 3.0]
termux-tools/stable 0.173 all [upgradable from: 0.168]
unbound/stable 1.15.0 arm [upgradable from: 1.13.2-3]
util-linux/stable 2.38 arm [upgradable from: 2.37.4]
zlib/stable 1.2.12 arm [upgradable from: 1.2.11-5]
Android version:
10
Kernel build information:
Linux localhost 4.9.190-perf-gba91b47 #1 SMP PREEMPT Tue Mar 8 15:43:19 CST 2022 armv8l Android
Device manufacturer:
Xiaomi
Device model:
M2006C3MII
Working on arm . I used master branch of kivymd
pip3 install https://github.com/kivymd/KivyMD/archive/refs/heads/master.zip
Can you please include steps on Termux wiki to instl kivy?
apt install "sdl2*" "sdl2-*" -y
LDFLAGS+=" -lpython3.10"
pip3 install kivy
pip3 install https://github.com/kivymd/KivyMD/archive/refs/heads/master.zip
But fps are too low like 2fps , but on a application it works fine . Do we have build some graphics drivers?
@T-Dynamos
apt install gl4es
LD_LIBRARY_PATH=$PREFIX/lib/gl4es ./app.py
For graphics drivers?
For graphics drivers?
Yes
And what does it means ?
Mesa: User error: GL_INVALID_OPERATION in glUniform1("t"@2 is float, not int)
Mesa: User error: GL_INVALID_OPERATION in glUniform1("t"@2 is float, not int)
For graphics drivers?
Yes
I don't get it . Can you explain?
Yes, works slow...
Ok let's try it on arm64 till then you can try with fps monitoring and these examples https://github.com/HeaTTheatR/Articles and this also https://github.com/T-Dynamos/SRAPS-App
Termux-info
Application version:
0.118.0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://packages-cf.termux.org/apt/termux-main stable main
# x11-repo (sources.list.d/x11.list)
deb https://packages.termux.org/apt/termux-x11 x11 main
# root-repo (sources.list.d/root.list)
deb https://packages.termux.org/apt/termux-root root stable
# sources.list.d/termux-desktop-xfce.list
deb [trusted=yes arch=all] https://Yisus7u7.github.io/termux-desktop-xfce/packages desktop-xfce extras
Updatable packages:
All packages up to date
Android version:
7.0
Kernel build information:
Linux localhost 3.18.31-perf-g040a88f #1 SMP PREEMPT Thu Nov 7 00:28:25 WIB 2019 aarch64 Android
Device manufacturer:
Xiaomi
Device model:
Redmi Note 4
Its confirmed that issue is only on arm64
and simple kivy programs work with same slow speed as arm
@xtkoba Please add arm64 tag and reopen issue
Problem description
I successfully compiled kivy but unable to get window some error occurs
What steps will reproduce the bug?
What is the expected behavior?
It should work
System information
termux-info: