Compiling Kodi terminates with oom

i guess i have to cross-compile on my Notebook; what i never did so far, btw.
i did a brief search for i.MX8M/Vivante but haven’t found much.

is there any docu available how-to cross-compile for Librem5/PureOS10?

Any guide for cross-compiling for Debian should apply.

1 Like

https://duckduckgo.com/?t=ftsa&q=cross+compile+for+debian+arm&ia=web
where to start?

may somebody has a good starting point for cross-compile beginners?

Probably the question I would start with is … what build tools does Kodi use? A Kodi forum is probably the right place to ask that.

Here’s one example of doing a cross-compile of uuu and Jumpdrive (build on x86 Ubuntu, target is Librem 5): https://source.puri.sm/Librem5/community-wiki/-/wikis/Building-uuu-and-Jumpdrive

Assuming that there is any kind of sane build tool being used that allows you to try an infinite number of times to build, it’s really just trial and error, looping over { build; what’s missing?; install it }.

there is a good guide from Kodi: https://github.com/xbmc/xbmc/blob/master/docs/README.Ubuntu.md.
with minor adaptations it runs on Librem5.

compiling breaks on L5 at building CXX object(s) with out-of-memory at about 50%, having stuff like uPNP disabled. i (de-)selected features to a minimum.
restarting build process starts again at 0%. it’s not e.g. fixing missing dependencies and restart.

kodi’s configure/build/install scripts detect the environment arm64, amd64, etc.
on all supported (linux) platforms the build command for Wayland & OpenGL embedded Systems is:
$> cmake …/kodi -DCMAKE_INSTALL_PREFIX=/usr/local -DCORE_PLATFORM_NAME=wayland -DAPP_RENDER_SYSTEM=gles

so, i have to cross-compile on my notebook with enough memory.

on my notebook i need to tell cmake the target environment arm64 and it also needs to know the target filesystem layout to install into!
Here i am lost!

Any help much appreciated!

finally i’ve cross-compiled Kodi for arm64 using toolchain from https://developer.arm.com/downloads/-/gnu-a.

I compiled it with

  1. VAAPI for hardware video acceleration
  2. Pipewire(, the new default in Kodi that acts as a replacement for Pulseaudio)

Both don’t work properly!

1.
video has stutters.

purism@pureos:~/kodi$ ./kodi.bin
libva info: VA-API version 1.10.0
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)

mpv videoplayer shows the same

purism@pureos:~$ mpv --hwdec=auto ~/Videos/Nextcloud\ intro.mp4
(+) Video --vid=1 () (h264 1920x1080 30.000fps)
(+) Audio --aid=1 --alang=deu (
) (aac 2ch 48000Hz)
[vaapi] libva: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[vaapi] libva: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[ffmpeg/video] h264_v4l2m2m: Could not find a valid device
[ffmpeg/video] h264_v4l2m2m: can’t configure decoder
Could not open codec.

i searched for drivers and found a merge to upstream Vivante gc7000 GPU support to mesa 22.2.

can someone (from purism) confirm that we will have hw video acceleration with mesa 22.2?
what’s the status of hw accel?

2.
there is no sound. Kodi has only pipewire as audio device. there is no Kodi sink in pavucontrol.
i see many

[E][000012432.495809][stream.c:319 stream_set_state()] stream 0xffff64001380: error no node available

is there a way to bridge it to pulseaudio? How to make it work?

any help much appreciated!

It already works since a long time ago.

You want V4L2 stateless decoding API, not VAAPI.

We’re not using PipeWire, so it’s not surprising that it doesn’t work. You want to use Kodi with PulseAudio backend.

1 Like

I got it to work smoothly with hardware acceleration and PulseAudio sound!
I’m very happy with it so far :smiley:

Next, I’m compiling the binary addon for tvheadend (hts) and configuring a dual-shock controller.
If anyone wants, I can compile more addons and create a tar ball (a deb or flatpak package may be later).

Let me know if there is any interest.

2 Likes

it’s not hardware accelerated.
i was mistaken by the low CPU due to low bandwidth of the video i played back.

If i got it right, Video 4 Linux (v4l) video acceleration is included in PipeWire.
PipeWire is currently the default in Kodi (when you compile).

Debian Wiki to PipeWire:
https://web.archive.org/web/20230422070304/https://wiki.debian.org/PipeWire

in PureOS we have:
purism@pureos:~/kodi$ sudo apt list --installed ‘pipewire
Listing… Done
libpipewire-0.3-0/byzantium,now 0.3.19-4 arm64 [installed,automatic]

i tried to make PipeWire 0.3.19 work following the recommendations from above link…
with no luck! i.e. no sound with PipeWire on Pulseaudio!

when do we get PipeWire 0.3.65 in PureOS?

1 Like

This has nothing to do with version number. PipeWire is not used as an audio server, so you can’t get sound to play through it. That’s normal, expected and there’s nothing to fix there.

1 Like

not sure if i understood it right?
v4l2 is supported/handled by the kernel.
kernel v4l2 api is exposed to clients like PipeWire.

i tried PipeWire 0.3.19 with no luck!
reading from above link:

In Debian 12, PipeWire 0.3.65 is available, and is considerably more reliable, and is a comfortable drop-in replacement for many use-cases. PipeWire is the default sound server with GNOME Desktop.

i would like to try 0.3.65 therefore i am asking.

This may be too late if you already succeeded cross-compiling, but to avoid out-of-memory issues when trying to compile something on the Librem 5 one useful trick is to reduce the number of parallel jobs used for the build. If it is old-style make then the option -j is often used which means make will run a number of parallel compilation processes, compiling several files in parallel which of course demands more memory. You can look at top while the build is ongoing to check if there are several compiler processes running. Then you can specify something like -j 2 to make it use 2 parallel jobs instead of 4, or you can remove the -j flag altogether so that it does not try to use parallelism at all. This should have no effect on the final result of the build, only use less memory and take longer time.

2 Likes

may be the sound and video hw accel will right with PipeWire 0.3.65?!

i compiled with

make VERBOSE=1 -j$(getconf _NPROCESSORS_ONLN)

on my Notebook (Intel Core i5, 8 Cores).
it takes ~2hours without the Addons.

the last time i compiled on L5 also with

make VERBOSE=1 -j$(getconf _NPROCESSORS_ONLN)

it run over night and presented me next morning
compilation failed caused by out of memory.

in this course of cross-compiling i learned to run make -j1 only in case of errors!. i re-run it with -j1 and see the error more easily.
otherwise you have to have a lot of time :slight_smile:

1 Like

No. You would have to reconfigure your whole system to use pipewire and pipewire-pulse instead of pulseaudio, which is not something we’re supporting right now.

1 Like

understood!
fortunately decoding in software up to Full HD the Librem5 is capable off!
Right now, I am watching FHD TV via Kodi on the Librem5.

i did the same yesterday having the librem5 laying with it’s back on my fabric couch.
it over heated. Playback stuttered and when i picked it up i almost burned my fingers.

this is my current setup and so far it works!

1 Like